I cannot figure out how to mount an NFS share at boot. I've tried a couple different things (listed below) and nothing has worked. In both instances, they require network-online.target, yet they don't seem to be waiting for the network to be online before starting. Yes, I can indeed communicate with the remote machine, and I can run mount -a after logging in and the shares will mount. I'm at a complete loss.
Attempt #1: I put the following in /etc/fstab:
10.0.10.10:/volume1/Media /mnt/media nfs x-systemd.automount,noauto,nofail,x-systemd.requires=network-online.target,suid,dev,exec,rw,sync,nouser 0 0 The result after rebooting:
root@ubuntu-svr:~# journalctl -b -u mnt-media.mount -- Logs begin at Mon 2019-08-12 00:00:56 UTC, end at Fri 2019-09-20 22:05:16 UTC. -- Sep 20 21:36:29 ubuntu-svr systemd[1]: Mounting Mounts the '/mnt/media' directory... Sep 20 21:36:29 ubuntu-svr mount[1528]: mount.nfs: Network is unreachable Sep 20 21:36:29 ubuntu-svr systemd[1]: mnt-media.mount: Mount process exited, code=exited, status=32/n/a Sep 20 21:36:29 ubuntu-svr systemd[1]: mnt-media.mount: Failed with result 'exit-code'. Sep 20 21:36:29 ubuntu-svr systemd[1]: Failed to mount Mounts the '/mnt/media' directory. Attempt #2: I commented out the fstab entry and created a systemd mnt-media.mount file and enabled the systemd unit to start on boot. This is what the mnt-media.mount file consisted of:
root@ubuntu-svr:~# cat /etc/systemd/system/mnt-media.mount [Unit] Description=Mounts the '/mnt/media' directory Wants=network-online.target Requires=network-online.target #After=network-online.target [Mount] Where=/mnt/media What=10.0.10.10:/volume1/Media Options=auto,x-systemd.automount,nofail,suid,dev,exec,rw,sync,nouser Type=nfs [Install] WantedBy=multi-user.target I enabled it via systemctl enable mnt-media.mount. I rebooted, and checked the status of it:
root@ubuntu-svr:~# systemctl status mnt-media.mount ● mnt-media.mount - Mounts the '/mnt/media' directory Loaded: loaded (/etc/systemd/system/mnt-media.mount; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2019-09-20 22:28:51 UTC; 1min 12s ago Where: /mnt/media What: 10.0.10.10:/volume1/Media Sep 20 22:28:51 ubuntu-svr systemd[1]: Mounting Mounts the '/mnt/media' directory... Sep 20 22:28:51 ubuntu-svr mount[1206]: mount.nfs: Network is unreachable Sep 20 22:28:51 ubuntu-svr systemd[1]: mnt-media.mount: Mount process exited, code=exited, status=32/n/a Sep 20 22:28:51 ubuntu-svr systemd[1]: mnt-media.mount: Failed with result 'exit-code'. Sep 20 22:28:51 ubuntu-svr systemd[1]: Failed to mount Mounts the '/mnt/media' directory.
systemd-networkd-wait-online.service. I had previously disabled it to speed up boot.