in gpg --key-gen

following error occured.

Not enough random bytes available. 
Please do some other work to give the OS a chance to collect more 
(Need 300 more bytes)

What's wrong?


/dev/random's entropy pool is depleted.

"do something" to generate disk activity, network traffic, etc... and the entropy will build.

"man random" for more info.

"cat /proc/sys/kernel/random/entropy_avail" to see how you're doing, then try the gpg process again.

  • As an example of what to do I started with 257 in entropy_avail I then did touch blah rm blah about 10 times now I have entropy_avail, so most any disk access should do. – Unkwntech Aug 6 '09 at 3:06
  • In case someone else encounters it: starting programs (ASLR? No idea) seems to consume some entropy (about 100). To watch the entropy pool, write a C program that reads the contents of the file and periodically writes it back (don't forget to lseek(fd, 0, SEEK_SET). – Lekensteyn Jan 28 '13 at 23:16

The Linux kernel maintains a "pool" of random bytes that may be accessed via ioctl calls or via the special /dev/random and /dev/urandom files.

The timing of interrupts handled by the kernel is one of a several sources of randomness that feeds into the pool. Examples are the timing of keyboard and mouse input, the timing of hard drive read/write activity, and the timing of interrupts raised to handle incoming network packets.

All of these sources can be more active when a user is actively interacting with the system. Thus the encouragement to do more "work" in order to trickle more random bytes into the pool for gpg to consume.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.