Lunar Mushrooms
Lunar Mushrooms

Reputation: 8958

/dev/random is not working

I tried to cat the /dev/random. But is just blocks without giving a single byte of output. (Meanwhile the cat of /dev/urandom is working fine).

root@test 07:22:08 ~ >cat /proc/sys/kernel/random/entropy_avail
36
root@test 07:22:10 ~ >cat /dev/random

What could be the possible cause of this ? How to resolve it ?

I am using an embedded system with 2.6 kernel.

Upvotes: 0

Views: 3192

Answers (2)

harmv
harmv

Reputation: 1922

use /dev/urandom, its secure

ref: http://www.2uo.de/myths-about-urandom/

When in doubt in early boot, wether you have enough entropy gathered. use getrandom() instead. [1]

[1] git kernel commit

Upvotes: 0

Brian Agnew
Brian Agnew

Reputation: 272377

From Wikipedia:

When the entropy pool is empty, reads from /dev/random will block until additional environmental noise is gathered.

The entropy pool is populated from environmental noise sources such as keyboards. Consequently, if you don't have this source (e.g. in your embedded system or perhaps a headless server) then the entropy pool is empty, and (as noted above) /dev/random will block.

Upvotes: 1

Related Questions