Cifs requires sudo mount -a after restart

I want my laptop to automatically connect to the music directory on my NAS whenever it starts. After researching on the internet, I have added the following line to etc/fstab:

//WDMYCLOUD/Public/Shared\040Music /media/NAS_Music cifs guest,uid=1000,iocharset=utf8 0 0

When I then enter sudo mount -a it works as expected.

However, after a reboot, the NAS is not mounted and Dolphin shows the error message, mount.cifs: permission denied. When I open Yakuake and enter sudo mount -a, it works again.

This suggests that the line in etc/fstab is correct (or very close) but why does it produce the error so that I have to enter sudo mount -a after every restart? If anyone could tell me what I need to do to get this working as required, I would be very grateful. Thank you.

Hi @dcot, and welcome!

I suspect you want to, rather have a look at this: [root tip] Use systemd to mount ANY device

Hope it helps!

P.S.: In future posts, if you paste something from the terminal, wrap it in triple backtics (```). This makes it display correct and thus makes it easier to read for those that’s helping you.

1 Like

@dcot follow @Mirdarthos tip and read as reference Auto-mounting network file systems with systemd

I would also suggest to use the systemd method but if you absolutely want to use fstab check the bootlog systemctl --boot for errors in the mount proces.

Thank you all for your fast and informative replies. If anyone else find this thread with the same problem, reading about systemd and a quick experiment proved what causes it. The WiFi networking is too slow starting up so the path to the NAS is not available when the fstab entry tries to mount it. A quick test proved that the error does not occur when the laptop is connected to a cabled network.

This does not work, at least not in Manjaro Testing:

$ systemctl --boot
systemctl: option '--boot' is ambiguous; possibilities: '--boot-loader-menu' '--boot-loader-entry'

Both of these do not look appropriate in the scenario discussed here.

that should be journalctl --boot