[systemd-devel] Systemd hang when restarting a service during shutdown
Uoti Urpala
uoti.urpala at pp1.inet.fi
Mon Nov 8 13:47:36 UTC 2021
On Mon, 2021-11-08 at 12:05 +0100, Sean Nyekjaer wrote:
> Regarding,
> https://github.com/systemd/systemd/issues/21203
>
> I think the point of the issue missed when the issue got closed.
>
> We have a service that is changing configs for systemd-networkd and
> issuing a `systemctl restart systemd-networkd`.
> An other service is checking uptime and issues a `systemctl reboot`,
> when our max uptime have been exeeced.
> If restart of systemd-networkd happens while a reboot is in progress,
> the system will hang "forever" (and continue to pet the watchdog).
The issue shows you using "systemctl start systemd-reboot". That is not
the right way to reboot. Use "systemctl reboot" instead. I suspect this
is related to why the reboot may stop partway: your command does not
start the reboot tasks in "irreversible" mode, which means that any
following contrary command, such as explicitly (re)starting a unit that
was going to be shut down, is going to implicitly cancel the
conflicting reboot action.
You should also be using "try-restart" instead of "restart". If your
intent is to change configs, you want to say "make sure old configs are
not in use" rather than "enforce that the service is running now". (I
think making the "restart" command have "start" semantics was a design
mistake, and the "try-restart"/"restart" pair would have been better
named "restart"/"start-or-restart".)
More information about the systemd-devel
mailing list