Page 1 of 1

Samba mounted folders don't automount at boot

Posted: Mon Jan 30, 2017 6:19 pm
by Sciamano
Hello... solved one problem, a new one arises.
On my new OPi PC, I have edited the fstab in order to mount a few directories from my local NAS via Samba.
These are the fstab lines:

Code: Select all

//192.168.1.103/Multimedia /mnt/Multimedia cifs _netdev,rw,credentials=/root/.cifscred,sec=ntlm,nofail 0 0
//192.168.1.103/SBCBackups/      /mnt/backupfolder    cifs    _netdev,rw,iocharset=utf8,credentials=/root/.cifscred,sec=ntlm,nofail 0 0
//192.168.1.103/STCloud /mnt/STCloud cifs _netdev,rw,iocharset=utf8,credentials=/root/.cifscred,sec=ntlm,nofail 0 0
The problem is that when I reboot, sometimes they get mounted automatically but most of the times they don't.
Issuing the command "mount -a" makes them mount correctly, which should mean that the syntax is correct (btw, the same lines on a RPi work perfectly) and the problem lies somewhere else, but I have no idea how to find out. :)
Any suggestions?
Thanks!!

P.S.: I've updated to v143 and I've noticed that the Opi Pc now has a flashing red led, while before it only showed a fixed green led. Is this behavior expected? Thanks!

Re: Samba mounted folders don't automount at boot

Posted: Mon Jan 30, 2017 6:24 pm
by Sciamano

Code: Select all

root@OPiHome:~# dmesg
[...]
[    9.073769] CIFS VFS: Error connecting to socket. Aborting operation
[    9.074041] CIFS VFS: cifs_mount failed w/return code = -101
[    9.127553] CIFS VFS: Error connecting to socket. Aborting operation
[    9.127807] CIFS VFS: cifs_mount failed w/return code = -101
[    9.235352] CIFS VFS: Error connecting to socket. Aborting operation
[    9.235585] CIFS VFS: cifs_mount failed w/return code = -101
I guess the problem lies here.

Re: Samba mounted folders don't automount at boot

Posted: Mon Jan 30, 2017 6:51 pm
by Sciamano
Ok, finding the error helped looking for a solution (Google is *ALWAYS* your friend :mrgreen: ).

I tried discarding the _netdev option, which was apparently failing and substituting it with auto,x-systemd.automount as follows:

Code: Select all

//192.168.1.103/STCloud /mnt/STCloud cifs auto,x-systemd.automount,rw,iocharset=utf8,credentials=/root/.cifscred,sec=ntlm,nofail 0 0
//192.168.1.103/Multimedia /mnt/Multimedia cifs auto,x-systemd.automount,rw,iocharset=utf8,credentials=/root/.cifscred,sec=ntlm,nofail 0 0
//192.168.1.103/SBCBackups/      /mnt/backupfolder    cifs    auto,x-systemd.automount,rw,iocharset=utf8,credentials=/root/.cifscred,sec=ntlm,nofail 0 0
I've tried rebooting ten times, and the directories were mounted correctly every time.
I hope this is the right solution.
Sorry for flooding the board, but I'm writing all this to help anyone who might encounter the same problem in the future.

P.S.: I'm still interested in whether the red LED blinking status is intentional :)

Re: Samba mounted folders don't automount at boot

Posted: Mon Jan 30, 2017 9:25 pm
by Fourdee
Sciamano wrote: I tried discarding the _netdev option, which was apparently failing and substituting it with auto,x-systemd.automount as follows:

P.S.: I'm still interested in whether the red LED blinking status is intentional :)
hehe, yes, the LED heartbeat was added to all H3's in v143.

Think you might be onto something here, great find!

I believe netdev was needed for Wheezy (sysinit) to tell sysinit that its a remote drive, however, reading https://help.ubuntu.com/community/Fstab indicates only valid for NFS mounts.

Either way, it looks like netdev isn't required for SystemD, so i'll get that removed by default in DietPi, after i've done some tests:
https://github.com/Fourdee/DietPi/issues/744

Re: Samba mounted folders don't automount at boot

Posted: Mon Jan 30, 2017 10:58 pm
by Sciamano
Fourdee wrote:hehe, yes, the LED heartbeat was added to all H3's in v143.
Very nice touch!
Think you might be onto something here, great find!
Always nice to be helpful. I really love DietPi, and even though I would love to donate to the project, my current financial situation does not allow me to for the time being. But knowing that I am somehow contributing in other ways makes me feel better.

Re: Samba mounted folders don't automount at boot

Posted: Tue Jan 31, 2017 8:52 am
by Sciamano
What's pretty strange is that my other OPi PC (the one at work) correctly connects to my NAS at home with the following fstab line:

Code: Select all

//nas-remote-IP/Multimedia /mnt/nas cifs defaults,rw,credentials=/root/.cifscred,_netdev 0 0
So why does the same line fail when trying to mount the same folder from the LAN?
It's beyond my abilities, but I think it would be interesting to investigate.