Rngd

From pressy's brainbackup
Jump to: navigation, search

Just installed an Oracle Linux 7.2 on OVM 3.4.1 (x86) and got a degraded system state, because rngd.service failed to start.

[root@OL7mpress01 ~]# systemctl --all --failed
  UNIT         LOAD   ACTIVE SUB    DESCRIPTION
● rngd.service loaded failed failed Hardware RNG Entropy Gatherer Daemon

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
[root@OL7mpress01 ~]# systemctl status rngd
● rngd.service - Hardware RNG Entropy Gatherer Daemon
   Loaded: loaded (/etc/systemd/system/rngd.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2016-09-20 17:53:40 CEST; 6s ago
  Process: 12986 ExecStart=/sbin/rngd -f (code=exited, status=1/FAILURE)
 Main PID: 12986 (code=exited, status=1/FAILURE)

Sep 20 17:53:40 OL7mpress01 systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Sep 20 17:53:40 OL7mpress01 systemd[1]: Starting Hardware RNG Entropy Gatherer Daemon...
Sep 20 17:53:40 OL7mpress01 rngd[12986]: Unable to open file: /dev/tpm0
Sep 20 17:53:40 OL7mpress01 rngd[12986]: can't open any entropy source
Sep 20 17:53:40 OL7mpress01 rngd[12986]: Maybe RNG device modules are not loaded
Sep 20 17:53:40 OL7mpress01 systemd[1]: rngd.service: main process exited, code=exited, status=1/FAILURE
Sep 20 17:53:40 OL7mpress01 systemd[1]: Unit rngd.service entered failed state.
Sep 20 17:53:40 OL7mpress01 systemd[1]: rngd.service failed.
[root@OL7mpress01 ssh]#

Google said to edit this file:

[root@OL7mpress01 ~]# vi /usr/lib/systemd/system/rngd.service
EDIT to -> ExecStart=/sbin/rngd -f -r /dev/urandom
[root@OL7mpress01 ~]# systemctl daemon-reload
[root@OL7mpress01 ~]# systemctl restart rngd

But also with this hint, the service was still broken... Then I found another tip which worked:

[root@OL7mpress01 ssh]# systemctl edit rngd.service
--> This will open an empty file, add the following lines:
[Service]
ExecStart=
ExecStart=/sbin/rngd -f -r /dev/random
[root@OL7mpress01 ~]# systemctl daemon-reload
[root@OL7mpress01 ~]# systemctl restart rngd
[root@OL7mpress01 ~]#
[root@OL7mpress01 ~]# systemctl status rngd
● rngd.service - Hardware RNG Entropy Gatherer Daemon
   Loaded: loaded (/etc/systemd/system/rngd.service; disabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/rngd.service.d
           └─override.conf
   Active: active (running) since Tue 2016-09-20 17:57:10 CEST; 5s ago
 Main PID: 13450 (rngd)
   CGroup: /system.slice/rngd.service
           └─13450 /sbin/rngd -f -r /dev/urandom

Sep 20 17:57:10 OL7mpress01 systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Sep 20 17:57:10 OL7mpress01 systemd[1]: Starting Hardware RNG Entropy Gatherer Daemon...
[root@OL7mpress01 ~]# 
[root@OL7mpress01 ~]# systemctl is-system-running
running
[root@OL7mpress01 ~]# 

That's it :-)