Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to generate a GPG key, and I cannot generate enough entropy. So I installed rng-tools and tried following these instructions:

When I am logged in as root, and try to run rngd -r /dev/urandom I get the following error: can't open /dev/random: Permission denied

I find this disturbing as I am root.

This is Ubuntu on a virtual server (via Parallels I believe.)

share|improve this question
Feeding /dev/random from /dev/urandom is really not a good idea. /dev/urandom is derived from the same entropy pool as /dev/random, so you are not generating any additional entropy using this method. rngd is designed for feeding /dev/random from a trusted, hardware source. /dev/urandom is neither a trusted nor hardware source of new entropy. – ændrük Mar 12 '11 at 22:54
That aside, I don't get any error message when running sudo rngd -r /dev/urandom, so I agree that there is some kind of permissions or device issue here. – ændrük Mar 13 '11 at 0:05

/dev/random or /dev/urandom? The error is the former but the command is the latter, and rngd source suggests they should be the same.

In any case, /dev/random is the correct one; /dev/urandom doesn't have a kernel interface for adding entropy, which is why the open fails (not even root can force the kernel to allow writes to a non-writable device, although arguably it should produce a more appropriate error like EINVAL or maybe EPERM). The kernel will feed /dev/urandom from /dev/random automatically.

share|improve this answer
I tried rngd -r /dev/random and got the same error. – Darren Newton Mar 12 '11 at 22:10
In that case I'd check that it's the right device node and its permissions (ls -l /dev/random) and then check /var/log/messages to see if the random driver is complaining. – geekosaur Mar 12 '11 at 22:18
The error message is not inconsistent. -r specifies the hardware entropy source and -o specifies the sink. When undefined, -o defaults to /dev/random. – ændrük Mar 12 '11 at 22:47
/var/log/messages is empty. – Darren Newton Mar 13 '11 at 14:55

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.