Package: haveged
Version: 1.9.1-5
Severity: important

Dear maintainer,

Haveged fails to start often (but not always) during boot. Manually starting
it later with "systemctl start haveged" is successful. Systemd version is
232-19. Journalctl showed the following error message:

  systemd[557]: haveged.service: Failed at step NAMESPACE spawning 
/usr/sbin/haveged: No such file or directory

Searching for more information on this issue led to the PrivateTmp option in
the service configration file. Setting PrivateTmp=no in haveged.service did
avoid the problem on my system.

Additionally, I was able to find the likely cause by enabling systemd debug
messages with systemd.log_level=debug on the kernel command line. The log is
quite long. I've tried to extract the relevant parts:

Mar 18 14:29:05 notebook systemd[1]: Reached target Local File Systems.
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Passing 0 
fds to service
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: About to 
execute: /bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Forked 
/bin/systemd-tmpfiles as 554
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Changed 
dead -> start
Mar 18 14:29:05 notebook systemd[1]: Starting Create Volatile Files and 
Directories...
[...]
Mar 18 14:29:05 notebook systemd[1]: haveged.service: 
ConditionVirtualization=!container succeeded.
Mar 18 14:29:05 notebook systemd[555]: nfs-config.service: Executing: 
/usr/lib/systemd/scripts/nfs-utils_env.sh
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Passing 0 fds to service
Mar 18 14:29:05 notebook systemd[1]: haveged.service: About to execute: 
/usr/sbin/haveged --Foreground --verbose=1 $DAEMON_ARGS
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Forked /usr/sbin/haveged 
as 557
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Changed dead -> running
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Job haveged.service/start 
finished, result=done
Mar 18 14:29:05 notebook systemd[1]: Started Entropy daemon using the HAVEGE 
algorithm.
[...]
Mar 18 14:29:05 notebook systemd[554]: systemd-tmpfiles-setup.service: 
Executing: /bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
[...]
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running create action for entry 
D /tmp
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Found existing directory "/tmp".
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: "/tmp" has right mode 41777
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running remove action for entry 
D /tmp
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: rm -rf "/tmp"
[...]
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running create action for entry 
x /tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running remove action for entry 
x /tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running create action for entry 
X /tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*/tmp
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running remove action for entry 
X /tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*/tmp
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running create action for entry 
x /var/tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running remove action for entry 
x /var/tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running create action for entry 
X /var/tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*/tmp
Mar 18 14:29:05 notebook systemd-tmpfiles[554]: Running remove action for entry 
X /var/tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-*/tmp
[...]
Mar 18 14:29:05 notebook systemd[1]: Received SIGCHLD from PID 554 
(systemd-tmpfile).
Mar 18 14:29:05 notebook systemd[1]: Child 554 (systemd-tmpfile) died 
(code=exited, status=0/SUCCESS)
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Child 554 
belongs to systemd-tmpfiles-setup.service
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Main 
process exited, code=exited, status=0/SUCCESS
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Changed 
start -> exited
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: Job 
systemd-tmpfiles-setup.service/start finished, result=done
Mar 18 14:29:05 notebook systemd[1]: Started Create Volatile Files and 
Directories.
Mar 18 14:29:05 notebook systemd[1]: systemd-tmpfiles-setup.service: cgroup is 
empty
[...]
Mar 18 14:29:05 notebook systemd[557]: haveged.service: Failed at step 
NAMESPACE spawning /usr/sbin/haveged: No such file or directory
Mar 18 14:29:05 notebook systemd[1]: systemd-journald.service: Received 
EPOLLHUP on stored fd 54 (stored), closing.
Mar 18 14:29:05 notebook systemd[1]: Received SIGCHLD from PID 557 ((haveged)).
Mar 18 14:29:05 notebook systemd[1]: Child 557 ((haveged)) died (code=exited, 
status=226/NAMESPACE)
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Child 557 belongs to 
haveged.service
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Main process exited, 
code=exited, status=226/NAMESPACE
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Changed running -> failed
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Unit entered failed state.
Mar 18 14:29:05 notebook systemd[1]: haveged.service: Failed with result 
'exit-code'.
Mar 18 14:29:05 notebook systemd[1]: Spawning thread to nuke 
/tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-haveged.service-CF3b36
Mar 18 14:29:05 notebook systemd[1]: Spawning thread to nuke 
/var/tmp/systemd-private-585850ad3e454158ae8ab3f9afe67cd9-haveged.service-yFgE9p
Mar 18 14:29:05 notebook systemd[1]: haveged.service: cgroup is empty

It looks like systemd-tmpfiles-setup.service deleted all temporary files
and directories while haveged.service tried to start using private temporary
subdirectories in /tmp and /var/tmp.

I have found one other service that runs early (i.e. DefaultDependencies=no)
and uses PrivateTmp=yes: systemd-timesyncd.service. It has the following
dependencies in its service file:

  After=systemd-remount-fs.service systemd-tmpfiles-setup.service 
systemd-sysusers.service

I think haveged should at least specify After=systemd-tmpfiles-setup.service.
Adding it on my system has so far avoided all boot problems with
PrivateTmp=yes. I'm not sure about the other dependencies. Maybe a systemd
expert could comment on those.


-- System Information:
Debian Release: 8.7
  APT prefers stable
  APT policy: (713, 'stable'), (712, 'oldstable'), (560, 'unstable-debug'), 
(560, 'unstable'), (550, 'testing-debug'), (550, 'testing'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: i386 (x86_64)
Foreign Architectures: amd64

Kernel: Linux 4.9.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages haveged depends on:
ii  init-system-helpers  1.47
ii  libc6                2.24-9
ii  libhavege1           1.9.1-5
ii  lsb-base             4.1+Debian13+nmu1

haveged recommends no packages.

Versions of packages haveged suggests:
pn  apparmor  <none>

-- no debconf information

Reply via email to