PGP: Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy
LinuxRandomGnupgEntropyLinux Problem Overview
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
Linux Solutions
Solution 1 - Linux
Run the following:
find / > /dev/null
That helped me quickly to complete my key generation.
Solution 2 - Linux
Try installing haveged
, this is a daemon, which helps the system with generating random numbers for your key.
sudo aptitude install haveged
Solution 3 - Linux
Step 1 Run on a shell first and let it run ls / -R
Step 2 Now try to generate the key it will be done
for more info follow http://alsdias.blogspot.jp/2012/11/gpg-not-enough-random-bytes-available.html
Solution 4 - Linux
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
Solution 5 - Linux
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.
Solution 6 - Linux
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.
Solution 7 - Linux
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 :)
Solution 8 - Linux
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
Solution 9 - Linux
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.
Solution 10 - Linux
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"
Solution 11 - Linux
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.
Solution 12 - Linux
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:)
Solution 13 - Linux
sudo apt-get install rng-tools to set it up.
Then run sudo rngd -r /dev/urandom
before generating the keys.
Solution 14 - Linux
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.
Solution 15 - Linux
Just use another random maker under Ubuntu:
mv /dev/random /dev/chaos && ln -s /dev/urandom /dev/random
and retry your gpg command