GPG error "Not enough random bytes available. Please do some other work to give the OS a chance to collect more"
UbuntuGnupgUbuntu Problem Overview
I am using:
gpg --gen-key
Is there a better way to create a PGP key? What does this program want? A fully slammed server?
> Not enough random bytes available. Please do some other work to give the OS a chance to collect more
Ubuntu Solutions
Solution 1 - Ubuntu
Depending on your system hardware, you might have more reliable success using a bridge between the hardware TRNG (True random number generator) and the kernel entropy pool.
I have found a remarkable speed increase by using rng-tools in the universe repository, which can be installed with Synaptic or another GUI package manager, or via the command-line:
sudo apt-get install rng-tools
Solution 2 - Ubuntu
Executing the following command in the background works for me:
sudo find / -type f | xargs grep somerandomstring > /dev/null
Solution 3 - Ubuntu
You can move your mouse around, browse the internet, play a game, leave your computer on overnight. There are many many ways to generate random bytes. You don't need to babysit the gpg process.
EDIT: I should clarify: you don't need to pay attention or even type into the terminal that gpg is running in. (And it's a really bad idea to type into that terminal anyway.)
If you're on a remote server, and cannot otherwise generate work, you can try this: http://packages.debian.org/squeeze/stress. Use caution, though.
Solution 4 - Ubuntu
I found that just moving the program to the background worked even over an ssh interface:
- move the task to the background (Ctrl+z)
- perform a few short tasks (
cd ~ && ./my-time-waster.sh
) - move the task to the foreground (
fg
) - wait a minute or two
I'm using CentOS5 and CentOS6.
Solution 5 - Ubuntu
Try using rngd
, but without the -r /dev/random
you will often see people advise (which will lead to insecure GPG keys). On my machine, just installing rngd
installs a daemon which fills up my entropy quickly, and securely.