Linux PGP:没有足够的随机字节可用。请做一些其他的工作,让操作系统有机会收集更多的熵

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11708334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 13:57:29  来源:igfitidea点击:

PGP: Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy

linuxrandomgnupgentropy

提问by user1524529

Setup : Ubuntu Server on Virtual Machine with 6 cores and 3GB of RAM.

设置:虚拟机上的 Ubuntu 服务器,具有 6 个内核和 3GB 内存。

when I am trying to generate a asymmetric key pairvia GPGlike this gpg --gen-key. I get the following error :

当我试图生成asymmetric key pair通过GPG这样的gpg --gen-key。我收到以下错误:

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy!

I tried to google a little bit. This is what I realise , I need to fire up another terminal and type in cat /udev/random--> It randomly generates a series of randomly generated values to increase the entropy.

我试着用谷歌搜索一下。这就是我意识到的,我需要启动另一个终端并输入cat /udev/random--> 它随机生成一系列随机生成的值以增加熵。

I dont see any change in here watch cat /proc/sys/kernel/random/entropy_avail

我没有看到这里有任何变化 watch cat /proc/sys/kernel/random/entropy_avail

and it still persists to give me the same error

它仍然给我同样的错误

回答by user1524529

This is what is the solution I found to it

这是我找到的解决方案

I had to do gpg --gen-key --no-use-agent

我必须做 gpg --gen-key --no-use-agent

after that in an another terminal I fired up cat /dev/random

之后在另一个终端我启动了 cat /dev/random

This fortunately for me worked at the end :)

幸运的是,这对我来说最终起作用了:)

回答by Mr Ed

Running $ sudo rngd -r /dev/urandom

跑步 $ sudo rngd -r /dev/urandom

Then running $ gpg --user-agent

然后运行 $ gpg --user-agent

and $ ps -ef | egrep rngd(shows process number of rngd, e.g. 9999)

$ ps -ef | egrep rngd(显示 rngd 的进程号,例如 9999)

then $ sudo kill 9999

然后 $ sudo kill 9999

worked for me on my Ubuntu 13.04 system.

在我的 Ubuntu 13.04 系统上为我工作。

回答by zdenekca

Run the following:

运行以下命令:

find / > /dev/null

That helped me quickly to complete my key generation.

这帮助我快速完成了我的密钥生成。

回答by mieciu

Try installing haveged, this is a daemon, which helps the system with generating random numbers for your key.

尝试安装haveged,这是一个守护进程,可帮助系统为您的密钥生成随机数。

sudo aptitude install haveged

sudo aptitude install haveged

回答by Triangle

Step 1 Run on a shell first and let it run ls / -R

步骤 1 首先在 shell 上运行并让它运行 ls / -R

Step 2 Now try to generate the key it will be done

第 2 步现在尝试生成将要完成的密钥

for more info follow http://alsdias.blogspot.jp/2012/11/gpg-not-enough-random-bytes-available.html

有关更多信息,请关注 http://alsdias.blogspot.jp/2012/11/gpg-not-enough-random-bytes-available.html

回答by bluesway

Just use another random maker under Ubuntu:

只需在 Ubuntu 下使用另一个随机制造商:

mv /dev/random /dev/chaos && ln -s /dev/urandom /dev/random

and retry your gpg command

并重试您的 gpg 命令

回答by Chris Jefferson

Trying installing rngd. If your CPU if reasonably modern it will have a hardware random number generator built in, and rngd will use this to generate enough entropy.

尝试安装 rngd。如果您的 CPU 相当现代,它将内置一个硬件随机数生成器,并且 rngd 将使用它来生成足够的熵。

Watch outfor people telling you to run rngd -r /dev/urandom. While this will get rid of your error, it does it by faking entropy and leads to insecure keys.

当心人们告诉你跑步rngd -r /dev/urandom。虽然这将消除您的错误,但它是通过伪造熵并导致不安全的密钥来实现的。

回答by Dan

I did apt-get install libreoffice and apt-get remove libreoffice* a couple times. That did the trick. Pick some other big fat program for yourself to use.

我做了几次 apt-get install libreoffice 和 apt-get remove libreoffice* 。这就是诀窍。选择一些其他的大胖程序供自己使用。

回答by Kaweesi Joseph

try running (in another terminal tab) $cat /proc/sys/kernel/random/entropy_availon command line, it it returns less than 100-200, then something is wrong, install rng-tools $sudo apt-get install rng-tools

尝试$cat /proc/sys/kernel/random/entropy_avail在命令行上运行(在另一个终端选项卡中) ,它返回小于 100-200,然后出现问题,安装 rng-tools $sudo apt-get install rng-tools

That should have fixed this issue, check the previous tab and you have the key

这应该已经解决了这个问题,检查上一个选项卡,你有钥匙

回答by Thomas Lobker

I've tried different tricks while watching the /proc/sys/kernel/random/entropy_availvalue. But trying to make an MD5 hash of an entire disk really gave my system entropy on steroidswithout installing extra packages.

我在观察/proc/sys/kernel/random/entropy_avail价值时尝试了不同的技巧。但是尝试制作整个磁盘的 MD5 哈希确实给了我的系统熵,而无需安装额外的软件包。

find /dev/disk/by-uuid/ -type l | xargs md5sum

find /dev/disk/by-uuid/ -type l | xargs md5sum