RNGD service consuming high CPU usage after pointing /dev/random to behave as urandom

Asked by Sachin Aryal

I have executed these commands while installing my application on Ubuntu system.

The following commands are specific for /dev/random to behave as urandom

sudo rm /dev/random
sudo mknod /dev/random c 1 9 # make /dev/random behave as urandom. 1 and 9 are device numbers of urandom
adding above changes to rc.local to make system changes persistent after reboot

sed -i -e "/^exit 0/ i\sudo rm /dev/random" -e "/^exit 0/ i\sudo mknod /dev/random c 1 9" /etc/rc.local
After executing these command I restarted the rng-tools

sudo systemctl restart rng-tools
And suddenly after restarting rng-tools , top command shows 100% CPU usage by rngd service.

My System Information:

VERSION="16.04.1 LTS (Xenial Xerus)"
PRETTY_NAME="Ubuntu 16.04.1 LTS"

and when I restore /dev/random to its normal behavior and restart the rng-tools and the CPU usage changes to normal.

Question information

English Edit question
Ubuntu rng-tools Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Neil Horman (nhorman) said :

In short, don't do that.

rngd actually writes to /dev/random, it doesn't read from it (because rngd adds entropy to the kernel, it doesn't draw entropy out). When you modify /dev/random to point to the /dev/urandom chardev major and minor, the kernel will return an error on write (because /dev/urandoms driver isn't writeable, causing rngd to just spin attempting to add entropy again and again to the kernel.

What goal are you actually attempting to accomplish by making this change? Perhaps we can find a better way for you to get there

Can you help with this problem?

Provide an answer of your own, or ask Sachin Aryal for more information if necessary.

To post a message you must log in.