I'm trying to generate a GPG key on Ubuntu 16.10 and GPG is taking forever.
I googled a bit and found some websites, including some questions on StackExchange, suggesting to run an entropy generator like rngd
to help the system generate random numbers faster.
Some of these websites also encouraged to check /proc/sys/kernel/random/entropy_avail
, stating that, on their systems, it reported four-digit numbers before running GPG, and two to one-digit numbers while it was running.
I'm currently running GPG on my computer; it's been running for at least half an hour, and I'm getting this
$ cat /proc/sys/kernel/random/entropy_avail
3644
The number increases over time, and decreases very seldom by small amounts (after writing this sentence it's at 3801). I'm not running any random number generator. Actually, if I try to run one (e.g. sudo rngd -fr /dev/random
, it drops to around 50; if I use /dev/urandom
it stays around 3000).
Can anybody help me figure out what the hell is wrong with my system?
I'm on Linux 4.8.0-37-generic, gpg (GnuPG) 2.1.15, libgcrypt 1.7.2-beta.
Best Answer
I had a similar problem recently after upgrading to Debian 9. Some of the programs that depend on random numbers have had their source code/random generator routines changed in recent Linux versions that make them more dependent on the entropy of the system.
Installing the daemon
haveged
seems to provide a consistent pool of random numbers. So do it:The
haveged
daemon is now required by disparate programs requiring entropy, especially in VMs and iOTs (e.g. raspberry, others) where the entropy is normally low.From
man haveged
: