OpenSSL unable to write 'random state'

$ openssl genrsa -des3 -out adamyoung.net.key 1024
Generating RSA private key, 1024 bit long modulus
.........................++++++
.................................................................++++++
unable to write 'random state'
e is 65537 (0x10001)
Enter pass phrase for adamyoung.net.key:
aborted!
4553:error:0906906F:PEM routines:PEM_ASN1_write_bio:read key:pem_lib.c:331:

The Fix:
There's a .rnd file that OpenSSL needs to write to. You should change the ownership to the proper user and group. Typically it's in the $HOME directory:

sudo chown adam.adam ~/.rnd

If this doesn't work, check $RANDFILE or generate the key with -rand

Comments

WHO ARE YOU? ARE YOU WHO WE THINK YOU ARE? CAN WE TRUST YOU, "ADAM"? IS THAT YOUR REAL NAME? HUH? PUNK!

Thanks Adam, I tested this on Ubuntu server 8.04 and it works. I no longer get the message unable to write 'randow state'
after signing the certificate and adding to db.

u would not believe u r eyes
if ten million fireflies
lit up the world as i fell asleep
case they would fill the open air
and leave teardrops everywher u think me rude but
I would just stand and stare

hi!

Thank you very much for your help, i could find what was happening...

I executed the command with sudo and it worked.

wow this worked quick thanks a bunch !

was having this trouble on ubuntu 9.10

Guys, an alternative to accomplish this task without change the ownership of the .rnd file, is execute the openssl command with SUDO.

Bye

he's a great boy...I iove him..