Problem: Systemd Dependency Cycle Causing NFS Mount Issues

Problem

After rebooting the fileserver, not all NFS mounts were successfully mounted.
In particular, the mount point:

/mnt/server/share

was missing, causing some shares to be unavailable.
The following messages appeared in the system logs:

root@fs:~# dmesg | grep share
[    8.622998] systemd[1]: nfs-server.service: Found ordering cycle on mnt-server-share.mount/start
[    8.623007] systemd[1]: nfs-server.service: Job mnt-server-share.mount/start deleted to break ordering cycle starting with nfs-server.service/start

The relevant fstab entry was:

...  /mnt/server/share nfs  tcp,vers=3,async,rdirplus,rsize=32768,wsize=32768   0   0

Cause

The NFS mount /mnt/server/share points to a remote server. By default, systemd automatically adds a dependency between NFS mounts and the local nfs-server.service.

This creates a circular dependency during boot:

nfs-server.service → mnt-server-share.mount → nfs-server.service

Since systemd cannot resolve this dependency cycle, it cancels the mount operation. This explains the error message seen in the logs and why the share was not mounted automatically.

Solution

There are two recommended approaches to fix this issue:

1. Automatic Mount on Demand

Update the fstab entry as follows:

...  /mnt/server/share  /mnt/server/share  nfs  tcp,vers=3,async,rdirplus,rsize=32768,wsize=32768,noauto,x-systemd.automount  0  0
  • noauto prevents systemd from mounting the share immediately at boot.
  • x-systemd.automount ensures that the share is mounted automatically the first time it is accessed.

This avoids dependency issues while still making the share available when needed.

2. Mount After Network Availability

Alternatively, you can mark the mount as network-dependent by using _netdev:

...  /mnt/server/share  /mnt/server/share  nfs  tcp,vers=3,async,rdirplus,rsize=32768,wsize=32768,_netdev  0  0
  • _netdev tells systemd to delay mounting until the network stack is fully up and running.

This topic was automatically closed after 24 hours. New replies are no longer allowed.