Cannot mount windows share on boot using fstab

669 views Asked by At

I've got a problem on Debian 10.11 (but I think it's not only Debian related) with onboot mounting Windows share.

cifs-utils     2:6.8-2      amd64        Common Internet File System utilities

cat /etc/fstab | grep share2

gives

//10.100.0.204/share2   /home/share2    cifs    auto,vers=default,rw,file_mode=0775,dir_mode=0775,noperm,gid=100,username=user1,password=passwordhard   0   0

When I type: command mount /home/share2 Works as expected.

dmesg gives me an errors:

[    5.045482] CIFS VFS: Error connecting to socket. Aborting operation.
[    5.046471] CIFS VFS: cifs_mount failed w/return code = -101

I think that linux tries too early to mount samba shares. What can I do about it?

I know that I can use crontab and: @reboot root sleep 15; mount /home/share2 as workaround but I like resolving problems at source.

1

There are 1 answers

0
Dudi Boy On

If the problem is indeed samba service is loading too fast.

It is possible to edit samba service file.

Add Requires=<a service-name that need to be loaded prior to samba>

This trick is the official pattern to control/manage/order systemd service loading.