Generate Entropy for GnuPG

GnuPG Logo

Has anyone every tried to generate a GPG (or GnuPG) key? I have… and I received this error…

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

I was remotely logged into the machine (over SSH) so couldn't physically move the mouse or press keys to generate random entropy. The solution turned out to be simply running the following command in a second SSH Shell.

ls -R /

As soon as I ran that, the gpg command in the other window instantly finished creating my 2048 bit key.

Comment Icon

8 Comments

The most recent comment was on Fri, 9th Mar 2012 - 14:47

You made my day! Thanks kindly for the great tip

Thanks for the tip! I got my key finished almost instantly too!

Fantastic :)
Simple and effective. Thanks!

Doesn't work -.-
Before(Need 284 more bytes)
After (Need 280 more bytes)

Likely your filesystem is too small to generate enough entropy out of reading only the directory contents and metadata (which is all ls -R / will do) and you kernel may have most of the contents already cached. When I need to generate entropy on a remote VM guest, I typically will do something like:

find /var/ /usr /lib /srv -type f -print0 | xargs -0 cat > /dev/null

as the actual data contents of the filesystem will typically be larger than what the system is able to cache in memory, thus generating enough disk activity and entropy for whatever it is that I'm trying to accomplish.

We had the same issue of the filesystem being too small alsp..

Running md5sum /dev/sda & in the background a few times worked a charm!

- Jamie

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <img> <p>
  • You can use BBCode tags in the text. URLs will automatically be converted to links.
  • You can enable syntax highlighting of source code with the following tags: <code>, <pre>, <bash>, <css>, <html>, <js>, <jquery>, <mysql>, <php>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.