My laptop connects to an NFS share on my home server over Wireguard so I can access the files from anywhere. The NFS share is in /etc/fstab but isn't mounted automatically. The Wireguard interface is managed with wg-quick and started using the systemd template unit wg-quick@ifname.service.
The setup works well. When I leave the house or come back, I change the endpoint for the Wireguard peer rather than remounting the NFS share. The NFS client stays happy and programs with open files are none the wiser.
However, there was one little problem. Shutdowns would hang for 90 seconds if I didn't unmount the NFS share first. Systemd was bringing down the Wireguard interfaces before unmounting the network filesystems. This could probably be solved with the correct drop-in file, but I found a more elegant solution. Simply add x-systemd.requires=wg-quick@ifname.service to the mount options in /etc/fstab.
I found the solution in a guide on creating a similar setup over on dhole.github.io. There are some other interesting posts over there, so it's worth a look.
[ ← The future of the Web, as of 2000 | Notes Index | Terrible Website of the Day → ]