Firefly开源社区

标题: 制作rootfs镜像的时候,报random_device的错误 [打印本页]

作者: susfly    时间: 2021-9-23 16:35
标题: 制作rootfs镜像的时候,报random_device的错误
按照官方教程制作,但镜像采用的是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:/#

作者: gonglvlv    时间: 2022-2-14 14:05
解决了吗
作者: yg2022    时间: 2022-2-15 11:09
备份源:
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
作者: BYJ    时间: 2022-2-27 11:15
请问解决了没》?
作者: 木喳喳    时间: 2022-8-18 20:48
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
根本的解决方法是,查看内核是不是加载了该字符设备的原因。
作者: Liuth    时间: 2022-8-19 09:16
木喳喳 发表于 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
作者: 木喳喳    时间: 2023-1-6 16:16
Liuth 发表于 2022-8-19 09:16
其实应该是先要把主机的设备挂载进去
sudo mount -t proc /proc dest/proc
sudo mount -t sysfs /sys d ...

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




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1