0

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?

5
  • 1
    Does this answer your question? How does _netdev mount option in /etc/fstab work?
    – A.B
    Oct 5, 2021 at 8:00
  • See also this Q/A with an answer of mine for more complex setups: unix.stackexchange.com/questions/486777/…
    – A.B
    Oct 5, 2021 at 8:01
  • @A.B Wow, _netdev solved the problem indeed. I modified my mount this way //192.168.120.1/Share /mnt/Share cifs credentials=/etc/fstab-share.password,auto,nofail,_netdev 0 0 If you change your comment to an answer I'll accept it right away. Oct 6, 2021 at 18:11
  • My 1st comment is a proposal for duplicate question (I don't feel like writing such answer when it's already available, but I don't mind if the proposal isn't accepted in the end and anybody else writes something).
    – A.B
    Oct 6, 2021 at 18:13
  • Ok I did upvote the comment, at least. Thanks again! Oct 7, 2021 at 6:31

0

You must log in to answer this question.

Browse other questions tagged .