ullusparvus
Posts: 4
Joined: Mon Oct 17, 2016 3:11 pm

Automount of SMB share not working

Tue Oct 18, 2016 11:38 am

Hi altogether,

I have samba configured and running on my Raspberry 1 (Raspbian Jessie). There is an external USB hard drive connected to Raspberry 1 with a folder, which I want to use as data-directory for owncloud, which is installed on my Raspberry 2 (Raspbian Jessie).

The /etc/samba/smb.conf on Raspberry 1 looks like follwing:

Code: Select all

[global]
workgroup = WORKGROUP
security = user
encrypt passwords = yes

[ownCloudData]
comment = ownCloud-Data
path = /mnt/wdmybook_4tb/ownCloud
read only = no
Furthermore there is a sambauser 'pi' with a password configured.
From my Raspberry 2, I successfully tested the connection to the samba share with

Code: Select all

smbclient -U pi -L //raspi_1/ownCloudData
which is resulting in the following:

Code: Select all

Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10-Debian]

	Sharename       Type      Comment
	---------       ----      -------
	ownCloudData    Disk      ownCloud-Data
	IPC$            IPC       IPC Service (Samba 4.2.10-Debian)
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10-Debian]

	Server               Comment
	---------            -------
	RASPI_1              Samba 4.2.10-Debian

	Workgroup            Master
	---------            -------
	WORKGROUP            RASPI_1
Now the manual mount of this share works like it should:

Code: Select all

sudo mount -t cifs //raspi_1/ownCloudData /mnt/owncloudTemp -o user,username=pi,password='password',uid=33,rw,suid,file_mode=0770,dir_mode=0770,noperm
where 33 is the id of the apache user, because it needs the appropriate rights in order to making owncloud work.

Honestly, I don't really know how to transform this to an appropriate entry for /etc/fstab, but when I try it like this

Code: Select all

//raspi_1/ownCloudData  /mnt/owncloudTemp       cifs    user,username=pi,password='password',uid=33,rw,suid,file_mode=0770,dir_mode=0770,noperm
if fails with the following error:

Code: Select all

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Why am I getting a permission error with the fstab-method and manually mounting works?

Many thanks in advance!
Regards,
Chris

User avatar
lmarmisa
Posts: 1268
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: Automount of SMB share not working

Tue Oct 18, 2016 1:16 pm

I see a possible syntax error there. The two last fields of a line on the file fstab should be <dump> (normally 0) and <pass num> (probably 0 in your case too).

https://help.ubuntu.com/community/Fstab

https://help.ubuntu.com/community/Mount ... ermanently

ullusparvus
Posts: 4
Joined: Mon Oct 17, 2016 3:11 pm

Re: Automount of SMB share not working

Tue Oct 18, 2016 7:21 pm

@lmarmisa
Thanks for the advice, but that didn't change the result. I tried the possible combinations of values of these two parameters, I always get this error 13.

I just checked /var/log/syslog and got the following

Code: Select all

Oct 18 21:17:09 raspi_2 kernel: [31052.648176] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
Oct 18 21:17:09 raspi_2 kernel: [31052.648226] CIFS VFS: Send error in SessSetup = -13
Oct 18 21:17:09 raspi_2 kernel: [31052.648653] CIFS VFS: cifs_mount failed w/return code = -13
Maybe that helps...?

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Automount of SMB share not working

Wed Oct 19, 2016 11:15 am

Given that the mount works from the command line, as a work around rather than a fix, you could remove/comment out the entry in fstab and add your manual mount command to /etc/rc.local

Before doing the above trying

Code: Select all

sudo mount /mnt/owncloudTemp
might give some additional information.
Arguing with strangers on the internet since 1993.

ullusparvus
Posts: 4
Joined: Mon Oct 17, 2016 3:11 pm

Re: Automount of SMB share not working

Thu Oct 20, 2016 9:38 pm

@thagrol
Executing

Code: Select all

sudo mount /mnt/owncloudTemp
results in the same error (mount error(13): Permission denied).
you could remove/comment out the entry in fstab and add your manual mount command to /etc/rc.local
After doing this and rebooting, I checked /var/log/syslog and it stated

Code: Select all

Oct 20 22:11:22 raspi_2 systemd[1]: Mounting /mnt/owncloudTemp...
(...........)
Oct 20 22:11:22 raspi_2 mount[415]: mount error(101): Network is unreachable
Oct 20 22:11:22 raspi_2 mount[415]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Oct 20 22:11:22 raspi_2 kernel: [    8.863277] CIFS VFS: Error connecting to socket. Aborting operation.
Oct 20 22:11:22 raspi_2 kernel: [    8.864223] CIFS VFS: cifs_mount failed w/return code = -101
Oct 20 22:11:22 raspi_2 systemd[1]: mnt-owncloudTemp.mount mount process exited, code=exited status=32
Oct 20 22:11:22 raspi_2 systemd[1]: Failed to mount /mnt/owncloudTemp.
Oct 20 22:11:22 raspi_2 systemd[1]: Dependency failed for Remote File Systems.
Oct 20 22:11:22 raspi_2 systemd[1]: Unit mnt-owncloudTemp.mount entered failed state.
Obviously Raspbian tried to mount the share before a valid network connection could be established.
So I googled for a solution and stumbled over the "post-up" option, which should allow me to execute scripts after a network interface was brought ab. So I did like described here http://www.cyberciti.biz/tips/how-do-i- ... gs-up.html
I put a script with the mount-instruction in /etc/network/if-up.d/ and prepared my /etc/network/interfaces, which now looks like this

Code: Select all

  GNU nano 2.2.6                                                     File: /etc/network/interfaces                                                                                                                  

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual
    post-up /etc/network/if-up.d/mountsmb

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
To the /etc/network/if-up.d/mountsmb I also added a line which just adds a comment to a logfile in order to see whether the script has been started.
The funny thing is, when I do a

Code: Select all

sudo service networking restart
the script is executed and the smb share is successfully mounted. When I reboot my raspi, then I see in the above mentioned log that the script is executed (the comment is written to the log file), but the share has not been mounted :?

Any ideas to that?

Return to “Troubleshooting”