Hello
@MyGoul,
MyGoul wrote: ↑2024-05-03 18:29
[..] I'd like to understand how to fix the other way.
Quite an interesting topic, a very common question.
I did some tests using two Debian 12.5 installations (both using wired network interfaces statically configured with ifupdown):
- a virtual machine operating as SMB/CIFS server
- a virtual machine operating as CIFS client (with cifs-utils package installed)
First of all, I set up the /etc/fstab configuration as in your first post in the CIFS client (I used the same filename for credentials and the same CIFS options, but different sharename and mountpoint):
Code: Select all
//192.168.122.155/homes /mnt cifs vers=3.0,credentials=/root/.synocred 0 0
After rebooting, it worked fine:
Code: Select all
$ su -l -c "journalctl -b -g mnt\|cifs"
Password:
May 05 21:52:16 debian-bookworm systemd[1]: Mounting mnt.mount - /mnt...
May 05 21:52:17 debian-bookworm kernel: Key type cifs.spnego registered
May 05 21:52:17 debian-bookworm kernel: Key type cifs.idmap registered
May 05 21:52:17 debian-bookworm kernel: CIFS: Attempting to mount \\192.168.122.155\homes
May 05 21:52:18 debian-bookworm systemd[1]: Mounted mnt.mount - /mnt
I suppose it happened because the network connection was established very quickly by both server and client (both with static configuration for a wired connection) and, at the same time, my CIFS client was a little bit slower at booting then yours (IIRC, your last log recorded a failed CIFS mount attempt after 2 seconds since boot!).
Then, I changed the /etc/fstab configuration in the CIFS client according to [
1][
2]; it should activate the same services as you reported in
your previous post:
Code: Select all
//192.168.122.155/homes /mnt cifs vers=3.0,credentials=/root/.synocred,_netdev, nofail,x-systemd.automount 0 0
I tested the latter with the same previous client/server conditions and it worked:
Code: Select all
$ su -l -c "journalctl -b -g mnt\|cifs"
Password:
May 05 22:13:04 debian-bookworm systemd[1]: Mounting mnt.mount - /mnt...
May 05 22:13:06 debian-bookworm kernel: Key type cifs.spnego registered
May 05 22:13:06 debian-bookworm kernel: Key type cifs.idmap registered
May 05 22:13:06 debian-bookworm kernel: CIFS: Attempting to mount \\192.168.122>
May 05 22:13:06 debian-bookworm systemd[1]: Mounted mnt.mount - /mnt.
Then I tested the latter configuration again, but booting the CIFS client with CIFS services stopped on the CIFS server.
This is the CIFS client log after boot:
Code: Select all
$ su -l -c "journalctl -b -g mnt\|cifs"
Password:
May 05 22:32:21 debian-bookworm systemd[1]: Set up automount mnt.automount.
The
After that I restarted CIFS services on the CIFS server; then, I tried accessing the remote CIFS share from the client and it worked flawlessly:
Code: Select all
$ cd /mnt/
$ su -l -c "journalctl -b -g mnt\|cifs"
Password:
May 05 22:32:21 debian-bookworm systemd[1]: Set up automount mnt.automount.
May 05 22:42:33 debian-bookworm systemd[1]: mnt.automount: Got automount reques>
May 05 22:42:33 debian-bookworm systemd[1]: Mounting mnt.mount - /mnt...
May 05 22:42:34 debian-bookworm kernel: Key type cifs.spnego registered
May 05 22:42:34 debian-bookworm kernel: Key type cifs.idmap registered
May 05 22:42:34 debian-bookworm kernel: CIFS: Attempting to mount \\192.168.122>
May 05 22:42:34 debian-bookworm systemd[1]: Mounted mnt.mount - /mnt.
-----=====------ -----=====------ -----=====------ -----=====------
Therefore, the entry in your
/etc/fstab
can be configured adding
_netdev,nofail,x-systemd.automount
parameters to the CIFS mount point share options, as:
Code: Select all
//192.168.1.60/movies /mnt/synology cifs vers=3.0,credentials=/root/.synocred,_netdev,nofail,x-systemd.automount 0 0
The .mount and .automount systemd services you manually configured must be removed, of course.
Hope this helps. Please, let me know.
--
[1]
systemd.automount — Automount unit configuration
[2]
systemd.mount — Mount unit configuration
EDIT Sun 12 May 20:52:25 CEST 2024: This topic may be of interest to many users:
@Best_Threads.