I have a question regarding systemd behavior during shutdown.
I am using systemd 219 on a Linux 4.1 kernel(custom distribution). When I
issue a "shutdown" command I observe something unusual :-
If a process managed by a systemd unit file with "Restart=always" exits
prior to receiving a SIGTERM, systemd attempts to restart the service.
However, since the system is shutting down, systemd detects a conflict with
shutdown.target, and declares that the service had entered "failed" state.
Wouldn't it be cleaner to detect this before attempting to execute the
restart job? A service voluntarily exiting during shutdown should not be
considered as a failure.
Sample journal logs with detailed output enabled:-
Sep 22 22:59:34 re0 systemd: foo.service holdoff time over, scheduling
33937 Sep 22 22:59:34 re0 systemd: Trying to enqueue job
Sep 22 22:59:34 re0 systemd: Requested transaction contradicts existing
jobs: Transaction is destructive
Sep 22 22:59:34 re0 systemd:foo.service failed to schedule restart job:
Transaction is destructive.
Sep 22 22:59:34 re0 systemd: foo.service changed auto-restart -> failed
systemd-devel mailing list