Firefly开源社区

[Linux] 制作rootfs镜像的时候,报random_device的错误

63

积分

0

威望

0

贡献

技术小白

积分
63
发表于 2021-9-23 16:35:43     
按照官方教程制作,但镜像采用的是18.04的rootfs,chroot进到qemu的模拟环境后,
尝试apt-get update,报错了。

root@fly-System-Product-Name:/#
root@fly-System-Product-Name:/# apt-get update
Get:1 https://wiki.t-firefly.com/firefly-rk3399-repo bionic InRelease [2585 B]                           
Get:2 http://mirrors.aliyun.com/ubuntu-ports bionic InRelease [242 kB]                                      
Get:3 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]         
Get:4 http://mirrors.aliyun.com/ubuntu-ports bionic-updates InRelease [88.7 kB]                             
Get:5 http://mirrors.aliyun.com/ubuntu-ports bionic-backports InRelease [74.6 kB]
Get:6 http://mirrors.aliyun.com/ubuntu-ports bionic-security InRelease [88.7 kB]
0% [1 InRelease gpgv 2585 B]terminate called after throwing an instance of 'std::runtime_error'
  what():  random_device::random_device(const std::string&)
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted (core dumped)
root@fly-System-Product-Name:/#
回复

使用道具 举报

9

积分

0

威望

0

贡献

吃瓜的群众

积分
9
发表于 2022-2-14 14:05:21     
解决了吗
回复

使用道具 举报

20

积分

0

威望

0

贡献

技术小白

积分
20
发表于 2022-2-15 11:09:22     
备份源:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
更换18.04源试试:
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
回复

使用道具 举报

16

积分

0

威望

0

贡献

技术小白

积分
16
发表于 2022-2-27 11:15:12     
请问解决了没》?
回复

使用道具 举报

6

积分

0

威望

0

贡献

吃瓜的群众

积分
6
发表于 2022-8-18 20:48:23     
terminate called after throwing an instance of 'std::runtime_error'
what():  random_device::random_device(const std::string&)
问题的原因:
是因为random_device会打开/dev/random或者/dev/urandom,你的文件系统中没有这个设备,进而抛出了异常;
/dev/random和/dev/urandom是Linux系统中提供的随机伪设备,这两个设备的任务,是提供永不为空的随机字节数据流。很多解密程序与安全应用程序(如SSH Keys,SSL Keys等)需要它们提供的随机数据流。
这两个设备的差异在于:/dev/random的random pool依赖于系统中断,因此在系统的中断数不足时,/dev/random设备会一直封锁,尝试读取的进程就会进入等待状态,直到系统的中断数充分够用, /dev/random设备可以保证数据的随机性。/dev/urandom不依赖系统的中断,也就不会造成进程忙等待,但是数据的随机性也不高。
解决的方法:
如果你的文件系统在启动的是没有创建设备,可以创建一个:
mknod -m 644 /dev/random c 1 8
mknod -m 644 /dev/urandom c 1 9
chown root:root /dev/random /dev/urandom
根本的解决方法是,查看内核是不是加载了该字符设备的原因。
回复

使用道具 举报

2077

积分

10

威望

12

贡献

中级创客

Rank: 4

积分
2077
发表于 2022-8-19 09:16:47     
木喳喳 发表于 2022-8-18 20:48
terminate called after throwing an instance of 'std::runtime_error'
what():  random_device::random ...

其实应该是先要把主机的设备挂载进去
sudo mount -t proc /proc dest/proc
sudo mount -t sysfs /sys dest/sys
sudo mount -o bind /dev dest/dev
sudo mount -o bind /dev/pts dest/dev/pts
回复

使用道具 举报

6

积分

0

威望

0

贡献

吃瓜的群众

积分
6
发表于 2023-1-6 16:16:55     
Liuth 发表于 2022-8-19 09:16
其实应该是先要把主机的设备挂载进去
sudo mount -t proc /proc dest/proc
sudo mount -t sysfs /sys d ...

是的,我这个方法,安装的话还是存在错误,但是可以成功安装;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表