1

I have a cifs share connectin a windows folder to a debian machine, however I cannot get it to mount on boot using fstab. I have the credentials stored in a file with 600 permissions.

//192.168.1.72/Wowcher_Order_System     /root/wowcher   cifs    credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlm      0       0

The credentials are saved like this:

username=user
password=pass

Is there anything obvious I am doing wrong? The share works if I manually mount it.

Edward144
  • 135

3 Answers3

2

You must add those two options:

  • auto (as stated by @davidgo) for this mount point to be loaded upon startup
  • _netdev for boot script to wait network before loading it

You can also add few more speed and safety options like relatime,nodev and maybe nosuid,noexec.

See man mount for available options.

A. Loiseau
  • 1,268
0

I have same issue but wasn't fixed adding both _netdev and auto ???

//192.168.0.50/Pool /mnt/pool cifs username=USER,password=PASS,vers=3.0,uid=1000,_netdev,auto 0 0

When it works fine with sudo mount -a ???

0

On Debian Bookworm I had some trouble with this as well.

I need to mount a Synology SMB share before docker comes up fully.

I have _netdev added, but it is not being observed, apparently. I also kept getting cifs_mount "failed w/return code = -101" during mount on reboot.
While mount -a works fine as mentioned.

Error -101 means: "ENETUNREACH 101 Network is unreachable"

Odd. It should wait for network because of the _netdev option.

I finally found that enabling the systemd-networkd-wait-online service resolves it:
systemctl enable systemd-networkd-wait-online.service

Rebooted. It was finally mounted correctly.

I do not know if _netdev isn't being observed for some strange reason, or this is due to something else, but this was the observed behavior.

I have also heard that using the fstab option x-systemd.automount (instead of _netdev) will work w/o needing the service enabled above? But, I have not tested this yet.

Note:
Enabling this service will cause a reboot delay even though network seems to come up immediately. Not sure why that is either, but _netdev simply wasn't working for me on Bookworm and I have found no other explanation yet.

B. Shea
  • 1,388