1827587 Members
2745 Online
109965 Solutions
New Discussion

rng failure

 
SOLVED
Go to solution
Joe Long
Occasional Contributor

rng failure

the strong random number generator is not working on one of our HP-UX 11i servers following a reboot. Attempts to get random numbers from/dev/urandom fails. For example, if I do "cat /dev/urandom" instead of a string of random characters I get the error message "Cat: Cannon open /dev/urandom: Invalid argument" I have unloaded and reloaded the rng module to no effect.

This is the output from kmadmin -Q rng:

Module Name rng
Module ID 2
Module Path /stand/dlkm/mod.d/rng
Status LOADED
Size 57344
Base Address 0x178e000
BSS Size 0
BSS Base Address 0x0
Hold Count 1
Dependent Count 0
Unload Delay 0 seconds
Description rng - random number generator for the /dev/[u]random interface
Type WSIO
Block Major -1
Character Major 95
Flags b5

Any suggestions?
6 REPLIES 6
Navin Bhat_2
Trusted Contributor

Re: rng failure

Are there any errors reported in the swagent.log file? Also are you getting the same error with /dev/random?
Navin Bhat_2
Trusted Contributor

Re: rng failure

Also try to tusc the cat aommand maybe we can see something useful there.
Joe Long
Occasional Contributor

Re: rng failure

I get a somewhat different error with /dev/random:

jlong@bp-prod: /home/jlong # cat /dev/random > random.txt
cat: read error: No such file or directory

However, the directory is there:

jlong@bp-prod: /home/jlong # ll /dev/random
cr--r--r-- 1 bin bin 79 0x000000 Aug 27 2003 /dev/random

But I believe your suggestion of checking the swagent.log provided the answer. The depot I installed at the time of the reboot recreated the rng module. I have another maintenance window coming up, and I'll remove and reinstall the KRMG11i depot and see if that corrects the problem. Thanks.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: rng failure

I see what is wrong. You kmadmin -Q rng reports a Character Major device number of 95 but your /dev/urandom and /dev/random have a major device number of 79.

rm /dev/random
rm /dev/urandom

mknod /dev/random c 95 0x00
mknod /dev/random c 95 0x01

You can also simply cd to /sbin/init.d and
./krng stop
./krng start

By the way, these devices do not produce random strings but rather random binary data so you might want to do something like this:

dd if=/dev/random bs=4 count=1 | od -c
If it ain't broke, I can fix that.
Joe Long
Occasional Contributor

Re: rng failure

That did it ... thank you.
A. Clay Stephenson
Acclaimed Contributor

Re: rng failure

Ooops,

I just noticed that
mknod /dev/random c 95 0x01

should be:
mknod /dev/urandom c 95 0x01

but you probably spotted that. The other mknod was correct.
If it ain't broke, I can fix that.