Hi. I have a number of auto-mounted NFS shares defined like the following:
# explicitly enable rpcbind dependency
services.rpcbind.enable = true;
fileSystems."/home/media/data/bin" = lib.mkIf variables.role.htpc {
device = "nas:/data/videos";
fsType = "nfs4";
options = [ "sec=sys" "x-systemd.automount" "x-systemd.mount-timeout=30" "x-systemd.device-timeout=30" "_netdev" "nofail" ];
};
This works perfectly fine on startup, but it hangs on shutdown, usually for around 5 minutes but sometimes perpetually. I can see in the shutdown messages that it shuts down the network interface, and then many steps later it appears to start unmounting the NFS shares.
Here’s a picture for reference:
I say appears because I see that it says unset vs. stopping, and there are lines toward the top of the screen that state that it stopped Remote File Systems and NFS client services. I’m not extremely familiar with systemd, to be honest, so I don’t know the significance of unset vs. stop here.
However, it always hangs in this section, and if I manually stop everything and unmount the NFS filesystems in advance, it never hangs, so I’m confident the issue is NFS related. I didn’t have this issue when I initially built my systems on NixOS 23.11, but it began happening with 24.05 and persists with 24.11.
Anyone know of a way to force systemd to unmount these NFS filesystems before stopping the network service? some way to set a dependency that those automount services must be stopped or unset before network can be stopped? or is there maybe a better way to define the NFS shares than I showed above that would avoid this problem?
Have been tinkering with this for a while but not have much luck. Any pointers would be appreciated.