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

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


Run the following:

find / > /dev/null

That helped me quickly to complete my key generation.


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

sudo aptitude install haveged


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


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


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.