2

Today, I installed havaged to my Arch Linux System (rolling release, systemd).

# systemctl start haveged

is supposed to start the daemon but that just wouldn't work. This is what the log had to say:

systemd[3916]: haveged.service: Failed at step STDIN spawning /usr/bin/haveged: No such file or directory
systemd[1]: haveged.service: Main process exited, code=exited, status=208/STDIN
systemd[1]: haveged.service: Unit entered failed state.
systemd[1]: haveged.service: Failed with result 'exit-code'.

The first error message in the log is wrong. /usr/bin/haveged does exist, of course. I even tried removing the package and reinstalling it but nothing helped, the daemon just could not be started properly. I even tried to restart systemd using systemctl daemon-reload but to no avail.

In the end, I rebooted the system and - voilà - haveged can be properly started.

Why was this reboot necessary? Was there anything I could have done differently to avoid this reboot?

Update: The content of the unit file:

$ /usr/lib/systemd/system/haveged.service

[Unit]
Description=Entropy Harvesting Daemon
Documentation=man:haveged(8)

[Service]
ExecStart=/usr/bin/haveged -F -w 1024 -v 1
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target
vic
  • 2,102

1 Answers1

3

The first error message in the log is wrong.

It's not wrong:)

systemd[3916]: haveged.service: Failed at step STDIN spawning /usr/bin/haveged: No such file or directory

The key message is Failed at step STDIN

What does it mean?

There is a directive StandardInput=:

Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of null, tty, tty-force, tty-fail or socket.

...

This setting defaults to null

Service startup failed here:

r = setup_input(context, params, socket_fd);

setup_input failed here:

case EXEC_INPUT_NULL:
            return open_null_as(O_RDONLY, STDIN_FILENO);

And open_null_as:

    fd = open("/dev/null", flags|O_NOCTTY);
    if (fd < 0)
            return -errno;
if (fd != nfd) {
        r = dup2(fd, nfd) &lt; 0 ? -errno : nfd;
        safe_close(fd);
} else
        r = nfd;

So, open("/dev/null", O_RDONLY|O_NOCTTY) failed: No such file or directory

Can you reproduce it?

  • purge the package
  • reboot
  • install the package
  • systemctl start

Can you append the output of systemctl cat haveged?

Evgeny
  • 5,476
  • Hi Evgeny, thanks for your answer, that's interesting. I could reproduce the error as long as I did not perform the reboot. Once I rebooted, the error was gone. Hence my question: why was the reboot necessary? – vic Dec 27 '15 at 12:22
  • @vic, you deleted your /dev/null somehow. /dev/null was restored on reboot. there are commands for creating /dev/null: http://unix.stackexchange.com/questions/27279/how-to-create-dev-null – Evgeny Dec 27 '15 at 17:33
  • OK. I'm not going to say that that's not true as I have no means of verifying it now. But I can guarantee that I did not play around with rm, and certainly not in the /dev folder. This is a fresh install and all I did was download and install a few packages, haveged among others, and I ran into the described issue. I'll try to reproduce it though I won't be able to do it very soon. – vic Dec 27 '15 at 17:50
  • @vic, > This is a fresh install. Maybe, something went wrong at installation time. Anyway, you didn't have the /dev/null. /dev/null-existance fixes your issue. – Evgeny Dec 27 '15 at 22:06