User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 1:18 pm

Hi,

Having run several Raspbian Wheezy systems with a cifs mount in the /etc/fstab,

Code: Select all

//192.168.14.23/someuser /home/someuser cifs _netdev,credentials=/etc/cifs-credentials/someuser 0 0
I recently upgraded them to Raspbian Jessie using a clean SD card image. While the home directory in the /etc/fstab mounts correctly using

Code: Select all

sudo mount -a
it does not mount when the Raspberry Pi 2 boots. The problem is that the cifs mount does not wait for eth0 to be assigned an IP. Looking in /var/log/syslog,

Code: Select all

Oct 30 12:26:38 raspberrypi systemd[1]: Started dhcpcd on all interfaces.
Oct 30 12:26:38 raspberrypi systemd[1]: Starting Network.
Oct 30 12:26:38 raspberrypi systemd[1]: Reached target Network.
Oct 30 12:26:38 raspberrypi systemd[1]: Starting OpenBSD Secure Shell server...
Oct 30 12:26:38 raspberrypi systemd[1]: Started OpenBSD Secure Shell server.
Oct 30 12:26:38 raspberrypi systemd[1]: Starting /etc/rc.local Compatibility...
Oct 30 12:26:38 raspberrypi systemd[1]: Starting Network is Online.
Oct 30 12:26:38 raspberrypi systemd[1]: Reached target Network is Online.
Oct 30 12:26:38 raspberrypi systemd[1]: Mounting /home/someuser...
...
Oct 30 12:26:39 raspberrypi kernel: [    9.041565] CIFS VFS: Error connecting to socket. Aborting operation.
Oct 30 12:26:39 raspberrypi kernel: [    9.041984] CIFS VFS: cifs_mount failed w/return code = -101
Oct 30 12:26:39 raspberrypi ifplugd(eth0)[221]: client: mount error(101): Network is unreachable
Oct 30 12:26:39 raspberrypi ifplugd(eth0)[221]: client: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Oct 30 12:26:39 raspberrypi ifplugd(eth0)[221]: client: mount error(101): Network is unreachable
Oct 30 12:26:39 raspberrypi kernel: [    9.073856] CIFS VFS: Error connecting to socket. Aborting operation.
Oct 30 12:26:39 raspberrypi kernel: [    9.080839] CIFS VFS: cifs_mount failed w/return code = -101
Oct 30 12:26:39 raspberrypi ifplugd(eth0)[221]: client: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Oct 30 12:26:39 raspberrypi systemd[1]: Started Update UTMP about System Runlevel Changes.
Oct 30 12:26:39 raspberrypi systemd[1]: Startup finished in 2.313s (kernel) + 6.572s (userspace) = 8.886s.
Oct 30 12:26:39 raspberrypi dhcpcd[314]: eth0: rebinding lease of 192.168.0.23
Oct 30 12:26:39 raspberrypi dhcpcd[314]: eth0: soliciting an IPv6 router
Looking at the log, the link comes up and systemd decides that all is well and good, but the dhcp service has not finished its work! All seems to be correctly configured downstream:

Code: Select all

pi@raspberrypi ~ $ systemctl list-dependencies remote-fs.target
remote-fs.target
● ├─home-someuser.mount
● └─remote-fs-pre.target

Code: Select all

pi@raspberrypi ~ $ systemctl show -p Wants -p After home-someuser.mount 
Wants=network-online.target system.slice
After=systemd-journald.socket remote-fs-pre.target network.target network-online.target system.slice -.mount
The problem is that network-online.target just means that eth0 has come up, which means that any network file system mount in /etc/fstab is likely to fail. Not sure how to fix this...yet.

Regards,

Will

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 2:04 pm

The hack described at:
http://unix.stackexchange.com/questions ... ot-working
is not going to work, since

Code: Select all

pi@raspberrypi ~ $ ifquery --list
lo
(while eth0 is listed as expected in /etc/network/interfaces and via ifconfig)

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 3:59 pm

Try this for your fstab line:

Code: Select all

//192.168.14.23/someuser /home/someuser cifs credentials=/etc/cifs-credentials/someuser,noauto,x-systemd.automount 0 0

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 4:11 pm

JimmyN wrote:Try this for your fstab line:

Code: Select all

//192.168.14.23/someuser /home/someuser cifs credentials=/etc/cifs-credentials/someuser,noauto,x-systemd.automount 0 0
Hi Jimmy,

Your suggestion also fails several times and then the dhcp operation completes afterwards.

Best regards,

Will

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 4:21 pm

That's strange it works for me on two different RPi's running Jessie and mounting cifs shares from both an NAS and Windows 7 shared folders. What does your fstab line look like now, did you make any changes anywhere else?

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 4:34 pm

JimmyN wrote:That's strange it works for me on two different RPi's running Jessie and mounting cifs shares from both an NAS and Windows 7 shared folders. What does your fstab line look like now, did you make any changes anywhere else?
Hi Jimmy,

No other changes to the /etc/fstab file were made. It has local file systems apart from the /home/someuser line, which presently looks exactly the same as your line.

With or without _netdev, systemctl realises that the mount requires network-online.target. The problem is that network-online.target implies that the interface is up, but says nothing about the state of the dhcp request. For reference, my NAS is a FreeNAS running on reasonably fast equipment with nothing else connected, the network connection from the Raspberry Pi 2 to the DHCP server is all over copper and the network loading is ~0. The problem appears to be in the network-online.target on Raspbian Jessie.

Best regards,

Will

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 5:03 pm

I think _netdev only applies if you're mounting NFS shares, either way you don't need it.

I am also mounting shares from a FreeNAS box and this is the line I use. You're using a credentials file, so there is no security risk in posting your actual fstab line.

Code: Select all

//192.168.0.98/NetworkFolder /home/jimmy/network-folder cifs credentials=/home/jimmy/.smbcredentials,uid=jimmy,gid=jimmy,noauto,x-systemd.automount 0 0
I don't think the share is actually mounted until the first access. After a reboot to test fstab, try the command "mount" (no -a) and see if it's mounted.

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 10:33 pm

Hi Jimmy,

The Raspberry Pi is set up to boot straight into the someuser account. Since the mount fails, the someuser account does not have the correct home directory. I have reverted back to Raspbian Wheezy for now, which works correctly with my original /etc/fstab file. I will try to continue to debug the Raspbian Jessie installation next week.

Best regards,

Will

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Fri Oct 30, 2015 10:43 pm

There are some more hints about a more complete solution at:
http://www.freedesktop.org/wiki/Softwar ... orkTarget/

wifsimster
Posts: 2
Joined: Thu Oct 16, 2014 8:27 pm
Location: France

Re: Raspbian Jessie: cifs failing at boot

Sun Nov 29, 2015 5:07 pm

The option x-systemd.automount made the trick for me :

Code: Select all

//192.168.0.x /home/user cifs x-systemd.automount 0 0

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Sun Dec 13, 2015 8:52 pm

Hi,

The latest raspi-config contains an optional script in it to create another service that pauses the boot until the dhcp has completed. Having used raspi-config to pause the boot until the dhcp has completed, my original /etc/fstab file works without further modifications.

Best regards,

Will

johncoxon
Posts: 2
Joined: Sun Jan 24, 2016 11:13 pm

Re: Raspbian Jessie: cifs failing at boot

Sun Jan 24, 2016 11:15 pm

I just updated my

Code: Select all

raspi-config
with

Code: Select all

apt-get
and I can't find a script which pauses boot until dhcp is configured, can you give me any insights into how to get that working? Would love my cifs drives to automatically mount at boot!

DirkS
Posts: 9872
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Jessie: cifs failing at boot

Mon Jan 25, 2016 9:56 am

johncoxon wrote:and I can't find a script which pauses boot until dhcp is configured, can you give me any insights into how to get that working? Would love my cifs drives to automatically mount at boot!
I think you're supposed to run

Code: Select all

sudo raspi-config
and select 'wait for network at boot'

johncoxon
Posts: 2
Joined: Sun Jan 24, 2016 11:13 pm

Re: Raspbian Jessie: cifs failing at boot

Mon Jan 25, 2016 10:27 am

I didn't see that option when I tried; do I need to upgrade from Wheezy to Jessie to be able to see it?

DirkS
Posts: 9872
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspbian Jessie: cifs failing at boot

Mon Jan 25, 2016 10:36 am

johncoxon wrote:I didn't see that option when I tried; do I need to upgrade from Wheezy to Jessie to be able to see it?
So you're running Wheezy... you should have started a new topic since this is about Jessie.
That option is not available in Wheezy

User avatar
williamhbell
Posts: 291
Joined: Mon Dec 26, 2011 5:13 pm
Contact: Website Twitter

Re: Raspbian Jessie: cifs failing at boot

Sat Feb 13, 2016 10:21 am

Wheezy normally waits long enough for the network to come up, such that a home disk can be attached by a NFS mount or similar. The problem reported in this thread was only observed when using Jessie. Using Jessie, one needs to

Code: Select all

sudo raspi-config
4 Wait for Network at Boot
Slow Wait for network connection before completing boot
Ok
Finish
and then reboot.

sendtojoao
Posts: 2
Joined: Fri Feb 19, 2016 2:05 am

Re: Raspbian Jessie: cifs failing at boot

Fri Feb 19, 2016 2:10 am

Guys,

Sorry my english, but just try to put a static address on eth0.

rozpruwacz
Posts: 1
Joined: Sun May 08, 2016 12:01 pm

Re: Raspbian Jessie: cifs failing at boot

Sat Nov 26, 2016 11:22 am

hey,

for me the x-systemd.automount also worked. during boot the mount still fails, but first process (in my case it is kodi) that want to access this mount triggers systemd to mount it and then it success.

oricot
Posts: 1
Joined: Sat Jan 19, 2019 11:13 am

Re: Raspbian Jessie: cifs failing at boot

Sat Jan 19, 2019 11:16 am

JimmyN wrote:
Fri Oct 30, 2015 3:59 pm
Try this for your fstab line:

Code: Select all

//192.168.14.23/someuser /home/someuser cifs credentials=/etc/cifs-credentials/someuser,noauto,x-systemd.automount 0 0
Thank you!

x-systemd.automount fix my 'CIFS VFS: cifs_mount failed w/return code = -101' problem in fstab on boot

Olivier

Return to “Troubleshooting”