Re: systemd update "forgets" ordering for shutdown

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 15 May 2020, Frank Steiner wrote:
> Hi,
> 
> I need to run a script on shutdown before any other service is stopped.
> Due to an advice Lennart gave a while ago I'm using this service file
> (with multi-user.target being our default runlevel target):
> 
> [Unit]
> After=multi-user.target
> 
> [Service]
> Type=oneshot
> ExecStart=/bin/true
> ExecStop=/usr/lib/systemd/scripts/halt.local.bio
> TimeoutSec=120
> RemainAfterExit=yes

This seems inherently fragile.

If `multi-user.target` were to be stopped for whatever reason (and this 
is generally possible), the ordering dependencies between services 
Before=multi-user.target and services After=multi-user.target are broken. 
This is because no stop job for `multi-user.target` will be added to 
systemd's transaction (it's already stopped!), and ordering dependencies 
only apply to units actually added to the transaction.

I saw that you noted that the problem started after `systemctl 
daemon-reload`. Perhaps you could check whether `multi-user.target` is 
still active after this?

(Thinking about this some more, this seems like an inherent design flaw 
with the way all of the systemd's standard targets work. Perhaps these 
ought to use RefuseManualStop=true? Perhaps this should even be the 
default?)
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux