I have a laptop (OpenSUSE Tumbleweed) connected to the LAN via WI-FI. Elsewhere on this LAN is an Ubuntu Server sharing directories via NFS. What is the best way for my client to reliably automount the NFS shares after reboot/resume?
On my clients that are connected via Ethernet, I just use the NFS Client tool in YaST which configures /etc/fstab. This is rock solid and works great. However, for Wi-Fi clients, the wireless connection is established after /etc/fstab tries to mount the drives, so it never works. After some research here and here, I determined that I should use /etc/auto.master instead. This will mount drives on demand, thus avoiding any premature attempts before Wi-Fi is up and running. This worked great for a while, but lately, for reasons unknown, it doesn’t function after reboots. I have to run “systemctl restart autofs” every time I reboot if I want my mounts to work again.
Again, doing research, I found this thread from 2018 which suggests the preferred setup is to do a systemd automount. How should I properly set up this Wi-Fi client so it reliably automounts my shared drives? If /etc/auto.master is the way to go, then how do I get it to work without needing to restart autofs every time?
I looks as if Automount (no, not what many people mean with this term, but the original meaning of Automount in Unix) could help you.
That is, it mounts when needed (some process needing a file from the NAS).
That is not quite correct. This is true if you are using NetworkManager with user connections. It is not true if you are using other network management (like wicked) or you are using NetworkManager with system connections. KDE Plasma applet defaults to user connections for wireless (I believe, it is the only frontend which does it) but it can be changed in connection properties.
systemd automount is based in the same kernel autofs, it provides less features than automountd, but for the simple cases it is probably OK. What is best for you is really up to you.
You need to find out why it is not started on boot. If you provide output of
journalctl -b --no-pager --full
someone may look at it. Low hanging fruits - is autofs service enabled at all?
I checked YaST > Services and saw ‘autofs’ start mode was set to manual. I changed that to On Boot and it works as it should now. The drives mount after reboot. Thank you for the suggestion and I’m glad this one was easy.
Since hcvv suggested systemd Automount, should I be using that instead? Is there any advantage over what I’m doing now? Or should I just stick with what I have since it’s working?
When it works and when you understand your configuration and thus are used to it, leave it as it is. They are just two alternatives and I assume that good old automounter will function for the forseeable future.