![无法打开 /dev/hwrng:没有这样的设备 - 但它存在!](https://linux22.com/image/996843/%E6%97%A0%E6%B3%95%E6%89%93%E5%BC%80%20%2Fdev%2Fhwrng%EF%BC%9A%E6%B2%A1%E6%9C%89%E8%BF%99%E6%A0%B7%E7%9A%84%E8%AE%BE%E5%A4%87%20-%20%E4%BD%86%E5%AE%83%E5%AD%98%E5%9C%A8%EF%BC%81.png)
我们的熵非常低(HTTPS apache 服务器,Ubuntu 12.04,不是 VM,硬件:使用联想 ThinkCentre M58):
root@server:~# cat /proc/sys/kernel/random/entropy_avail
417
root@server:~#
我们需要更多的随机性,因此:
root@server:~# apt-get install rng-tools
... ok!
但启动时:
root@server:~# service rng-tools start
Starting Hardware RNG entropy gatherer daemon: (failed).
root@server:~#
配置是默认的:
root@server:~# egrep -v '^$|^#' /etc/default/rng-tools
root@server:~#
用手尝试:
root@server:~# /usr/sbin/rngd
can't open /dev/hwrng: No such device
root@server:~#
11:29 是我们安装 rng-tools 的时候:
root@server:~# ls -lah /dev/hwrng
crw------- 1 root root 10, 183 jan 6 11:29 /dev/hwrng
root@server:~#
尝试 strace:
root@server:# strace /usr/sbin/rngd 2>&1 | grep hwrng
open("/dev/hwrng", O_RDONLY|O_LARGEFILE) = -1 ENODEV (No such device)
write(2, "can't open /dev/hwrng: No such d"..., 37can't open /dev/hwrng: No such device) = 37
root@server:#
问题:如何让“/dev/hwrng”与 rngd 一起工作?还是我们的硬件有问题?还是缺少一些 BIOS 设置?如何在不停机的情况下解决/检查它?
答案1
apt-get install haveged
和:
user@server:~$ cat /proc/sys/kernel/random/entropy_avail
2417
user@server:~$