[systemd-devel] Systemd hang when restarting a service during shutdown
Sean Nyekjaer
sean at geanix.com
Tue Nov 9 09:49:57 UTC 2021
On Tue, Nov 09, 2021 at 09:30:05AM +0100, Sean Nyekjaer wrote:
> On Mon, Nov 08, 2021 at 03:00:42PM +0100, Sean Nyekjaer wrote:
> > On Mon, Nov 08, 2021 at 03:47:36PM +0200, Uoti Urpala wrote:
> > > 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".)
> >
> > I can reproduce it with "systemctl reboot"...
> >
> > I'll try the "try-restart" option, and report back
> >
> > Thanks
> >
>
> "try-restart" does not fix it for the example above.
> But it does with the original issue where we first noticed this...
>
> https://github.com/systemd/systemd/issues/4955#issuecomment-506234412
>
> $ mkdir /run/systemd/network/
> $ vi /run/systemd/network/something.network
> corrupt the file! make it look something like
> """
> [Match]
> Name=eth*
>
> [Net
> """
> $ systemctl try-restart systemd-networkd; systemctl reboot
>
> Looks like a fix / workaround
^^ Scratch that... Still hangs
More information about the systemd-devel
mailing list