Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

rngd(8) does not accept /var/run/rtl_entropy.fifo #8

Open
atoponce opened this issue Jul 19, 2014 · 10 comments
Open

rngd(8) does not accept /var/run/rtl_entropy.fifo #8

atoponce opened this issue Jul 19, 2014 · 10 comments

Comments

@atoponce
Copy link
Contributor

Following the instructions on site:

# rtl_entropy -b
# rngd -r /var/run/rtl_entropy.fifo -W 95%
# ps -ef | grep rngd
root      5597  3281  0 12:04 pts/3    00:00:00 grep rng

It seems that rngd(8) is not accepting named pipe as a valid hardware RNG. As such, as it stands, I cannot feed the data into the kernel entropy pool for processing to /dev/random.

@ganzuul
Copy link

ganzuul commented Sep 14, 2014

I seem to have this same issue. echo $? returns '1'.

@pwarren
Copy link
Owner

pwarren commented Dec 19, 2014

Can't replicate on my debian box.

Can you please get me the relevant bits of /var/log/daemon.log or where ever it is your system sends the rngd logs?

Heres the output I get from running the above, then doing a few runs of:
dd if=/dev/random of=/dev/null count=1024

Dec 19 21:46:22 hollis rtl-entropy[31451]: Options parsed, continuing.
Dec 19 21:46:22 hollis rtl-entropy[31451]: Waiting for a Reader...
Dec 19 21:46:30 hollis rtl-entropy[31451]: Found 1 device(s):
Dec 19 21:46:30 hollis rtl-entropy[31451]:   0:  GTek T803
Dec 19 21:46:30 hollis rtl-entropy[31451]: Using device 0: GTek T803
Dec 19 21:46:30 hollis rtl-entropy[31451]: Setting Frequency to 70000000
Dec 19 21:46:30 hollis rtl-entropy[31451]: Your device is capable of gains at...
Dec 19 21:46:30 hollis rtl-entropy[31451]:  : -9.90
Dec 19 21:46:30 hollis rtl-entropy[31451]:  : -4.00
Dec 19 21:46:30 hollis rtl-entropy[31451]:  : 7.10
Dec 19 21:46:30 hollis rtl-entropy[31451]:  : 17.90
Dec 19 21:46:30 hollis rtl-entropy[31451]:  : 19.20
Dec 19 21:46:30 hollis rtl-entropy[31451]: Setting gain to 19.20
Dec 19 21:46:30 hollis rtl-entropy[31451]: Doing FIPS init
Dec 19 21:46:30 hollis rtl-entropy[31451]: Reading samples in sync mode...
Dec 19 21:46:31 hollis rngd[31459]: rngd 2-unofficial-mt.14 starting up...
Dec 19 21:46:31 hollis rngd[31459]: entropy feed to the kernel ready
Dec 19 21:46:52 hollis rngd[31459]: block failed FIPS test: 0x04
Dec 19 21:47:03 hollis rngd[31459]: block failed FIPS test: 0x04
Dec 19 21:47:05 hollis rngd[31459]: block failed FIPS test: 0x08

@atoponce
Copy link
Contributor Author

After looking closer at it, it appears that I needed to blacklist the "dvb_usb_rtl28xxu" module for it to work. Also, this is the first I have come back to it since I reported this bug, so something may have also changed in Debian between then and now. But, it seems to be working now, so I'll close the issue.

@atoponce
Copy link
Contributor Author

So, interestingly enough, I have moved this to another machine. While it works great on my laptop, I cannot get rngd(8) to use the /var/run/rtl_entropy.fifo named pipe. Watching the data come into /var/run/rtl_entropy.fifo, it appears that it's bursting. IE- a burst of data comes in, then hangs, then a smaller burst, then hangs, then an even smaller burst, then hangs. Until eventually, it just hangs with no progress. I'm watching it with "xxd /var/run/rtl_entropy.fifo" These pauses might be what the issue was when I opened this bug, and what the problem is that I'm seeing now on my other computer.

Do you know what could be creating these bursts, and how to stop them?

$ ps -ef | grep rt[l]  
root     11434     1 17 11:01 ?        00:00:15 rtl_entropy -b
$ sudo rngd -r /var/run/rtl_entropy.fifo -f
rngd 2-unofficial-mt.14 starting up...
entropy feed to the kernel ready
entropy source exhausted!
stats: bits received from HRNG source: 1760000
stats: bits sent to kernel pool: 1740000
stats: entropy added to kernel pool: 1740000
stats: FIPS 140-2 successes: 87
stats: FIPS 140-2 failures: 0
stats: FIPS 140-2(2001-10-10) Monobit: 0
stats: FIPS 140-2(2001-10-10) Poker: 0
stats: FIPS 140-2(2001-10-10) Runs: 0
stats: FIPS 140-2(2001-10-10) Long run: 0
stats: FIPS 140-2(2001-10-10) Continuous run: 0
stats: HRNG source speed: (min=28.070; avg=502.418; max=19531250.000)Kibits/s
stats: FIPS tests speed: (min=79.805; avg=140.104; max=149.012)Mibits/s
stats: Lowest ready-buffers level: 0
stats: Entropy starvations: 87
stats: Time spent starving for entropy: (min=21; avg=39282.279; max=695754)us
Exiting...

Should I reopen the issue, or is the fix for this already known?

@pwarren
Copy link
Owner

pwarren commented Dec 23, 2014

Okay, I've replicated this issue, first run of RNGD seems to work fine, then further runs get bursts from the named pipe exiting after a little bit.

Appear to be getting rather round numbers of entropy read by rngd, around 2220000 bits, so it's probably some sort of output oddness in rtl-entropy :)

@pwarren pwarren reopened this Dec 23, 2014
@yhaenggi
Copy link

it dosnt matter if its rngd or something else. if something is reading from the FIFO, then closes the handle and then open it again and try to read, it will break after a few kb sent trough the FIFO

@W-M-D
Copy link
Contributor

W-M-D commented Mar 27, 2016

What the issue actually is it opens however if the entropy pool is stressed or has not had enough time to generate data rngd will pull from the fifo until there is no data left and then kill itself because there is no data left.

@W-M-D
Copy link
Contributor

W-M-D commented Mar 27, 2016

I have tried with the -T flag with no effect.

@mmilleror
Copy link

I think I've been having the same issue on CentOS 7. The pool goes down to a really low number from a really high number.

@W-M-D
Copy link
Contributor

W-M-D commented Mar 27, 2016

So far what i have found is if you start rtl_entropy and then wait a few seconds ( i put 10 in my daemon ) before starting rngd the fifo has enough data in in that it will not dry up under normal operation. However , if the entropy pool is stressed rngd will run out of data and crash. The only workaround i see is incorporating the rngd code directly into rtl_entropy and adding the data directly to the random pool.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants