Score:0

rpi4 - Ubuntu 20.04.2 LTS - NFS drive not mounting on boot

cn flag

I have been having an issue getting an NFS share to automatically mount on boot for a handful of rpi4's all running Ubuntu 20.04.2 LTS.

If I run a sudo mount -a the drive successfully mounts with no issues.

I have tried a variety of fstab options with no success. Below is the current config:

192.168.1.100:/mnt/media /mnt/media nfs _netdev,auto,nfsvers=4 0 0

Running sudo cat /var/log/syslog | grep nfs returns the following:

Jun 24 18:59:01 test-01 kernel: [ 7.865019] Installing knfsd (copyright (C) 1996 [email protected]).

Jun 24 18:59:01 test-01 systemd[1]: nfs-config.service: Succeeded.

Jun 24 18:59:03 test-01 kernel: [ 18.820306] FS-Cache: Netfs 'nfs' registered for caching

Jun 24 18:59:03 test-01 mount[1754]: mount.nfs: Network is unreachable

I am not sure if it is trying to mount before the network is online, but i thought the _netdev option prevented this.

Score:0
ng flag

I ran into a similar problem with cifs (smb) too.

The solution for me was to add several options to mount:

  • x-systemd.automount
  • x-systemd.mount-timeout=5
  • x-systemd.device-timeout=5

Try this one if it works for you:

192.168.1.100:/mnt/media   /mnt/media   nfs    x-systemd.automount,x-systemd.mount-timeout=5,x-systemd.device-timeout=5,_netdev,auto,nfsvers=4   0  0

But before you reboot your system check if the mount procedure works with: mount -a. If this command does not mount, the code above wont help. If mount -a gives any error, you should remove the added fields, otherwise you might run into problems after reboot.

commandobob avatar
cn flag
Added the options you listed and am still able to mount -a with no errors (and the drive shows up) but it is still not adding at boot. Since adding those options the log seems to have dropped the error about the network: ```Jun 24 20:08:52 test-01 kernel: [ 7.892317] Installing knfsd (copyright (C) 1996 [email protected]). Jun 24 20:08:52 test-01 systemd[1]: nfs-config.service: Succeeded.```
AlexOnLinux avatar
ng flag
you can try to increase the timeout. if that does not work, i am sorry, that i cannot help.
commandobob avatar
cn flag
No dice. Increased the timeouts to various settings and still wont mount on boot (but still mounts with ```mount -a``` Log is showing something different now though ```Jun 25 13:02:25 test-01 kernel: [58797.261249] FS-Cache: Netfs 'nfs' registered for caching Jun 25 13:04:00 test-01 blkmapd[931]: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory Jun 25 13:04:00 test-01 kernel: [ 7.864061] Installing knfsd (copyright (C) 1996 [email protected]). Jun 25 13:04:00 test-01 systemd[1]: nfs-config.service: Succeeded.```
Score:0
st flag

I tried the same command in my Ubuntu 22.04 and it solved the problem

systemctl enable NetworkManager-wait-online.service
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.