On a Debian Linux 10 I have a CIFS share defined in /etc/fstab:
//192.168.120.1/Share /mnt/Share cifs credentials=/etc/fstab-share.password,auto,nofail 0 0
On system boot this share does not mount because of:
$ systemctl status mnt-Share.mount
● mnt-Share.mount - /mnt/Share
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Mon 2021-10-04 18:48:21 CEST; 23s ago
Where: /mnt/Share
What: //192.168.130.130/UnifiRecorder
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Oct 04 18:48:21 home-docker systemd[1]: Mounting /mnt/Share...
Oct 04 18:48:21 home-docker mount[397]: mount error(101): Network is unreachable
Oct 04 18:48:21 home-docker mount[397]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Oct 04 18:48:21 home-docker systemd[1]: mnt-Share.mount: Mount process exited, code=exited, status=32/n/a
Oct 04 18:48:21 home-docker systemd[1]: mnt-Share.mount: Failed with result 'exit-code'.
Oct 04 18:48:21 home-docker systemd[1]: Failed to mount /mnt/Share.
However if I run systemctl start mnt-Share.mount after logging in, everything is fine:
$ systemctl status mnt-Share.mount
● mnt-Share.mount - /mnt/Share
Loaded: loaded (/etc/fstab; generated)
Active: active (mounted) since Mon 2021-10-04 18:48:59 CEST; 1s ago
Where: /mnt/Share
What: //192.168.130.130/UnifiRecorder
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Tasks: 0 (limit: 4915)
Memory: 372.0K
CGroup: /system.slice/mnt-Share.mount
Oct 04 18:48:59 home-docker systemd[1]: Mounting /mnt/Share...
Oct 04 18:48:59 home-docker systemd[1]: Mounted /mnt/Share.
I do have a specific route set up to reach my NAS in /etc/network/interfaces:
# The primary network interface
allow-hotplug ens18
iface ens18 inet dhcp
up ip route add 192.168.120.0/24 via 192.168.1.1
I suspect that the static ip route is set up too late, am I right? Can I configure dependencies correctly in /etc/fstab somehow?