On 12.10.2022 23:54, Alex Aminoff wrote:
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.
Correct.
Hopefully it is something obvious that I am missing.
No. See also thread https://lists.freedesktop.org/archives/systemd-devel/2022-September/048370.html