[systemd-devel] Unable to get service to wait for a mount before starting
Adam Nielsen
a.nielsen at shikadi.net
Tue Oct 29 07:03:38 UTC 2024
> > I tried using RequiresMountsFor=/mnt/share however again, if it runs too
> > early in the boot process the mount is not there and the unit fails to
> > start, and is not retried (logs just say "Job myservice.service/start
> > failed with result 'dependency'.")
>
> RequiresMountsFor only works if systemd knows about this mount point
> which in practice usually means this mount point must be present in
> /etc/fstab.
Thanks for the suggestion! I do have it in /etc/fstab, although there
are two:
server:/path /mnt/server/path nfs4 x-gvfs-hide,noauto,x-systemd.automount,timeo=15,soft,proto=tcp 0 0
/mnt/server/path/subfolder /mnt/share none bind,_netdev,x-systemd.automount,x-systemd.requires=/mnt/server/path 0 0
This mounts an NFS path into a folder, then bind mounts a folder within
it to /mnt/share. I then use RequiresMountsFor=/mnt/share, since it's
the second mount that has to happen before the systemd unit can start.
The mounts work (they always mount in the correct sequence) it's just
that RequiresMountsFor= doesn't seem to like this set up.
Cheers,
Adam.
More information about the systemd-devel
mailing list