[systemd-devel] daemon-reload does not pick up changes to /etc/systemd/system during boot

Lennart Poettering lennart at poettering.net
Thu Oct 13 11:59:31 UTC 2022


On Mi, 12.10.22 16:54, Alex Aminoff (aminoff at nber.org) wrote:

> As soon as the system is up I can ssh in and run systemctl start autofs and
> it works just fine. In journalctl -b I can see my rc.initdiskless running
> followed by the daemon-reload. But no autofs and no evidence that systemd
> tried to start autofs.
>
> My only guess is that somehow daemon-reload is not enough because as far as
> systemd is concerned we already queued up for starting all the services
> needed by multi-user.target back when we switched root from the
> initrd.

daemon-reload just tells PID 1 to reload units, it has no direct effect on
the job queue, it won't enqueue any deps that might have been added.

You can issue "systemctl start --no-block multi-user.target" to
reenqueue multi-user.target again which will then also reenqueue all
its deps again, taking the new deps into consideration.

An alternative is to use add in Upholds= type deps from
multi-user.target to your service. That (somewhat recently added) dep
type has a "continious" effect: whenever a unit is up that has a dep
(or multiple of this kind it will have the effect that the listed dep
will be started if not running. It means "systemctl stop" of a
dependent service will be immediately undone though, i.e. it has quite
different semantics from the usual Wants=.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list