NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Callesoroe
Oct 30, 2013Aspirant
Haveged on ReadyNas Ultra ?
I am running LMS (squeezebox) on my readynas ultra. There is a problem with the Random mix. The problem is that it isn't very random.
The problem could be this that I have read about:
http://www.issihosts.com/haveged/
Is it possible to get Haveged to run on a ReadyNas. And if. How ?
If this really is a problem in the kernel software. Will this not be fixed ????
The problem could be this that I have read about:
http://www.issihosts.com/haveged/
Is it possible to get Haveged to run on a ReadyNas. And if. How ?
If this really is a problem in the kernel software. Will this not be fixed ????
23 Replies
Replies have been turned off for this discussion
- RichieB1AspirantThis is Slimdevices bug id 8310: http://bugs.slimdevices.com/show_bug.cgi?id=8310
With LMS 7.6.x I went trough the code and it used a default MySQL random feature, which (I'm sure) uses /dev/random or /dev/urandom. LMS 7.7.x and 7.8.x use SQLite, and I haven't checked how the random playlists are created.
Using /dev/urandom instead of /dev/random does not give you more randomness. If not enough random bits are available /dev/urandom will reuse the random bits to generate more pseudo random bits. This will likely cause repeats like the ones we were seeing with LMS. See http://en.wikipedia.org/wiki//dev/random
I have been running haveged on my QNAP TS-459 Pro+ for a week now, and it positively solves this issue. - CallesoroeAspirantAnother question.
When haveged is installed. Does it "survive" a new firmware upgrade, so that I won't have to install it again?? - fastfwdVirtuoso
RichieB wrote: Using /dev/urandom instead of /dev/random does not give you more randomness.
Thank you, RichieB. I shouldn't post at 4:00 in the morning.
I think that what I wanted (and failed) to say was that I would expect LMS to seed its own (long period) PRNG from dev/random or dev/urandom just once, but that instead it looks as though it is using dev/urandom directly, or maybe re-seeding its PRNG repeatedly with the same value from /dev/random.RichieB wrote: With LMS 7.6.x I went trough the code and it used a default MySQL random feature, which (I'm sure) uses /dev/random or /dev/urandom. LMS 7.7.x and 7.8.x use SQLite, and I haven't checked how the random playlists are created.
....
I have been running haveged on my QNAP TS-459 Pro+ for a week now, and it positively solves this issue.
If 7.7 and 7.8 use sqlite's built-in random() function to select a random sequence of rows, I don't see how increasing the available entropy would fix the problem. As far as I know, the random() function returns the output of a PRNG based on RC4 which is seeded only once from /dev/urandom.
But I'm no expert on any of this. I guess the important thing is that it works, not why it works. - RichieB1AspirantI took another look at the code (current 7.8 nightly). In Slim/Plugin/RandomPlay/Plugin.pm on line 571 this funtion is called:
Slim::Utils::OSDetect->getOS()->sqlHelperClass()->randomFunction()
In Slim/Utils/SQLiteHelper.pm on line 229 this funtion is defined as 'RANDOM()'.
So it indeed (still) uses the internal SQL random function. A quick look at the sqlite 3.8.1 source code indeed mentions a PRNG implementation in the comments. Very strange. - RichieB1AspirantOk, got it. winRandomness() in sqlite3.c is a PRNG, but unixRandomness() uses /dev/urandom every time. This makes sense to me.. why use your own PRNG when the OS provides one that potentially is a lot better.
- chirpaLuminaryfastfwd, nice job on the add-on; viewtopic.php?p=411166#p411166
- fastfwdVirtuosoThanks, Chirpa.
The addon, for OS4 x86 devices only, is available at https://www.dropbox.com/s/m3mob6firvpw24o/HAVEGED_1.7b-x86-1.0.bin. No warranty of fitness for any purpose, etc., etc., but it's installed on my Pro 6 and Ultra 2 Plus and it seems to be running fine. - F_L_TutorIs this needed on OS6 6.1.5?
Running cat on entropy_avail I´m getting pretty high values compared to what I had on OS4 before.
# cat /proc/sys/kernel/random/entropy_avail
2005
# cat /proc/sys/kernel/random/entropy_avail
2560 - fastfwdVirtuoso
F.L. wrote: Is this needed on OS6 6.1.5?
I don't have an OS6 box, so I can't tell. (And, of course, the addon I built for OS4 won't work on OS6 anyway; if you wanted to install haveged, you'd have to do so manually or by building an OS6 addon.)F.L. wrote: Running cat on entropy_avail I´m getting pretty high values compared to what I had on OS4 before.
# cat /proc/sys/kernel/random/entropy_avail
2005
# cat /proc/sys/kernel/random/entropy_avail
2560
Let this run for a minute or two and see whether the entropy_avail value stays up in that high range:watch -n 1 cat /proc/sys/kernel/random/entropy_avail
or run this and see whether the stream of random hex values scrolls continuously up the screen:hexdump /dev/random
If the number displayed by the first test falls to a low number and stays down in a low range, or if the stream in the second test pauses for a second or more after every line, your machine's entropy pool is easily depleted and might benefit from the installation of haveged. - StephenBGuru - Experienced User
My RN102 reports values between 100-200 - similar to what fastfwd saw before he did the add-on.F.L. wrote: Is this needed on OS6 6.1.5?
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!