I have this problem with systemd when I have some units symlinks points to some locations in some unmounted filesystems:

A post about it is there : Systemd linked unit files on mounted disk fail to load

The problem is that the files in /etc/systemd are symlinks and so when systemd starts up it tries to read and parse them before any filesystem is mounted; because the filesystem isn't mounted the symlink doesn't refer to a valid file and so the service isn't loaded. I'd love to know an answer to this 'cos I have units I'd like to be loaded from an NFS server and suffer the same problem; to date I've had to copy the unit to the root partition and enable that :-(

I could solve it copying all units symlinks targets to /etc/systemd but I would prefer another solution. I've tried to to a target unit that would start all units depending on some filesystem mounting

Description=Unit that starts all units depending on /home mount                                                                                                                                                                           

but it does not work (when I start manually this target after reboot, som_other_unit is not loaded. Some suggestions?

  • systemd does not watch for changes in configuration files, let alone mounts becoming available. you need to run systemctl daemon-reload manually. My vague memories about issues with limitations in reload of running jobs (units in the process of starting) mean this is not something I would suggest doing during boot, however. github.com/systemd/systemd/pull/6619 – sourcejedi Oct 19 '17 at 17:32
  • 1
    It would work if you treated your NFS like usr on NFS, i.e. mount it in the initramfs. Obviously this will require the initramfs to set up networking. The initramfs transition is equivalent to a daemon-reload, but you're not introducing one of those at a new point. dracut has specific support for mounting additional filesystems. It supports nfs root and uses systemd internally, so I would expect this approach to be possible. I would specifically recommend using the mount option x-initrd.mount in fstab to mark the mount, as systemd also applies some special handling in this case. – sourcejedi Oct 19 '17 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.