问题描述
在尝试生成GPG密钥(使用gpg --gen-key)时,它可能会在发出消息后挂起:
While attempting to generate GPG keys (using gpg --gen-key), it may hang after emitting the message:
没有足够的随机字节.请做一些其他的工作操作系统有机会收集更多信息! (还需要278个字节)
Not enough random bytes available. Please do some other work to givethe OS a chance to collect more entropy! (Need 278 more bytes)
gpg(GnuPG)1.4.16
gpg (GnuPG) 1.4.16
Ubuntu 14.04.2 LTS
Ubuntu 14.04.2 LTS
推荐答案
尽管rng-tools可以使用,但不建议这样做,因为它不提供真实的熵.请参阅此处的讨论: https://bugs.launchpad.net/ubuntu /+ source/gnupg/+ bug/706011
Although rng-tools will work, this is not suggested since it doesn't provide real entropy. See the discussion here: https://bugs.launchpad.net/ubuntu/+source/gnupg/+bug/706011
对于那些对此感到沮丧的用户,以下是我发现在没有鼠标/台式机的服务器上有用的一些东西.
For users that are frustrated by this, here are some things I found helpful on a server with no mouse/desktop.
1)完成创建GPG密钥的过程.如果挂起以等待更多的熵,请转到下一步.
1) Go through the process of creating the GPG key. If it hangs waiting for more entropy, go to the next step.
2)您可以通过打开一个终端并键入(这将每秒查看该文件)来观察系统有多少熵:
2) You can watch how much entropy your system has by opening a terminal and type (this will look at that file every second):
watch -n1 cat /proc/sys/kernel/random/entropy_avail
3)打开第三个终端以生成您的熵.您可以尝试各种尝试来增强熵.这是我注意到增加熵足以使gpg起作用的一些方法.请注意,这有点随机(无双关语).有时做一些事情会增加熵.但是当我再次这样做时,它不会:
3) Open a third terminal to generate your entropy. You can try various things to try to boost that entropy. Here are some things that I noticed increased the entropy sufficiently to make gpg work. Note that this was somewhat random (no pun intended). Sometimes doing something would increase the entropy; but when I do it again, it does not:
从互联网上获取大文件
wget http://us1.php.net/get/php-7.2.2.tar.bz2/from/this/mirror
执行一些可以在终端上打印很多内容的操作:
Do something that prints a lot of stuff to the terminal:
ls -R /
sudo find /folder/with/lots/of/files/ -type f | xargs grep 'simple string that shows up in lots of files'
4)如果您执行的操作没有增加entropy_avail,请尝试其他操作.
4) If what you are doing does not increase the entropy_avail, then try something else.
这篇关于GPG依赖于熵生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!