Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

SO I've got a ton of processes running in the background to try and get enough entropy but I am still failing.

**We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 210 more bytes)**

I need a method to gen the key that works, cause what I'm trying to do is fail apparently.


share|improve this question

3 Answers 3

up vote 18 down vote accepted

Have you had a look at RNG?

Fedora/Rh/Centos types: sudo yum install rng-tools

On deb types: sudo apt-get install rng-tools to set it up.

Then run sudo rngd -r /dev/urandom before generating the keys.

Reference: http://it.toolbox.com/blogs/lim/how-to-generate-enough-entropy-for-gpg-key-generation-process-on-fedora-linux-38022

share|improve this answer
yea thanks so much! –  Joey BagODonuts Dec 20 '10 at 22:40
"Hey, was your nickname at the restaurant 'Joey Bagodonuts'?" "No. That was a different guy. That guy was awesome!" –  Jason Swett Jan 17 '11 at 17:40
Also, on a more serious note, you can use sudo apt-get install rng-tools if you're on Ubuntu instead of sudo yum install rng-utils like they have for Fedora, since no rng-utils package exists for Ubuntu. –  Jason Swett Jan 17 '11 at 17:50
I tried this as root and got "can't open /dev/random: Permission denied" any thoughts on that? –  Darren Newton Mar 12 '11 at 21:40
The package is named rng-tools on both Fedora and EL6, so I suspect a typo in the linked article. BTW, it is a good idea to provide the essential parts of the answer here, and the link for reference, in case the link goes dead in the future. –  Michael Hampton Dec 31 '12 at 2:40

I was able to generate the key by

apt-get install rng-tools

In another SSH window open

 gpg --gen--key

Go back to your first SSH session and run

sudo rngd -r /dev/urandom

Let this run till gpg generates your keys!

share|improve this answer
I would definitely recommend against ever using /dev/urandom for generating keys of any importance. –  Andrew Barber Dec 21 '10 at 7:09

To check the amount of bytes of entropy currently available, use

cat /proc/sys/kernel/random/entropy_avail

The entropy bucket is 4096 bytes large, which can very quickly be depleted.

Using this small 'readspeed' tool (http://1wt.eu/tools/readspeed/), you can measure how fast the entropy bucket is filled with different methods.

For example, launch :

`$ ./readspeed < /dev/random

and move your mouse around. You will see that 'readspeed' empties the entropy bucket as soon as it is filled, and when you move the mouse, it fills up a bit.

Trying different methods, it seems that keyboard input and mouse movements are the most efficients to replenish that bucket. Network transfers and hard drive copies don't have much influence.

Also be careful when you use urandom. urandom empties the entropy bucket and continues to generate low-quality entropy bits when the entropy bucket is empty. urandom is used when you want entropy but you don't want your application to block when the bucket is empty.

Finally, there are entropy generation devices available, such as this one: http://www.entropykey.co.uk/.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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