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

Alex Aminoff aminoff at nber.org
Wed Oct 12 20:54:20 UTC 2022


I am diskless booting Rocky Linux 9 , using an NFS mounted root. This 
works OK so far. However, I want to mount /etc/ as a tmpfs and load up a 
bunch of config files, then have systemd see the (new) 
/etc/systemd/system and use that in the rest of the boot process, 
bringing up some non-default services etc.

I have a service that does the creation and copying of /etc which runs 
from local-fs-pre.target.wants:

$ cat nber-rc-initdiskless.service

[Unit]
Description=Run NBER diskless setup including /sbin/copy_conf
DefaultDependencies=no
Before=local-fs-pre.target
After=initrd-switch-root.service plymouth-switch-root.service
OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
AssertPathExists=/etc/rc.initdiskless

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bash /etc/rc.initdiskless
ExecStart=systemctl daemon-reload
StandardOutput=journal+console
StandardError=journal+console

[Install]
WantedBy=local-fs-pre.target

I then have for example 
/etc/systemd/system/multi-user.target.wants/autofs.service -> 
/usr/lib/systemd/system/autofs.service

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.

Hopefully it is something obvious that I am missing. Thanks in advance 
for any help,

  - Alex Aminoff

    NBER




More information about the systemd-devel mailing list