I originally tried posting this in the Ubuntu forums, but am hoping I will have a wider audience here.

I have a setup in which I am mounting NFS/CIFS in my fstab which are then consumed by a service (in my case, the service is rendered by a docker container).

Generally speaking, everything works great. When my systemd service launches, it ensures that the mount points are properly loaded (my unit is defined with RequiresMountsFor=). My mount points are defined in /etc/fstab using FQDN names which are resolved internally on my network:

nas.home.ca:/mnt/HomeNAS                        /mnt/nas nfs ro 0 0
nas.home.ca:/mnt/HomeNAS/VM/Config/Alma-Docker1 /mnt/docker nfs rw 0 0
//nas.home.ca/Restore                          /mnt/restore cifs credentials=/etc/fstab.credentials.backup,file_mode=0777,dir_mode=02777 0 0

The problem occurs if my internal Nameservers are offline while the service is starting up. If the mounts are not already present, then the mounts fail fast with errors that the fqdn is unable to resolve, and systemd does not try to remount them. Consequently, my service also fails to start and does not try to restart given that the dependencies have failed.

I looked through the x.systemd options available for fstab and don't find anything that would configure the mount units to restart/retry on failure.

[eric@dockervm2 system]$ sudo systemctl start mnt-nas.mount
Job failed. See "journalctl -xe" for details.
[eric@dockervm2 system]$ sudo systemctl start mnt-restore.mount
Job failed. See "journalctl -xe" for details.
[eric@dockervm2 system]$ sudo systemctl start mnt-docker.mount
Job failed. See "journalctl -xe" for details.
[eric@dockervm2 system]$ sudo journalctl -xe

Consequently, when I try to start my service, I get the following error message:

[eric@dockervm2 system]$ sudo systemctl start backup-docker-compose
A dependency job for backup-docker-compose.service failed. See 'journalctl -xe' for details.

How can I setup my mount points for them to retry? I realize that the issue is that my nameserver is offline, and I would have liked this to try and restart itself every XXX seconds until my nameserver is back up and running. I know I could circumvent by using IPs instead of fqdn in fstab (or local entries in the /etc/hosts file), but that defeats the purpose a little.

Is there anyway to configure this natively in systemd to keep retrying?

1 Answer 1


Many people have asked, the answer seems that the people are not to have.


I worked around this problem by ignoring systemd mounts, and implementing the mount as a service instead. For example:

[root@adele ~]# cat /etc/systemd/system/srv-music.service 
Description=Media devices

ExecStart=/usr/bin/mount -t nfs4 -o vers=4,minorversion=1,owner,ro darknight.localdomain6:/Media /srv/music
ExecStop=/usr/bin/umount /srv/music


Keywords above are Restart and RestartSec.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .