Mounting remote shares at boot


I have configured fstab to mount three shares on a remote Windows PC at boot. However, when I try to access them in Dolphin I receive the error:

An error occurred while accessing ‘/example/example’, the system responded: mount.cifs: permission denied

However, if I then go to a console and run “sudo mount -a” - everything works and the shares are accessible. The fstab and win-credentials file are both owned by root.

So it’s not an issue with the remote shares, nor I think the syntax of my fstab entries. Does anyone have any idea what is causing this please?

Thank you

It is always better to not only say that you think your fstab is correct, but showing it also. hen people can come to their own conclusions (in the unlikely case you have made an error). Anbd people can also gather information from it, e.g. what tyoe of file system, etc.

cat /etc/fstab

Good point! Here is my fstab:

UUID=12a26769-6668-4ab7-a449-b738b79bf7cb / btrfs defaults 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /var btrfs subvol=/@/var 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /usr/local btrfs subvol=/@/usr/local 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /tmp btrfs subvol=/@/tmp 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /srv btrfs subvol=/@/srv 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /root btrfs subvol=/@/root 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /opt btrfs subvol=/@/opt 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /home btrfs subvol=/@/home 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /boot/grub2/x86_64-efi btrfs subvol=/@/boot/grub2/x86_64-efi 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /boot/grub2/i386-pc btrfs subvol=/@/boot/grub2/i386-pc 0 0
UUID=B180-AE01 /boot/efi vfat utf8 0 2
UUID=e72c0ead-7577-4f8a-8aca-aec01c6bea67 swap swap defaults 0 0
UUID=12a26769-6668-4ab7-a449-b738b79bf7cb /.snapshots btrfs subvol=/@/.snapshots 0 0

//example/d$ /mnt/r-d cifs credentials=/etc/win-credentials,file_mode=0777,dir_mode=0777 0 0
//example/e$ /mnt/r-e cifs credentials=/etc/win-credentials,file_mode=0777,dir_mode=0777 0 0
//example/i$ /mnt/r-i cifs credentials=/etc/win-credentials,file_mode=0777,dir_mode=0777 0 0

The network may not be fully up at startup

Use nofail option

For a smooth experience use automounting and automatic unmounting through systemd:

**6700K:~ #** grep cifs /etc/fstab  
//                      /              **cifs**   noauto,x-systemd.automount,x-systemd.mount-timeout=30,_netdev,x-systemd.idle-timeout=1min,credentials=/root/  0  0 
**6700K:~ #**

Many people has solved this ny using systemd-automounting (as @karlmistelberger advices). May be his post is not clear at all points. This is an alternative explanation:


In fact all I had to do is to add these options to the entry in/etc/fstab:


My personal entry then reads:             /home/wij  nfs   noauto,nofail,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=5min          0  0

The noauto and the nofail are for not mounting it on boot (that is not needed, because we mount it on need) and nofail to avoid extra problems when the mounting fails.
You can of course vary in the value of the x-stystemd.idle-timeout, after that many minutes of not being in use the fs will unmounted.


Someting else (seeing your post with tyhe fstab);
There is an important, but not easy to find feature on the forums.

Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

An example is here: Using CODE tags Around your paste.

The above is pretty murky and confusing wording. My post links to chapter “Automount with systemd” of The terms “automounting” and “automatic unmounting” precisely and concisely describe what the posted entry in /etc/fstab accomplishes.

However you are always eager to post some far fetched misinterpretation of my comments.

It’s always a good idea to check Arch Wiki before posting in this forum, in my opinion of course.

The solution was to add _netdev in fstab, thus:

//windowsmachine/d$ /mnt/mountpoint cifs _netdev,credentials=/etc/win-credentials,file_mode=0777,dir_mode=0777 0 0

I believe this option indicates to not try mounting until the network is up.

Well documented here…