rng-tools allows /dev/random depletion

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm trying to understand what is going on with rng-tools and systemd on a Beaglebone Black dev-board that's leading to entropy depletion in /dev/random. I have about 8 dev-boards in a similar configuration and only the Beaglebone has the problem.



The Beaglebone runs a Debian derivative and has a hardware rng. The OMAP rng sustains reads from /dev/hwrand. However, after draining /dev/random the device never recovers. For example, it takes 646 seconds to read 10 bytes from /dev/random.



When I look at systemd I don't see a service enabled for the rng:



$ systemctl list-unit-files | grep -i -E 'rng|rand'
rng-tools.service generated
systemd-random-seed.service static
urandom.service static


I try to enable it, and no error is returned:



# systemctl enable rng-tools.service
rng-tools.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable rng-tools


But the service fails to enable:



$ systemctl list-unit-files | grep -i -E 'rng|rand'
rng-tools.service generated
systemd-random-seed.service static
urandom.service static


And:



$ systemctl status rng-tools
● rng-tools.service
Loaded: loaded (/etc/init.d/rng-tools; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-10-14 02:36:05 EDT; 17h ago
Docs: man:systemd-sysv-generator(8)


There is a script in rng-tools called /etc/init.d/rng-tools that looks like a service file, but it is not a systemd service file. I don't see where it is enabled or where it feeds /dev/random. Debian may have a related bug report at Issue 776597, rng-tools: No systemd .service file. I don't believe the 776597 script is the same script shown below.



How do I fix this issue or troubleshoot it further?




Here are a couple of similar Q&A's. I have not been able to scrape useful information out of them. Part of the issue is the complexity systemd has introduced. I'm not quite following what is supposed to happen, and the finer points of the objects below /etc/systemd/system like multi-user.target.wants.



  • Generated systemd unit does not start on boot

  • Can start custom systemd service, can't enable it

  • Unable to enable systemctl service


The rng-tools package:



$ apt-file list rng-tools
rng-tools: /etc/default/rng-tools
rng-tools: /etc/init.d/rng-tools
rng-tools: /etc/logcheck/ignore.d.server/rng-tools
rng-tools: /etc/logcheck/violations.ignore.d/rng-tools
rng-tools: /usr/bin/rngtest
rng-tools: /usr/sbin/rngd
rng-tools: /usr/share/doc/rng-tools/README.gz
rng-tools: /usr/share/doc/rng-tools/TODO.Debian
rng-tools: /usr/share/doc/rng-tools/changelog.Debian.gz
rng-tools: /usr/share/doc/rng-tools/changelog.gz
rng-tools: /usr/share/doc/rng-tools/copyright
rng-tools: /usr/share/lintian/overrides/rng-tools
rng-tools: /usr/share/man/man1/rngtest.1.gz
rng-tools: /usr/share/man/man8/rngd.8.gz


The script /etc/init.d/rng-tools.



$ cat /etc/init.d/rng-tools
#! /bin/sh
#
# rng-tools initscript for the rng-tools package
# Copr. 2003 by Henrique de Moraes Holschuh <hmh@debian.org>
# Copr. 2002 by Viral Shah <viral@debian.org>
#
### BEGIN INIT INFO
# Provides: rng-tools
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
#
#
# $Id: rng-tools.init,v 1.6.2.10 2008-06-10 19:51:37 hmh Exp $

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/rngd
NAME=rngd
DESC="Hardware RNG entropy gatherer daemon"
PIDFILE=/var/run/rngd.pid

DEVICELIST="hwrng hw_random hwrandom intel_rng i810_rng"

HRNGDEVICE=/dev/hwrng
RNGDOPTIONS=
[ -r /etc/default/rng-tools ] && . /etc/default/rng-tools

test -f $DAEMON || exit 0

set -e

finddevice ()
[ -c "$HRNGDEVICE" ] && return 0
for i in $DEVICELIST ; do
if [ -c "/dev/$i" ] ; then
HRNGDEVICE="/dev/$i"
return 0
fi
if [ -c "/dev/misc/$i" ] ; then
HRNGDEVICE="/dev/misc/$i"
return 0
fi
done

echo "(Hardware RNG device inode not found)"
echo "$0: Cannot find a hardware RNG device to use." >&2
exit 1


START="--start --quiet --pidfile $PIDFILE --startas $DAEMON --name $NAME"
case "$1" in
start)
echo -n "Starting $DESC: "
finddevice
START="$START -- -r $HRNGDEVICE $RNGDOPTIONS"
if start-stop-daemon $START >/dev/null 2>&1 ; then
echo "$NAME."
else
if start-stop-daemon --test $START >/dev/null 2>&1; then
echo "(failed)."
exit 1
else
echo "$DAEMON already running."
exit 0
fi
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --stop --quiet --pidfile $PIDFILE
--startas $DAEMON --retry 10 --name $NAME
>/dev/null 2>&1 ; then
echo "$NAME."
else
if start-stop-daemon --test $START >/dev/null 2>&1; then
echo "(not running)."
exit 0
else
echo "(failed)."
exit 1
fi
fi
;;
restart|force-reload)
$0 stop
exec $0 start
;;
*)
echo "Usage: $0 restart" 1>&2
exit 1
;;
esac

exit 0


Dmesg's related to the rng:



$ dmesg | grep -i -E 'rand|rng'
[ 4.560639] random: systemd-udevd urandom read with 11 bits of entropy available
[ 11.086922] systemd[1]: Starting Load/Save Random Seed...
[ 15.022431] using random self ethernet address
[ 15.022465] using random host ethernet address
[ 15.027177] using random self ethernet address
[ 15.027195] using random host ethernet address
[ 21.308396] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[ 34.690558] random: nonblocking pool is initialized


And systemd dump for rng-tools:



-> Unit rng-tools.service:
Description: rng-tools.service
Instance: n/a
Unit Load State: loaded
Unit Active State: failed
State Change Timestamp: Sun 2018-10-14 02:36:05 EDT
Inactive Exit Timestamp: Sun 2018-10-14 02:36:04 EDT
Active Enter Timestamp: n/a
Active Exit Timestamp: n/a
Inactive Enter Timestamp: Sun 2018-10-14 02:36:05 EDT
GC Check Good: yes
Need Daemon Reload: no
Transient: no
Slice: system.slice
CGroup: n/a
CGroup realized: no
CGroup mask: 0x0
CGroup members mask: 0x0
Name: rng-tools.service
Documentation: man:systemd-sysv-generator(8)
Fragment Path: /run/systemd/generator.late/rng-tools.service
Source Path: /etc/init.d/rng-tools
Condition Timestamp: Sun 2018-10-14 02:36:04 EDT
Condition Result: yes
Assert Timestamp: Sun 2018-10-14 02:36:04 EDT
Assert Result: yes
Requires: system.slice
Requires: sysinit.target
WantedBy: multi-user.target
WantedBy: graphical.target
Conflicts: shutdown.target
Before: shutdown.target
Before: multi-user.target
Before: graphical.target
After: systemd-journald.socket
After: system.slice
After: remote-fs.target
After: sysinit.target
After: systemd-journald-dev-log.socket
After: basic.target
References: remote-fs.target
References: graphical.target
References: sysinit.target
References: system.slice
References: multi-user.target
References: systemd-journald.socket
References: systemd-journald-dev-log.socket
References: basic.target
References: shutdown.target
ReferencedBy: multi-user.target
ReferencedBy: graphical.target
StopWhenUnneeded: no
RefuseManualStart: no
RefuseManualStop: no
DefaultDependencies: yes
OnFailureJobMode: replace
IgnoreOnIsolate: no
Service State: failed
Result: exit-code
Reload Result: success
PermissionsStartOnly: no
RootDirectoryStartOnly: no
RemainAfterExit: yes
GuessMainPID: no
Type: forking
Restart: no
NotifyAccess: none
NotifyState: unknown
KillMode: process
KillSignal: SIGTERM
SendSIGKILL: yes
SendSIGHUP: no
UMask: 0022
WorkingDirectory: /
RootDirectory: /
NonBlocking: no
PrivateTmp: no
PrivateNetwork: no
PrivateDevices: no
ProtectHome: no
ProtectSystem: no
IgnoreSIGPIPE: no
RuntimeDirectoryMode: 0755
LimitNOFILE: 4096
LimitNOFILESoft: 1024
StandardInput: null
StandardOutput: journal
StandardError: inherit
SyslogFacility: daemon
SyslogLevel: info
-> ExecStart:
Command Line: /etc/init.d/rng-tools start
-> ExecStop:
Command Line: /etc/init.d/rng-tools stop








share

























    up vote
    0
    down vote

    favorite












    I'm trying to understand what is going on with rng-tools and systemd on a Beaglebone Black dev-board that's leading to entropy depletion in /dev/random. I have about 8 dev-boards in a similar configuration and only the Beaglebone has the problem.



    The Beaglebone runs a Debian derivative and has a hardware rng. The OMAP rng sustains reads from /dev/hwrand. However, after draining /dev/random the device never recovers. For example, it takes 646 seconds to read 10 bytes from /dev/random.



    When I look at systemd I don't see a service enabled for the rng:



    $ systemctl list-unit-files | grep -i -E 'rng|rand'
    rng-tools.service generated
    systemd-random-seed.service static
    urandom.service static


    I try to enable it, and no error is returned:



    # systemctl enable rng-tools.service
    rng-tools.service is not a native service, redirecting to systemd-sysv-install.
    Executing: /lib/systemd/systemd-sysv-install enable rng-tools


    But the service fails to enable:



    $ systemctl list-unit-files | grep -i -E 'rng|rand'
    rng-tools.service generated
    systemd-random-seed.service static
    urandom.service static


    And:



    $ systemctl status rng-tools
    ● rng-tools.service
    Loaded: loaded (/etc/init.d/rng-tools; generated; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2018-10-14 02:36:05 EDT; 17h ago
    Docs: man:systemd-sysv-generator(8)


    There is a script in rng-tools called /etc/init.d/rng-tools that looks like a service file, but it is not a systemd service file. I don't see where it is enabled or where it feeds /dev/random. Debian may have a related bug report at Issue 776597, rng-tools: No systemd .service file. I don't believe the 776597 script is the same script shown below.



    How do I fix this issue or troubleshoot it further?




    Here are a couple of similar Q&A's. I have not been able to scrape useful information out of them. Part of the issue is the complexity systemd has introduced. I'm not quite following what is supposed to happen, and the finer points of the objects below /etc/systemd/system like multi-user.target.wants.



    • Generated systemd unit does not start on boot

    • Can start custom systemd service, can't enable it

    • Unable to enable systemctl service


    The rng-tools package:



    $ apt-file list rng-tools
    rng-tools: /etc/default/rng-tools
    rng-tools: /etc/init.d/rng-tools
    rng-tools: /etc/logcheck/ignore.d.server/rng-tools
    rng-tools: /etc/logcheck/violations.ignore.d/rng-tools
    rng-tools: /usr/bin/rngtest
    rng-tools: /usr/sbin/rngd
    rng-tools: /usr/share/doc/rng-tools/README.gz
    rng-tools: /usr/share/doc/rng-tools/TODO.Debian
    rng-tools: /usr/share/doc/rng-tools/changelog.Debian.gz
    rng-tools: /usr/share/doc/rng-tools/changelog.gz
    rng-tools: /usr/share/doc/rng-tools/copyright
    rng-tools: /usr/share/lintian/overrides/rng-tools
    rng-tools: /usr/share/man/man1/rngtest.1.gz
    rng-tools: /usr/share/man/man8/rngd.8.gz


    The script /etc/init.d/rng-tools.



    $ cat /etc/init.d/rng-tools
    #! /bin/sh
    #
    # rng-tools initscript for the rng-tools package
    # Copr. 2003 by Henrique de Moraes Holschuh <hmh@debian.org>
    # Copr. 2002 by Viral Shah <viral@debian.org>
    #
    ### BEGIN INIT INFO
    # Provides: rng-tools
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    ### END INIT INFO
    #
    #
    # $Id: rng-tools.init,v 1.6.2.10 2008-06-10 19:51:37 hmh Exp $

    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    DAEMON=/usr/sbin/rngd
    NAME=rngd
    DESC="Hardware RNG entropy gatherer daemon"
    PIDFILE=/var/run/rngd.pid

    DEVICELIST="hwrng hw_random hwrandom intel_rng i810_rng"

    HRNGDEVICE=/dev/hwrng
    RNGDOPTIONS=
    [ -r /etc/default/rng-tools ] && . /etc/default/rng-tools

    test -f $DAEMON || exit 0

    set -e

    finddevice ()
    [ -c "$HRNGDEVICE" ] && return 0
    for i in $DEVICELIST ; do
    if [ -c "/dev/$i" ] ; then
    HRNGDEVICE="/dev/$i"
    return 0
    fi
    if [ -c "/dev/misc/$i" ] ; then
    HRNGDEVICE="/dev/misc/$i"
    return 0
    fi
    done

    echo "(Hardware RNG device inode not found)"
    echo "$0: Cannot find a hardware RNG device to use." >&2
    exit 1


    START="--start --quiet --pidfile $PIDFILE --startas $DAEMON --name $NAME"
    case "$1" in
    start)
    echo -n "Starting $DESC: "
    finddevice
    START="$START -- -r $HRNGDEVICE $RNGDOPTIONS"
    if start-stop-daemon $START >/dev/null 2>&1 ; then
    echo "$NAME."
    else
    if start-stop-daemon --test $START >/dev/null 2>&1; then
    echo "(failed)."
    exit 1
    else
    echo "$DAEMON already running."
    exit 0
    fi
    fi
    ;;
    stop)
    echo -n "Stopping $DESC: "
    if start-stop-daemon --stop --quiet --pidfile $PIDFILE
    --startas $DAEMON --retry 10 --name $NAME
    >/dev/null 2>&1 ; then
    echo "$NAME."
    else
    if start-stop-daemon --test $START >/dev/null 2>&1; then
    echo "(not running)."
    exit 0
    else
    echo "(failed)."
    exit 1
    fi
    fi
    ;;
    restart|force-reload)
    $0 stop
    exec $0 start
    ;;
    *)
    echo "Usage: $0 restart" 1>&2
    exit 1
    ;;
    esac

    exit 0


    Dmesg's related to the rng:



    $ dmesg | grep -i -E 'rand|rng'
    [ 4.560639] random: systemd-udevd urandom read with 11 bits of entropy available
    [ 11.086922] systemd[1]: Starting Load/Save Random Seed...
    [ 15.022431] using random self ethernet address
    [ 15.022465] using random host ethernet address
    [ 15.027177] using random self ethernet address
    [ 15.027195] using random host ethernet address
    [ 21.308396] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
    [ 34.690558] random: nonblocking pool is initialized


    And systemd dump for rng-tools:



    -> Unit rng-tools.service:
    Description: rng-tools.service
    Instance: n/a
    Unit Load State: loaded
    Unit Active State: failed
    State Change Timestamp: Sun 2018-10-14 02:36:05 EDT
    Inactive Exit Timestamp: Sun 2018-10-14 02:36:04 EDT
    Active Enter Timestamp: n/a
    Active Exit Timestamp: n/a
    Inactive Enter Timestamp: Sun 2018-10-14 02:36:05 EDT
    GC Check Good: yes
    Need Daemon Reload: no
    Transient: no
    Slice: system.slice
    CGroup: n/a
    CGroup realized: no
    CGroup mask: 0x0
    CGroup members mask: 0x0
    Name: rng-tools.service
    Documentation: man:systemd-sysv-generator(8)
    Fragment Path: /run/systemd/generator.late/rng-tools.service
    Source Path: /etc/init.d/rng-tools
    Condition Timestamp: Sun 2018-10-14 02:36:04 EDT
    Condition Result: yes
    Assert Timestamp: Sun 2018-10-14 02:36:04 EDT
    Assert Result: yes
    Requires: system.slice
    Requires: sysinit.target
    WantedBy: multi-user.target
    WantedBy: graphical.target
    Conflicts: shutdown.target
    Before: shutdown.target
    Before: multi-user.target
    Before: graphical.target
    After: systemd-journald.socket
    After: system.slice
    After: remote-fs.target
    After: sysinit.target
    After: systemd-journald-dev-log.socket
    After: basic.target
    References: remote-fs.target
    References: graphical.target
    References: sysinit.target
    References: system.slice
    References: multi-user.target
    References: systemd-journald.socket
    References: systemd-journald-dev-log.socket
    References: basic.target
    References: shutdown.target
    ReferencedBy: multi-user.target
    ReferencedBy: graphical.target
    StopWhenUnneeded: no
    RefuseManualStart: no
    RefuseManualStop: no
    DefaultDependencies: yes
    OnFailureJobMode: replace
    IgnoreOnIsolate: no
    Service State: failed
    Result: exit-code
    Reload Result: success
    PermissionsStartOnly: no
    RootDirectoryStartOnly: no
    RemainAfterExit: yes
    GuessMainPID: no
    Type: forking
    Restart: no
    NotifyAccess: none
    NotifyState: unknown
    KillMode: process
    KillSignal: SIGTERM
    SendSIGKILL: yes
    SendSIGHUP: no
    UMask: 0022
    WorkingDirectory: /
    RootDirectory: /
    NonBlocking: no
    PrivateTmp: no
    PrivateNetwork: no
    PrivateDevices: no
    ProtectHome: no
    ProtectSystem: no
    IgnoreSIGPIPE: no
    RuntimeDirectoryMode: 0755
    LimitNOFILE: 4096
    LimitNOFILESoft: 1024
    StandardInput: null
    StandardOutput: journal
    StandardError: inherit
    SyslogFacility: daemon
    SyslogLevel: info
    -> ExecStart:
    Command Line: /etc/init.d/rng-tools start
    -> ExecStop:
    Command Line: /etc/init.d/rng-tools stop








    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to understand what is going on with rng-tools and systemd on a Beaglebone Black dev-board that's leading to entropy depletion in /dev/random. I have about 8 dev-boards in a similar configuration and only the Beaglebone has the problem.



      The Beaglebone runs a Debian derivative and has a hardware rng. The OMAP rng sustains reads from /dev/hwrand. However, after draining /dev/random the device never recovers. For example, it takes 646 seconds to read 10 bytes from /dev/random.



      When I look at systemd I don't see a service enabled for the rng:



      $ systemctl list-unit-files | grep -i -E 'rng|rand'
      rng-tools.service generated
      systemd-random-seed.service static
      urandom.service static


      I try to enable it, and no error is returned:



      # systemctl enable rng-tools.service
      rng-tools.service is not a native service, redirecting to systemd-sysv-install.
      Executing: /lib/systemd/systemd-sysv-install enable rng-tools


      But the service fails to enable:



      $ systemctl list-unit-files | grep -i -E 'rng|rand'
      rng-tools.service generated
      systemd-random-seed.service static
      urandom.service static


      And:



      $ systemctl status rng-tools
      ● rng-tools.service
      Loaded: loaded (/etc/init.d/rng-tools; generated; vendor preset: enabled)
      Active: failed (Result: exit-code) since Sun 2018-10-14 02:36:05 EDT; 17h ago
      Docs: man:systemd-sysv-generator(8)


      There is a script in rng-tools called /etc/init.d/rng-tools that looks like a service file, but it is not a systemd service file. I don't see where it is enabled or where it feeds /dev/random. Debian may have a related bug report at Issue 776597, rng-tools: No systemd .service file. I don't believe the 776597 script is the same script shown below.



      How do I fix this issue or troubleshoot it further?




      Here are a couple of similar Q&A's. I have not been able to scrape useful information out of them. Part of the issue is the complexity systemd has introduced. I'm not quite following what is supposed to happen, and the finer points of the objects below /etc/systemd/system like multi-user.target.wants.



      • Generated systemd unit does not start on boot

      • Can start custom systemd service, can't enable it

      • Unable to enable systemctl service


      The rng-tools package:



      $ apt-file list rng-tools
      rng-tools: /etc/default/rng-tools
      rng-tools: /etc/init.d/rng-tools
      rng-tools: /etc/logcheck/ignore.d.server/rng-tools
      rng-tools: /etc/logcheck/violations.ignore.d/rng-tools
      rng-tools: /usr/bin/rngtest
      rng-tools: /usr/sbin/rngd
      rng-tools: /usr/share/doc/rng-tools/README.gz
      rng-tools: /usr/share/doc/rng-tools/TODO.Debian
      rng-tools: /usr/share/doc/rng-tools/changelog.Debian.gz
      rng-tools: /usr/share/doc/rng-tools/changelog.gz
      rng-tools: /usr/share/doc/rng-tools/copyright
      rng-tools: /usr/share/lintian/overrides/rng-tools
      rng-tools: /usr/share/man/man1/rngtest.1.gz
      rng-tools: /usr/share/man/man8/rngd.8.gz


      The script /etc/init.d/rng-tools.



      $ cat /etc/init.d/rng-tools
      #! /bin/sh
      #
      # rng-tools initscript for the rng-tools package
      # Copr. 2003 by Henrique de Moraes Holschuh <hmh@debian.org>
      # Copr. 2002 by Viral Shah <viral@debian.org>
      #
      ### BEGIN INIT INFO
      # Provides: rng-tools
      # Required-Start: $remote_fs $syslog
      # Required-Stop: $remote_fs $syslog
      # Default-Start: 2 3 4 5
      # Default-Stop: 0 1 6
      ### END INIT INFO
      #
      #
      # $Id: rng-tools.init,v 1.6.2.10 2008-06-10 19:51:37 hmh Exp $

      PATH=/sbin:/bin:/usr/sbin:/usr/bin
      DAEMON=/usr/sbin/rngd
      NAME=rngd
      DESC="Hardware RNG entropy gatherer daemon"
      PIDFILE=/var/run/rngd.pid

      DEVICELIST="hwrng hw_random hwrandom intel_rng i810_rng"

      HRNGDEVICE=/dev/hwrng
      RNGDOPTIONS=
      [ -r /etc/default/rng-tools ] && . /etc/default/rng-tools

      test -f $DAEMON || exit 0

      set -e

      finddevice ()
      [ -c "$HRNGDEVICE" ] && return 0
      for i in $DEVICELIST ; do
      if [ -c "/dev/$i" ] ; then
      HRNGDEVICE="/dev/$i"
      return 0
      fi
      if [ -c "/dev/misc/$i" ] ; then
      HRNGDEVICE="/dev/misc/$i"
      return 0
      fi
      done

      echo "(Hardware RNG device inode not found)"
      echo "$0: Cannot find a hardware RNG device to use." >&2
      exit 1


      START="--start --quiet --pidfile $PIDFILE --startas $DAEMON --name $NAME"
      case "$1" in
      start)
      echo -n "Starting $DESC: "
      finddevice
      START="$START -- -r $HRNGDEVICE $RNGDOPTIONS"
      if start-stop-daemon $START >/dev/null 2>&1 ; then
      echo "$NAME."
      else
      if start-stop-daemon --test $START >/dev/null 2>&1; then
      echo "(failed)."
      exit 1
      else
      echo "$DAEMON already running."
      exit 0
      fi
      fi
      ;;
      stop)
      echo -n "Stopping $DESC: "
      if start-stop-daemon --stop --quiet --pidfile $PIDFILE
      --startas $DAEMON --retry 10 --name $NAME
      >/dev/null 2>&1 ; then
      echo "$NAME."
      else
      if start-stop-daemon --test $START >/dev/null 2>&1; then
      echo "(not running)."
      exit 0
      else
      echo "(failed)."
      exit 1
      fi
      fi
      ;;
      restart|force-reload)
      $0 stop
      exec $0 start
      ;;
      *)
      echo "Usage: $0 restart" 1>&2
      exit 1
      ;;
      esac

      exit 0


      Dmesg's related to the rng:



      $ dmesg | grep -i -E 'rand|rng'
      [ 4.560639] random: systemd-udevd urandom read with 11 bits of entropy available
      [ 11.086922] systemd[1]: Starting Load/Save Random Seed...
      [ 15.022431] using random self ethernet address
      [ 15.022465] using random host ethernet address
      [ 15.027177] using random self ethernet address
      [ 15.027195] using random host ethernet address
      [ 21.308396] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
      [ 34.690558] random: nonblocking pool is initialized


      And systemd dump for rng-tools:



      -> Unit rng-tools.service:
      Description: rng-tools.service
      Instance: n/a
      Unit Load State: loaded
      Unit Active State: failed
      State Change Timestamp: Sun 2018-10-14 02:36:05 EDT
      Inactive Exit Timestamp: Sun 2018-10-14 02:36:04 EDT
      Active Enter Timestamp: n/a
      Active Exit Timestamp: n/a
      Inactive Enter Timestamp: Sun 2018-10-14 02:36:05 EDT
      GC Check Good: yes
      Need Daemon Reload: no
      Transient: no
      Slice: system.slice
      CGroup: n/a
      CGroup realized: no
      CGroup mask: 0x0
      CGroup members mask: 0x0
      Name: rng-tools.service
      Documentation: man:systemd-sysv-generator(8)
      Fragment Path: /run/systemd/generator.late/rng-tools.service
      Source Path: /etc/init.d/rng-tools
      Condition Timestamp: Sun 2018-10-14 02:36:04 EDT
      Condition Result: yes
      Assert Timestamp: Sun 2018-10-14 02:36:04 EDT
      Assert Result: yes
      Requires: system.slice
      Requires: sysinit.target
      WantedBy: multi-user.target
      WantedBy: graphical.target
      Conflicts: shutdown.target
      Before: shutdown.target
      Before: multi-user.target
      Before: graphical.target
      After: systemd-journald.socket
      After: system.slice
      After: remote-fs.target
      After: sysinit.target
      After: systemd-journald-dev-log.socket
      After: basic.target
      References: remote-fs.target
      References: graphical.target
      References: sysinit.target
      References: system.slice
      References: multi-user.target
      References: systemd-journald.socket
      References: systemd-journald-dev-log.socket
      References: basic.target
      References: shutdown.target
      ReferencedBy: multi-user.target
      ReferencedBy: graphical.target
      StopWhenUnneeded: no
      RefuseManualStart: no
      RefuseManualStop: no
      DefaultDependencies: yes
      OnFailureJobMode: replace
      IgnoreOnIsolate: no
      Service State: failed
      Result: exit-code
      Reload Result: success
      PermissionsStartOnly: no
      RootDirectoryStartOnly: no
      RemainAfterExit: yes
      GuessMainPID: no
      Type: forking
      Restart: no
      NotifyAccess: none
      NotifyState: unknown
      KillMode: process
      KillSignal: SIGTERM
      SendSIGKILL: yes
      SendSIGHUP: no
      UMask: 0022
      WorkingDirectory: /
      RootDirectory: /
      NonBlocking: no
      PrivateTmp: no
      PrivateNetwork: no
      PrivateDevices: no
      ProtectHome: no
      ProtectSystem: no
      IgnoreSIGPIPE: no
      RuntimeDirectoryMode: 0755
      LimitNOFILE: 4096
      LimitNOFILESoft: 1024
      StandardInput: null
      StandardOutput: journal
      StandardError: inherit
      SyslogFacility: daemon
      SyslogLevel: info
      -> ExecStart:
      Command Line: /etc/init.d/rng-tools start
      -> ExecStop:
      Command Line: /etc/init.d/rng-tools stop








      share













      I'm trying to understand what is going on with rng-tools and systemd on a Beaglebone Black dev-board that's leading to entropy depletion in /dev/random. I have about 8 dev-boards in a similar configuration and only the Beaglebone has the problem.



      The Beaglebone runs a Debian derivative and has a hardware rng. The OMAP rng sustains reads from /dev/hwrand. However, after draining /dev/random the device never recovers. For example, it takes 646 seconds to read 10 bytes from /dev/random.



      When I look at systemd I don't see a service enabled for the rng:



      $ systemctl list-unit-files | grep -i -E 'rng|rand'
      rng-tools.service generated
      systemd-random-seed.service static
      urandom.service static


      I try to enable it, and no error is returned:



      # systemctl enable rng-tools.service
      rng-tools.service is not a native service, redirecting to systemd-sysv-install.
      Executing: /lib/systemd/systemd-sysv-install enable rng-tools


      But the service fails to enable:



      $ systemctl list-unit-files | grep -i -E 'rng|rand'
      rng-tools.service generated
      systemd-random-seed.service static
      urandom.service static


      And:



      $ systemctl status rng-tools
      ● rng-tools.service
      Loaded: loaded (/etc/init.d/rng-tools; generated; vendor preset: enabled)
      Active: failed (Result: exit-code) since Sun 2018-10-14 02:36:05 EDT; 17h ago
      Docs: man:systemd-sysv-generator(8)


      There is a script in rng-tools called /etc/init.d/rng-tools that looks like a service file, but it is not a systemd service file. I don't see where it is enabled or where it feeds /dev/random. Debian may have a related bug report at Issue 776597, rng-tools: No systemd .service file. I don't believe the 776597 script is the same script shown below.



      How do I fix this issue or troubleshoot it further?




      Here are a couple of similar Q&A's. I have not been able to scrape useful information out of them. Part of the issue is the complexity systemd has introduced. I'm not quite following what is supposed to happen, and the finer points of the objects below /etc/systemd/system like multi-user.target.wants.



      • Generated systemd unit does not start on boot

      • Can start custom systemd service, can't enable it

      • Unable to enable systemctl service


      The rng-tools package:



      $ apt-file list rng-tools
      rng-tools: /etc/default/rng-tools
      rng-tools: /etc/init.d/rng-tools
      rng-tools: /etc/logcheck/ignore.d.server/rng-tools
      rng-tools: /etc/logcheck/violations.ignore.d/rng-tools
      rng-tools: /usr/bin/rngtest
      rng-tools: /usr/sbin/rngd
      rng-tools: /usr/share/doc/rng-tools/README.gz
      rng-tools: /usr/share/doc/rng-tools/TODO.Debian
      rng-tools: /usr/share/doc/rng-tools/changelog.Debian.gz
      rng-tools: /usr/share/doc/rng-tools/changelog.gz
      rng-tools: /usr/share/doc/rng-tools/copyright
      rng-tools: /usr/share/lintian/overrides/rng-tools
      rng-tools: /usr/share/man/man1/rngtest.1.gz
      rng-tools: /usr/share/man/man8/rngd.8.gz


      The script /etc/init.d/rng-tools.



      $ cat /etc/init.d/rng-tools
      #! /bin/sh
      #
      # rng-tools initscript for the rng-tools package
      # Copr. 2003 by Henrique de Moraes Holschuh <hmh@debian.org>
      # Copr. 2002 by Viral Shah <viral@debian.org>
      #
      ### BEGIN INIT INFO
      # Provides: rng-tools
      # Required-Start: $remote_fs $syslog
      # Required-Stop: $remote_fs $syslog
      # Default-Start: 2 3 4 5
      # Default-Stop: 0 1 6
      ### END INIT INFO
      #
      #
      # $Id: rng-tools.init,v 1.6.2.10 2008-06-10 19:51:37 hmh Exp $

      PATH=/sbin:/bin:/usr/sbin:/usr/bin
      DAEMON=/usr/sbin/rngd
      NAME=rngd
      DESC="Hardware RNG entropy gatherer daemon"
      PIDFILE=/var/run/rngd.pid

      DEVICELIST="hwrng hw_random hwrandom intel_rng i810_rng"

      HRNGDEVICE=/dev/hwrng
      RNGDOPTIONS=
      [ -r /etc/default/rng-tools ] && . /etc/default/rng-tools

      test -f $DAEMON || exit 0

      set -e

      finddevice ()
      [ -c "$HRNGDEVICE" ] && return 0
      for i in $DEVICELIST ; do
      if [ -c "/dev/$i" ] ; then
      HRNGDEVICE="/dev/$i"
      return 0
      fi
      if [ -c "/dev/misc/$i" ] ; then
      HRNGDEVICE="/dev/misc/$i"
      return 0
      fi
      done

      echo "(Hardware RNG device inode not found)"
      echo "$0: Cannot find a hardware RNG device to use." >&2
      exit 1


      START="--start --quiet --pidfile $PIDFILE --startas $DAEMON --name $NAME"
      case "$1" in
      start)
      echo -n "Starting $DESC: "
      finddevice
      START="$START -- -r $HRNGDEVICE $RNGDOPTIONS"
      if start-stop-daemon $START >/dev/null 2>&1 ; then
      echo "$NAME."
      else
      if start-stop-daemon --test $START >/dev/null 2>&1; then
      echo "(failed)."
      exit 1
      else
      echo "$DAEMON already running."
      exit 0
      fi
      fi
      ;;
      stop)
      echo -n "Stopping $DESC: "
      if start-stop-daemon --stop --quiet --pidfile $PIDFILE
      --startas $DAEMON --retry 10 --name $NAME
      >/dev/null 2>&1 ; then
      echo "$NAME."
      else
      if start-stop-daemon --test $START >/dev/null 2>&1; then
      echo "(not running)."
      exit 0
      else
      echo "(failed)."
      exit 1
      fi
      fi
      ;;
      restart|force-reload)
      $0 stop
      exec $0 start
      ;;
      *)
      echo "Usage: $0 restart" 1>&2
      exit 1
      ;;
      esac

      exit 0


      Dmesg's related to the rng:



      $ dmesg | grep -i -E 'rand|rng'
      [ 4.560639] random: systemd-udevd urandom read with 11 bits of entropy available
      [ 11.086922] systemd[1]: Starting Load/Save Random Seed...
      [ 15.022431] using random self ethernet address
      [ 15.022465] using random host ethernet address
      [ 15.027177] using random self ethernet address
      [ 15.027195] using random host ethernet address
      [ 21.308396] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
      [ 34.690558] random: nonblocking pool is initialized


      And systemd dump for rng-tools:



      -> Unit rng-tools.service:
      Description: rng-tools.service
      Instance: n/a
      Unit Load State: loaded
      Unit Active State: failed
      State Change Timestamp: Sun 2018-10-14 02:36:05 EDT
      Inactive Exit Timestamp: Sun 2018-10-14 02:36:04 EDT
      Active Enter Timestamp: n/a
      Active Exit Timestamp: n/a
      Inactive Enter Timestamp: Sun 2018-10-14 02:36:05 EDT
      GC Check Good: yes
      Need Daemon Reload: no
      Transient: no
      Slice: system.slice
      CGroup: n/a
      CGroup realized: no
      CGroup mask: 0x0
      CGroup members mask: 0x0
      Name: rng-tools.service
      Documentation: man:systemd-sysv-generator(8)
      Fragment Path: /run/systemd/generator.late/rng-tools.service
      Source Path: /etc/init.d/rng-tools
      Condition Timestamp: Sun 2018-10-14 02:36:04 EDT
      Condition Result: yes
      Assert Timestamp: Sun 2018-10-14 02:36:04 EDT
      Assert Result: yes
      Requires: system.slice
      Requires: sysinit.target
      WantedBy: multi-user.target
      WantedBy: graphical.target
      Conflicts: shutdown.target
      Before: shutdown.target
      Before: multi-user.target
      Before: graphical.target
      After: systemd-journald.socket
      After: system.slice
      After: remote-fs.target
      After: sysinit.target
      After: systemd-journald-dev-log.socket
      After: basic.target
      References: remote-fs.target
      References: graphical.target
      References: sysinit.target
      References: system.slice
      References: multi-user.target
      References: systemd-journald.socket
      References: systemd-journald-dev-log.socket
      References: basic.target
      References: shutdown.target
      ReferencedBy: multi-user.target
      ReferencedBy: graphical.target
      StopWhenUnneeded: no
      RefuseManualStart: no
      RefuseManualStop: no
      DefaultDependencies: yes
      OnFailureJobMode: replace
      IgnoreOnIsolate: no
      Service State: failed
      Result: exit-code
      Reload Result: success
      PermissionsStartOnly: no
      RootDirectoryStartOnly: no
      RemainAfterExit: yes
      GuessMainPID: no
      Type: forking
      Restart: no
      NotifyAccess: none
      NotifyState: unknown
      KillMode: process
      KillSignal: SIGTERM
      SendSIGKILL: yes
      SendSIGHUP: no
      UMask: 0022
      WorkingDirectory: /
      RootDirectory: /
      NonBlocking: no
      PrivateTmp: no
      PrivateNetwork: no
      PrivateDevices: no
      ProtectHome: no
      ProtectSystem: no
      IgnoreSIGPIPE: no
      RuntimeDirectoryMode: 0755
      LimitNOFILE: 4096
      LimitNOFILESoft: 1024
      StandardInput: null
      StandardOutput: journal
      StandardError: inherit
      SyslogFacility: daemon
      SyslogLevel: info
      -> ExecStart:
      Command Line: /etc/init.d/rng-tools start
      -> ExecStop:
      Command Line: /etc/init.d/rng-tools stop






      linux systemd arm random





      share












      share










      share



      share










      asked 7 mins ago









      jww

      1,47532157




      1,47532157

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475489%2frng-tools-allows-dev-random-depletion%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475489%2frng-tools-allows-dev-random-depletion%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay