So I installed Server 20.04 LTS on a Pi 4 for some home use. I absolutely cannot get the thing to automount CIFS on boot.
Note, typing a simple sudo mount -a on the command line after a boot works fine, mounts all three CIFS mounts with no errors logged. But that's not helpful, I need those shares up after patches or other reboots without user intervention.
I've googled and found multiple proposed solutions, none of which seem to do diddly, or what I want when they do something.
- add the entry _netdev to the fstab entry. Does nothing.
- create a batch file in /etc/network/if-up.d/ - I called it mountall - that contains just #!/bin/sh and "mount -a" on a new line. I made it executable with chmod. Does nothing.
- Make a cron entry that contains @reboot and the above script. Does nothing.
- add x-systemd.automount,noauto to the fstab as well. This mounts a couple of the mounts if I try to access them - like doing an ls of /mnt/transfer - but they still don't automount before that.
The entries all look like this:
//192.168.0.5/transfer/ /mnt/transfer cifs vers=3.0,_netdev,uid=1000,gid=1000,credentials=/etc/cifspasswd 0 0
Or //192.168.0.5/transfer/ /mnt/transfer cifs vers=3.0,x-systemd.automount,noauto,uid=1000,gid=1000,credent ials=/etc/cifspasswd 0 0
The credentials file has proper permissions (read only for root) and as I said this mounts fine off the command line.
None of the above work out, and you can see in dmesg that the network seems to come up well after trying to mount.
[ 18.013716] Key type cifs.spnego registered
[ 18.013728] Key type cifs.idmap registered
[ 18.015452] CIFS: Attempting to mount //192.168.0.5/transfer/
[ 18.015622] CIFS VFS: Error connecting to socket. Aborting operation.
[ 18.022401] CIFS VFS: cifs_mount failed w/return code = -2
[ 18.143841] CIFS: Attempting to mount //192.168.0.5/transfer/
[ 18.143982] CIFS VFS: Error connecting to socket. Aborting operation.
[ 18.150586] CIFS VFS: cifs_mount failed w/return code = -2
[ 18.183438] CIFS: Attempting to mount //192.168.0.5/transfer/
[ 18.183576] CIFS VFS: Error connecting to socket. Aborting operation.
[ 18.190189] CIFS VFS: cifs_mount failed w/return code = -2
[ 18.223329] CIFS: Attempting to mount //192.168.0.5/transfer/
[ 18.223468] CIFS VFS: Error connecting to socket. Aborting operation.
[ 18.230066] CIFS VFS: cifs_mount failed w/return code = -2
[ 19.262386] CIFS: Attempting to mount //192.168.0.5/transfer/
[ 19.262522] CIFS VFS: Error connecting to socket. Aborting operation.
[ 19.269203] CIFS VFS: cifs_mount failed w/return code = -2
[ 19.326664] bcmgenet fd580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 19.326697] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
I've run out of fixes to try except abominations like having cron fire a mount -a every minute or some crazy nonsense like that.
How the actual (censored) are you actually supposed to reliably mount remote CIFS shares on boot in Server 20.04?
Bookmarks