<html><head></head><body><div class="ydp45089d2byahoo-style-wrap" style="font-family:verdana, helvetica, sans-serif;font-size:16px;"><div>I have discovered the source of the problem, thought why it should be the case, I have no idea ...</div><div><br></div><div>I edited OneRNG.sh to put in a whole lot of echo statements ...</div><div>For the sake of completeness, I've copied it here.</div><div><br></div><div><span>#!/bin/sh -x <br>#<br># Version 3.6<br># UDEV doesn't allow us to start daemon's directly<br># so we queue some thing to start the daemon a few secs<br># after<br>#<br>touch "/home/mrd/Desktop/AAA-OneRNG.txt"<br>chmod 666 "/home/mrd/Desktop/AAA-OneRNG.txt"<br>if [ "$1" = "daemon" ]; then<br> echo Line 10 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> if [ ! -c /dev/$2 ] <br> then<br> echo Line 13 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> exit 1<br> fi<br> echo Line 15 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> ONERNG_URANDOM_RESEED="0"<br> echo Line 18 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> if [ -x /etc/onerng.conf ] <br> then<br> echo Line 21 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> . /etc/onerng.conf<br> else<br> echo Line 24 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> ONERNG_START_RNGD="1"<br> ONERNG_MODE_COMMAND="cmd0"<br> ONERNG_VERIFY_FIRMWARE="1"<br> ONERNG_AES_WHITEN="1"<br> echo Line 29 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> fi<br> <br> #<br> # a user can override this default entropy value<br> # in /etc/onerng.conf<br> #<br> if [ -z "$ONERNG_ENTROPY" ] <br> then<br> echo Line 38 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> ONERNG_ENTROPY=".93750" # our default entropy value from onerng<br> echo Line 40 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> fi<br><br> echo Line 43 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> umask 0177<br> echo Line 45 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> # wait for udev to finish<br><br> sleep 1 <br> echo Line 49 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> stty -F /dev/$2 raw -echo clocal -crtscts<br> echo Line 51 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> # make a temp file<br> t=`mktemp`<br> echo $$ >/var/lock/LCK..$2<br> echo Line 55 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> trap "rm -f -- '$t' '/var/lock/LCK..$2'" EXIT<br> echo Line 57 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br><br><br> i=0<br> while [ $i -lt 200 ] # loop waiting for things to come up<br> do<br> truncate --size=0 "$t"<br> # off, produce nothing, flush<br> echo "cmd0" >/dev/$2 # standard noise<br> echo "cmdO" >/dev/$2 # turn it on<br> echo Line 67 : $i >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> dd if=/dev/$2 iflag=fullblock of=$t bs=1 &<br> pid=$!<br> stty -F /dev/$2 raw -echo clocal -crtscts<br> sleep 0.05<br><br> echo "cmdo" >/dev/$2 # turn it off<br> echo "cmd4" >/dev/$2 # turn off noise gathering<br> echo "cmdw" >/dev/$2 # flush entropy pool<br> kill $pid<br> if [ -s $t ] # if we got some data exit the loop<br> then <br> break<br> fi<br> i=`expr $i + 1`<br> done<br><br> echo Line 84 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> if [ "$ONERNG_VERIFY_FIRMWARE" = "1" ]<br> then<br> sleep 0.1<br> # read data into temp file<br> truncate --size=0 "$t"<br> dd if=/dev/$2 iflag=fullblock of=$t bs=4 &<br> pid=$!<br> sleep 0.02<br><br> echo "cmdO" >/dev/$2 # start it<br> echo "cmdX" >/dev/$2 # extract image<br> # wait a while, should be done, kill it<br> sleep 3.5<br> kill $pid<br><br> echo "cmdo" >/dev/$2 # turn it off<br> echo "cmdw" >/dev/$2 # flush entropy pool<br><br> # process the data, verify its signature, log any errors<br> python /sbin/onerng_verify.py $t <br><br> # res 1 err, 0 OK<br> res=$?<br><br> # clean up temp file<br> rm -f -- "$t"<br> rm /var/lock/LCK..$2<br> trap - EXIT<br><br> # if we failed quit - it's a bad or compromised board<br> if [ "$res" = "1" ]<br> then<br> echo Line 117 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> exit 1<br> fi<br> else<br> echo Line 121 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> # clean up temp file<br> rm -f -- "$t"<br> rm /var/lock/LCK..$2<br> trap - EXIT<br> fi<br> if [ "$ONERNG_START_RNGD" = "1" ]<br> then<br> # waste some entropy<br> nohup dd if=/dev/$2 of=/dev/null bs=10k count=1 >/dev/null&<br><br> # start the device<br> echo "$ONERNG_MODE_COMMAND" >/dev/$2<br> echo "cmdO" >/dev/$2<br> sleep .5<br><br> # after dd is done start rngd<br> PATH=/sbin:/usr/sbin:$PATH<br> export PATH<br><br> #<br> # there are multiple versions of RNGD in the field with incompatible flags<br> #<br> # -n 1 -d 1 turn OFF default rngs if present <br> #<br> # --rng-entropy allows us to qualify the quality of our entropy source<br> #<br> RNGD_FLAGS=""<br> v=`rngd --help| grep no-tpm | wc -l `<br> if [ "$v" != "0" ]<br> then<br> RNGD_FLAGS="$RNGD_FLAGS -n 1"<br> fi<br> v=`rngd --help| grep no-drng | wc -l `<br> if [ "$v" != "0" ]<br> then<br> RNGD_FLAGS="$RNGD_FLAGS -d 1"<br> fi<br> v=`rngd --help| grep rng-entropy | wc -l`<br> if [ "$v" != "0" ]<br> then<br> # set the entropy to 7.5 bits/byte<br> RNGD_FLAGS="$RNGD_FLAGS --rng-entropy=$ONERNG_ENTROPY"<br> fi<br><br> #<br> # if the system has a default RNG running shut it down<br> #<br> v=`systemctl list-units 2>/dev/null | grep rng-tools | grep running | wc -l`<br> if [ "$v" = "1" ]<br> then<br> systemctl stop rng-tools<br> fi<br><br> #<br> # RNGD seems to do its random testing in a way that doesn't always tolerate<br> # randomness in the way that failures occur (in random strings false negatives happen - ie ranmdom<br> # data that looks like it might not be random occur in the real world), the tests RNGD does work<br> # on relatively small blocks so it finds them - failure rates of 1 in 1000 are acceptable,<br> # rngd gets worried if a bunch of these happen close to each other in time and shuts down, of<br> # course when these blocks occur in time is random too and eventually if we're running lots<br> # of data through rngd we seem to trigger this<br> #<br> # If ONERNG_AES_WHITEN is enabled (the default) we use openssl AES to 'whiten' the input stream<br> # by encrypting it with a random key obtained from the OneRNG<br> #<br> if [ "$ONERNG_AES_WHITEN" = "1" ]<br> then<br> nohup openssl enc -aes128 -nosalt -in /dev/$2 -pass file:/dev/$2 -out /dev/stdout 2>/dev/null | rngd -f $RNGD_FLAGS -r /dev/stdin >/dev/null 2>/dev/null &<br> echo $! > /var/lock/LCK..$2<br> else<br> rngd $RNGD_FLAGS -p /var/lock/LCK..$2 -r /dev/$2 <br> fi<br> <br> #<br> # if the urandom_min_reseed_secs parameter exists then allow<br> # us to override it - it's there to stop /dev/urandom from sucking<br> # up all the system entropy, but with onerng we have lots, so usually<br> # we set this to "0" which allows /dev/urandom to suck as much entropy<br> # as it wants (many systems have this set to 60 [secs])<br> #<br> if [ -e /proc/sys/kernel/random/urandom_min_reseed_secs ]<br> then<br> if [ -n "$ONERNG_URANDOM_RESEED" ]<br> then<br> echo "$ONERNG_URANDOM_RESEED" >/proc/sys/kernel/random/urandom_min_reseed_secs<br> fi<br> fi<br> else<br> echo "cmdo" >/dev/$2<br> fi<br> echo Line 212 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> exit 0<br>fi<br><br>#<br># when something is removed kill the daemon<br>#<br>if [ "$1" = "kill" ]; then<br> if [ -e /var/lock/LCK..$2 ]<br> then<br> kill -9 `cat /var/lock/LCK..$2`<br> else<br> if [ -z "$DEVPATH" ] <br> then<br> echo "Missing DEVPATH variable, are you running from udev?"<br> echo Line 227 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> exit 1<br> fi <br><br> #<br> # some systems have a broken udev, udevd remove<br> # is seldom used and obviously not well tested<br> # %k in the udev rules doesn't give the same<br> # name you were given when the add occured<br> # the solution is to see if the current dev name <br> # matches one of the /sys/class/tty/ttyACM* files<br> # if so use that name's lock file to kill rngd<br> #<br> t1="`echo $DEVPATH | grep ttyACM | wc -l`"<br> if [ "$v" = "1" ]<br> then<br> t1="$DEVPATH"<br> else<br> t1="`ls -lt /sys/class/tty/ttyACM* | grep $DEVPATH`"<br> fi<br> t2=`basename "$t1"`<br> if [ -e /var/lock/LCK..$t2 ]<br> then<br> kill -9 `cat /var/lock/LCK..$t2`<br> rm /var/lock/LCK..$t2<br> fi<br> fi<br><br> #<br> # if there's a default rng-tools we can restart it<br> #<br> v=`which systemctl | grep "not found" | wc -l`<br> if [ $v != "1" ]<br> then<br> v=`systemctl list-units | grep rng-tools | grep running | wc -l`<br> if [ $v = "0" ]<br> then<br> systemctl start rng-tools >/dev/null 2>&1<br> fi<br> fi<br> echo Line 267 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> exit 0<br>fi<br>#<br># normal case - start the daemon using at<br>#<br>if [ ! -c /dev/$1 ] <br>then<br> echo Line 275 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br> exit 1<br>fi<br>echo "/sbin/onerng.sh daemon $1" | at -M NOW<br> echo Line 279 >> "/home/mrd/Desktop/AAA-OneRNG.txt"<br></span><div><span>exit 0<br></span></div><div><br></div><div><div>And now, when I plug OneRNG into the socket and check AAA-OneRNG.txt, I find:</div><div><span>Line 275<br>Line 279<br>Line 10<br>Line 15<br>Line 18<br>Line 21<br>Line 43<br>Line 45<br>Line 49<br>Line 51<br>Line 55<br>Line 57<br>Line 67 : 0<br>Line 84<br>Line 117<br><br></span><div>... with Line 117 being at the point where the pre-existing comment says "<span># if we failed quit - it's a bad or compromised board". Why that should be the case, I have no idea. But it sounds like a death knell.</span></div><div><span><br></span></div><div><span>Cheers,</span></div><div><span>Mark<br></span></div></div><div><br></div><span></span></div></div><div><br></div>
</div><div id="ydp4a041ffbyahoo_quoted_1237172185" class="ydp4a041ffbyahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Friday, 22 February 2019, 22:15:20 GMT+11, Paul Campbell <paul@taniwha.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="ydp4a041ffbyiv3937737239"><div>
<span id="ydp4a041ffbyiv3937737239gs-content-email-layout-preheader" style="background-color: rgb(255, 255, 255); background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; color: rgb(255, 255, 255); display: none; font-size: 1px;">
</span>
<div id="ydp4a041ffbyiv3937737239gs-content-email-layout-prebody" style="padding:0 10px 0 10px;">
</div>
<table id="ydp4a041ffbyiv3937737239gs-content-email-layout" style="background-color: transparent; border-color: currentcolor; border-style: none; border-width: medium; border-collapse: collapse; border-spacing: 0px; margin: 0px; max-width: 100%; padding: 0px;" class="yahoo-compose-table-card" width="100%" height="100%" cellspacing="0" cellpadding="0" border="1" align="center"><tbody><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239toparea" style="background-color: rgb(85, 102, 119); background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; border-bottom: 6px solid rgb(166, 179, 191); min-height: 24px; margin: 0px; padding: 0px; position: relative;" width="100%" valign="middle" height="24" align="center">
<center>
<table class="ydp4a041ffbyiv3937737239fluid-table yahoo-compose-table-card" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;" width="100%" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239titlebar" style="margin:0;padding:0;position:relative;text-align:left;" valign="top" align="left">
<table style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;" class="yahoo-compose-table-card" width="100%" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td colspan="1" rowspan="1" style="margin:0;padding:0;">
<a shape="rect" id="ydp4a041ffbyiv3937737239titlebar-home-link" href="http://lists.onerng.info" style="border-color: currentcolor; border-style: none; border-width: medium; color: rgb(85, 102, 119); display: block; line-height: 20px; max-width: 600px; text-decoration: none; white-space: nowrap;" rel="nofollow" target="_blank"><span class="ydp4a041ffbyiv3937737239logo" style="display:none;"> </span>
<span class="ydp4a041ffbyiv3937737239site" style="color:#fff;">OneRNG</span></a>
</td></tr></tbody></table>
</td></tr></tbody></table>
</center>
</td></tr><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239gs-content-email-layout-body" style="border-collapse:separate;margin:0 0 0 0;padding:0 0 0 0;table-layout:fixed;" width="100%" valign="top" align="center">
<center>
<table class="ydp4a041ffbyiv3937737239fluid-table yahoo-compose-table-card" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;padding:0 0 0 0;" width="100%" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td colspan="1" rowspan="1" style="margin:0;padding:0;" valign="top">
<table id="ydp4a041ffbyiv3937737239gs-content-email-layout-fluid-body" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;padding:0 0 0 0;" class="yahoo-compose-table-card" width="100%" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239bodyblock" style="background-color: rgb(255, 255, 252); background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; margin: 0px; padding: 20px 10px; position: relative; text-align: left;" bgcolor="#FFFFFF" align="left">
<div id="ydp4a041ffbyiv3937737239gs-group-list-email-html">
<table id="ydp4a041ffbyiv3937737239gs-group-list-email-html-prologue" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;padding:0 0 0 0;" class="yahoo-compose-table-card" width="100%" cellspacing="0" cellpadding="0" border="1" align="center"><tbody><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239gs-group-list-email-html-prologue-photo" style="margin:0;padding:0;" width="60" valign="top" height="60">
<a shape="rect" href="http://lists.onerng.info/p/5ocdmZI6xkCc6oi98HNzUu" title="Photo of Paul Campbell" style="color:#567;text-decoration:none;" rel="nofollow" target="_blank">
<img src="http://lists.onerng.info/p/5ocdmZI6xkCc6oi98HNzUu/gs-profile-image-square/60" alt="Photo of Paul Campbell" style="border-color: currentcolor; border-style: none; border-width: 0px; height: auto; max-width: 100%; vertical-align: middle; width: auto;" valign="middle" data-inlineimagemanipulating="true" class="" width="auto" height="auto" border="0"></a>
</td><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239gs-group-list-email-html-prologue-metadata" style="margin:0;padding:0;" valign="top">
<table style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;padding:0 0 0 0;" class="yahoo-compose-table-card" border="1"><tbody><tr><td colspan="1" rowspan="1" style="margin:0;padding:0 0 0 10px;">
<a shape="rect" href="http://lists.onerng.info/r/topic/4dMXSjSYq2saNPCSNtzRoy" style="color:#567;text-decoration:none;" rel="nofollow" target="_blank"><b>OneRNG not working after reinstalling onerng_3.6-1_all.deb</b></a>
</td></tr><tr><td colspan="1" rowspan="1" style="margin:0;padding:0 0 0 10px;">
<span class="ydp4a041ffbyiv3937737239muted" style="color:#8c8d8d;">by </span>
<a shape="rect" href="http://lists.onerng.info/p/5ocdmZI6xkCc6oi98HNzUu" style="color:#567;text-decoration:none;" rel="nofollow" target="_blank"><b>Paul Campbell</b>
</a>
</td></tr><tr><td colspan="1" rowspan="1" style="margin:0;padding:0 0 0 10px;">
<span class="ydp4a041ffbyiv3937737239muted" style="color:#8c8d8d;">in </span>
<a shape="rect" class="ydp4a041ffbyiv3937737239group" href="http://lists.onerng.info/groups/onerng-talk" style="color:#567;text-decoration:none;" rel="nofollow" target="_blank">
<b>OneRNG Talk</b></a>
</td></tr></tbody></table>
</td></tr></tbody></table>
<div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd59285"></div><table id="ydp4a041ffbyiv3937737239gs-group-list-email-html-body" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;padding:0 0 0 0;" class="yahoo-compose-table-card" width="100%" cellspacing="0" cellpadding="0" border="1" align="left"><tbody><tr><td colspan="1" rowspan="1" style="margin:0;padding:0;"><hr style="border-color: currentcolor currentcolor rgb(238, 238, 238); border-style: none none solid; border-width: 3px 0px 1px; margin: 0px; padding: 9px 0px 0px;"></td></tr><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239gs-group-list-email-html-body-main" style="margin:0;padding:10px 0 0 0;" align="left">
<span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">On Friday, 22 February 2019 2:05:21 PM NZDT <a shape="rect" class="ydp4a041ffbyiv3937737239email" href="mailto:mark.diamond@yahoo.co.uk" style="color:#567;text-decoration:underline;" rel="nofollow" target="_blank">mark.diamond@yahoo.co.uk</a> wrote:</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> One of the difficulties in trying to figure out what might be wrong is that</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> I can't find a clear description of the logic of what is being installed</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> and what it does. I know I've received a very generous response to my</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> query, but it is very piecemeal and leaves me mostly in the dark. I'm an</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> experienced programmer but I'm not a kernel device writer or anything like</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> that. When I read the replies I've received about dmesg, udev, etc. I'm</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> reminded of just how difficult it is for an expert in something to remember</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> what it is like to be ignorant.</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">></span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> What I've managed to <b>*guess*</b> (without really having a clue whether this is</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> correct) from the responses is ...When OneRNG is plugged into a USB port,</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> the OS needs to recognize the kind of device it is. It does that by having</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> a set of rules (in the case of OneRNG, rules in a file called</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> 79-onerng.rules ). The rules need to be in a general system folder that is</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> usually called 'udev'.When the device is recognized by the OS, the rules</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> say that a shell script 'onerng.sh' should be run to initiate a daemon that</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> collects entropy from the device.When the device is removed, the rules also</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> describe how the daemon is to be terminated. Am I even vaguely on the right</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> track?</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line ydp4a041ffbyiv3937737239muted" style="color: rgb(140, 141, 141); display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">> Cheers,Mark</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">so here's how it works: the UDEV system (in the kernel) recognises events</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">from devices (like device insertion) and send them to the UDEV daemon (these</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">days it's become part of systemd) the UDEV daemon finds an appropriate file (in</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">this case 79-onerng.rules) and uses it to execute scripts it passing in</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">parameters describing what's happening (it's not quite this simple various</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">UDEV daemons are buggy in different ways, debian's systemd one is actually</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">better in most respects than what it replaced).</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">From this point on it's onerng code in particular /etc/onerng.sh ....</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">essentially this code has to get around the main limitation placed on scripts</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">started by the UDEV daemon - that they can't create their own daemons that</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">persist (and that's exactly what we want to do - start an instance of rngd) -</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">so the problem is that we want to write code that works on as many different</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">linux systems as we can, ones with different init systems (this was coded pre</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">systemd) - so what we do in /etc/onerng.sh is we use the lowest common</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">denominator, we don't try and code in every init system on the planet, that</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">would be a maintenance nightmare, instead we use the 'at' command to schedule</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">another run of /etc/onerng.sh using "at now /etc/onerng.sh" so /etc/onerng.sh</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">is run again with either a parameter "daemon" to mean start a daemon, or</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">"remove" (when a device is removed) to stop the daemon</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">(the recent Ubuntu problems are because they mistakenly started running UDEVD</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">before the root filesystem was writeable - the at command couldn't access its</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">database, and our scripts couldn't create system lock files in /var/lock)</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">Starting a daemon essentially involves:</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">- checking the firmware integrity (there's a python script that does the heavy</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">lifting here)</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">- changing the OneRNG mode to the correct mode</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">- starting rngd (there are different versions of rngd out there so we have to</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">be a bit smart about how we do this)</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">you'll see a bunch of dd commands in there, they're either to read the firmware</span><br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">image or to flush buffers as we change modes</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;">Hopefully that's enough detail to understand the command flow</span><br clear="none">
<br clear="none"><span class="ydp4a041ffbyiv3937737239line" style="display: inline-block; max-width: 580px; white-space: pre-wrap; width: 100%;"> Paul</span><br clear="none">
</td></tr></tbody></table>
<table id="ydp4a041ffbyiv3937737239gs-group-list-email-html-links" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:0 0 0 0;max-width:100%;padding:0 0 0 0;" class="yahoo-compose-table-card" width="100%" cellspacing="0" cellpadding="0" border="1" align="center"><tbody><tr><td colspan="1" rowspan="1" style="margin:0;padding:20px 0 0 0;"><hr style="border-color: currentcolor currentcolor rgb(238, 238, 238); border-style: none none solid; border-width: 3px 0px 1px; margin: 0px; padding: 9px 0px 0px;"></td></tr><tr id="ydp4a041ffbyiv3937737239gs-group-list-email-html-links-view"><td colspan="1" rowspan="1" style="margin:0;padding:20px 0 0 0;">
<a shape="rect" class="ydp4a041ffbyiv3937737239btn" id="ydp4a041ffbyiv3937737239gs-group-list-email-html-links-view-reply" href="mailto:onerng-talk@lists.onerng.info?subject=Re%3A%20OneRNG%20not%20working%20after%20reinstalling%20onerng_3.6-1_all.deb" title="Reply to this email" style="background-color: rgb(85, 102, 119); background-image: none; background-repeat: repeat-x; border-color: rgb(85, 102, 119) rgb(85, 102, 119) rgb(179, 179, 179); border-style: solid; border-width: 1px; border-radius: 4px; color: rgb(255, 255, 255); cursor: pointer; display: inline-block; font-size: 16px; line-height: 20px; margin-bottom: 0px; padding: 4px 12px; text-align: center; text-decoration: none; text-shadow: none; vertical-align: middle;" rel="nofollow" target="_blank">⮪ Reply</a>
<a shape="rect" class="ydp4a041ffbyiv3937737239btn" id="ydp4a041ffbyiv3937737239gs-group-list-email-html-links-view-new" href="mailto:onerng-talk@lists.onerng.info" title="Start a new topic by email" style="background-color: rgb(85, 102, 119); background-image: none; background-repeat: repeat-x; border-color: rgb(85, 102, 119) rgb(85, 102, 119) rgb(179, 179, 179); border-style: solid; border-width: 1px; border-radius: 4px; color: rgb(255, 255, 255); cursor: pointer; display: inline-block; font-size: 16px; line-height: 20px; margin-bottom: 0px; padding: 4px 12px; text-align: center; text-decoration: none; text-shadow: none; vertical-align: middle;" rel="nofollow" target="_blank">🖂 New topic</a>
<a shape="rect" class="ydp4a041ffbyiv3937737239btn" id="ydp4a041ffbyiv3937737239gs-group-list-email-html-links-view-topic" href="http://lists.onerng.info/r/topic/4dMXSjSYq2saNPCSNtzRoy" title="View this post within the topic on the web" style="background-color: rgb(85, 102, 119); background-image: none; background-repeat: repeat-x; border-color: rgb(85, 102, 119) rgb(85, 102, 119) rgb(179, 179, 179); border-style: solid; border-width: 1px; border-radius: 4px; color: rgb(255, 255, 255); cursor: pointer; display: inline-block; font-size: 16px; line-height: 20px; margin-bottom: 0px; padding: 4px 12px; text-align: center; text-decoration: none; text-shadow: none; vertical-align: middle;" rel="nofollow" target="_blank">View topic…</a>
</td></tr><tr id="ydp4a041ffbyiv3937737239gs-group-list-email-html-links-settings"><td colspan="1" rowspan="1" style="margin:0;padding:20px 0 0 0;">
<a shape="rect" href="mailto:onerng-talk@lists.onerng.info?subject=Unsubscribe&body=Hello%2C%0A%0APlease%20remove%20me%20from%20OneRNG%20Talk%0A%3Chttp%3A//lists.onerng.info/groups/onerng-talk%3E%0A%0AThank%20you." style="color:#567;text-decoration:none;" rel="nofollow" target="_blank">Unsubscribe</a>
<span class="ydp4a041ffbyiv3937737239muted" style="color:#8c8d8d;"> • </span>
<a shape="rect" href="mailto:onerng-talk@lists.onerng.info?subject=Digest%20on&body=Hello%2C%0A%0APlease%20switch%20me%20from%20receiving%20one%20email%20per%20post%20to%20the%20daily%0Adigest%2C%20which%20summarises%20the%20all%20the%20posts%20made%20each%20day%20in%0AOneRNG%20Talk%0A%3Chttp%3A//lists.onerng.info/groups/onerng-talk%3E%0A%0AThank%20you." style="color:#567;text-decoration:none;" rel="nofollow" target="_blank">Switch to a daily digest</a>
</td></tr></tbody></table>
</div>
</td></tr></tbody></table>
</td></tr></tbody></table>
</center>
</td></tr><tr id="ydp4a041ffbyiv3937737239gs-content-layout-footer" style="background-color: rgb(237, 240, 242); background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; border-top: 6px solid rgb(204, 204, 204); clear: both; color: rgb(85, 102, 119); min-height: 24px; margin: 0px; padding: 0px; position: relative;" height="24"><td colspan="1" rowspan="1" style="margin:0;padding:0;" width="100%" valign="top" align="center">
<center>
<table class="ydp4a041ffbyiv3937737239fluid-table yahoo-compose-table-card" style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:10px 0 10px 0;max-width:100%;" width="100%" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td colspan="1" rowspan="1" id="ydp4a041ffbyiv3937737239gs-content-layout-footer-content" style="margin:0 0 0 0;padding:0 0 0 10px;position:relative;text-align:left;" valign="top" align="left">
<table style="background-color:transparent;border-collapse:collapse;border-spacing:0;margin:10px 0 10px 0;max-width:100%;" class="yahoo-compose-table-card" width="100%" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td colspan="1" rowspan="1" style="margin:0;padding:0;">
<ul class="ydp4a041ffbyiv3937737239dotted-inline-list" style="margin:0;margin-left:0;padding:0;"><li style="display:inline-block;line-height:20px;list-style:none;vertical-align:top;">
<a shape="rect" href="http://lists.onerng.info/policies/privacy/" style="color:inherit;text-decoration:underline;" rel="nofollow" target="_blank">Privacy</a>
</li><li style="display:inline-block;line-height:20px;list-style:none;vertical-align:top;">
<a shape="rect" href="http://lists.onerng.info/policies/aup/" style="color:inherit;text-decoration:underline;" rel="nofollow" target="_blank">Acceptable Use</a>
</li><li style="display:inline-block;line-height:20px;list-style:none;vertical-align:top;">
<a shape="rect" href="http://lists.onerng.info/policies/tos/" style="color:inherit;text-decoration:underline;" rel="nofollow" target="_blank">Terms of Service</a><div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd36533">
</div></li></ul><div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd91505">
</div></td></tr></tbody></table><div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd21224">
</div></td></tr></tbody></table><div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd64778">
</div></center><div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd07883">
</div></td></tr></tbody></table><div class="ydp4a041ffbyiv3937737239yqt7407046519" id="ydp4a041ffbyiv3937737239yqtfd17384">
</div></div></div></div>
</div>
</div></body></html>