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

别等时光非礼了梦想. 提交于 2019-12-03 18:38:04

问题


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

when I am trying to generate a asymmetric key pair via GPG like this gpg --gen-key . I get the following error :

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.

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

and it still persists to give me the same error


回答1:


Run the following:

find / > /dev/null

That helped me quickly to complete my key generation.




回答2:


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

sudo aptitude install haveged




回答3:


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

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




回答4:


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.

Watch out for 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.




回答5:


Move your mouse around for 30s or so in a new tab, and then try the following:

base64 /dev/urandom

This will start printing out random code to the screen. In a few mins, sufficient amount of psuedo-random data would have been generated to complete key generation.




回答6:


This is what is the solution I found to it

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

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

This fortunately for me worked at the end :)




回答7:


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

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




回答8:


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.




回答9:


I try to solve. I use Fedora 25 with gpg1 and gpg2 have installed as standar for mechine.

Declare about problem.
If you use Fedora 25 OS, i see gpg confict wiht ownertrust (please remove old trustdb.gpg) at otrust.tmp. and must create new trustdb.gpg.

Please follow this command at your terminal command. (not have to root mode). You may try to re-create the trustdb using the commands:

cd ~/.gnupg

gpg2 --export-ownertrust > otrust.tmp
rm trustdb.gpg
gpg2 --import-ownertrust < otrust.tmp

then you can use

gpg --list-secret-keys --keyid-format LONG
then export as asci format.
gpg --armor --export "type-here-your-secKEY"




回答10:


at the end of gpg message u see parentheses like (125 byte remaining)

the gpg needs some random bytes that u must enter.so press Ctrl-z and type a random set of x(number in parentheses) characters not necessarily meaningful like: dfkheuhasdkjvdaiugekjfhflsdfhuhggskdfjhsjdf

then do it 2 or 3 times, GPG shows an answer that tells u it's done key generating:)




回答11:


You can install daemons to gather entropy. This command would install two such daemons:

sudo apt-get install haveged rng-tools

I would personally perfer haveged (because of the people who have created it) over rng-tools. But, I prefer to install both since they quite different.




回答12:


Running $ sudo rngd -r /dev/urandom

Then running $ gpg --user-agent

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

then $ sudo kill 9999

worked for me on my Ubuntu 13.04 system.




回答13:


Just use another random maker under Ubuntu:

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

and retry your gpg command



来源:https://stackoverflow.com/questions/11708334/pgp-not-enough-random-bytes-available-please-do-some-other-work-to-give-the-os

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!