Issues mounting smb share at boot time using fstab with openSuse 13.1 (also experienced with 12.3)

Hi all,

I’m getting stuck with setting up automount for samba share at boot time.

I’ve set the things up in the Linux Mint and it started to work after adding _netdev to the list of options. But the same fstab configuration haven’t done the job in the openSuse 12.3. The things also haven’t changed after upgrading to 13.1.

Here are some of the symptoms:

  • during boot there is an error log entry
  • after boot the user isn’t able to mount the share (despite using the users option): setting uid flag on mount.cifs hasn’t helped also (the last only tried under openSuse 12.3)
  • for mounting the share I’m forced to execute sudo mount **/media/readyshare
    Here is the appropriate line of /etc/fstab:
//  /media/readyshare       cifs    guest,_netdev,rw,auto,users,noexec,uid=1000,gid=100,file_mode=0117,dir_mode=007      0 0

Here are the bound lines from the /var/log/messages file:

2014-01-04T14:38:54.525057+01:00 linux-cvew systemd[1]: Started SuSEfirewall2 phase 1.
2014-01-04T14:38:54.525309+01:00 linux-cvew systemd[1]: Starting Network Manager...
2014-01-04T14:38:54.537173+01:00 linux-cvew systemd[1]: Started Network Manager.
2014-01-04T14:38:54.537388+01:00 linux-cvew systemd[1]: Starting Network.
2014-01-04T14:38:54.537606+01:00 linux-cvew systemd[1]: Reached target Network.
2014-01-04T14:38:54.537809+01:00 linux-cvew systemd[1]: Starting Samba NMB Daemon...
2014-01-04T14:38:54.538038+01:00 linux-cvew systemd[1]: Starting SuSEfirewall2 phase 2...
2014-01-04T14:38:54.538232+01:00 linux-cvew systemd[1]: Mounting /media/readyshare...
2014-01-04T14:38:54.538442+01:00 linux-cvew systemd[1]: Starting Host and Network Name Lookups.
2014-01-04T14:38:54.538643+01:00 linux-cvew systemd[1]: Reached target Host and Network Name Lookups.
2014-01-04T14:38:54.538795+01:00 linux-cvew systemd[1]: Starting /etc/init.d/boot.local Compatibility...
2014-01-04T14:38:54.538976+01:00 linux-cvew systemd[1]: Started /etc/init.d/boot.local Compatibility.
2014-01-04T14:38:54.543785+01:00 linux-cvew systemd[1]: PID file /run/samba/ not readable (yet?) after start.
2014-01-04T14:38:54.544944+01:00 linux-cvew systemd[1]: nmb.service never wrote its PID file. Failing.
2014-01-04T14:38:54.545174+01:00 linux-cvew systemd[1]: Failed to start Samba NMB Daemon.
2014-01-04T14:38:54.545480+01:00 linux-cvew systemd[1]: Unit nmb.service entered failed state.
2014-01-04T14:38:54.545715+01:00 linux-cvew systemd[1]: Starting Samba SMB Daemon...
2014-01-04T14:38:54.552820+01:00 linux-cvew SuSEfirewall2: Setting up rules from /etc/sysconfig/SuSEfirewall2 ...
2014-01-04T14:38:54.595769+01:00 linux-cvew SuSEfirewall2: Firewall rules successfully set
2014-01-04T14:38:54.596296+01:00 linux-cvew systemd[1]: Started SuSEfirewall2 phase 2.
2014-01-04T14:38:54.639081+01:00 linux-cvew smbd[817]: [2014/01/04 14:38:54.638779,  0] ../source3/smbd/server.c:1278(main)
2014-01-04T14:38:54.639218+01:00 linux-cvew smbd[817]:   standard input is not a socket, assuming -D option
2014-01-04T14:38:54.639325+01:00 linux-cvew kernel:    10.004150] r8169 0000:05:00.0 enp5s0: link down
2014-01-04T14:38:54.639328+01:00 linux-cvew kernel:    10.004176] r8169 0000:05:00.0 enp5s0: link down
2014-01-04T14:38:54.639329+01:00 linux-cvew kernel:    10.004194] IPv6: ADDRCONF(NETDEV_UP): enp5s0: link is not ready
2014-01-04T14:38:54.639613+01:00 linux-cvew smbd[897]: [2014/01/04 14:38:54.639239,  0] ../lib/util/pidfile.c:117(pidfile_create)
2014-01-04T14:38:54.639906+01:00 linux-cvew smbd[897]:   ERROR: can't open /var/run/samba/ Error was No such file or directory
2014-01-04T14:38:54.640682+01:00 linux-cvew systemd[1]: PID file /run/samba/ not readable (yet?) after start.
2014-01-04T14:38:54.641043+01:00 linux-cvew dbus[708]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service'
2014-01-04T14:38:54.641324+01:00 linux-cvew kernel:    10.006250] FS-Cache: Loaded
2014-01-04T14:38:54.641357+01:00 linux-cvew systemd[1]: Starting Bluetooth service...
2014-01-04T14:38:54.642326+01:00 linux-cvew kernel:    10.007141] FS-Cache: Netfs 'cifs' registered for caching
2014-01-04T14:38:54.642331+01:00 linux-cvew kernel:    10.007165] Key type cifs.spnego registered
2014-01-04T14:38:54.642332+01:00 linux-cvew kernel:    10.007171] Key type cifs.idmap registered
2014-01-04T14:38:54.642884+01:00 linux-cvew systemd[1]: smb.service never wrote its PID file. Failing.
2014-01-04T14:38:54.643063+01:00 linux-cvew systemd[1]: Failed to start Samba SMB Daemon.
2014-01-04T14:38:54.643241+01:00 linux-cvew systemd[1]: Unit smb.service entered failed state.
2014-01-04T14:38:54.643320+01:00 linux-cvew kernel:    10.008376] CIFS VFS: Error connecting to socket. Aborting operation.
2014-01-04T14:38:54.643324+01:00 linux-cvew kernel:    10.008415] CIFS VFS: cifs_mount failed w/return code = -101
2014-01-04T14:38:54.643519+01:00 linux-cvew systemd[1]: media-readyshare.mount mount process exited, code=exited status=32
2014-01-04T14:38:54.643737+01:00 linux-cvew systemd[1]: Failed to mount /media/readyshare.
2014-01-04T14:38:54.643879+01:00 linux-cvew systemd[1]: Dependency failed for Remote File Systems.
2014-01-04T14:38:54.644209+01:00 linux-cvew systemd[1]: Dependency failed for Postfix Mail Transport Agent.
2014-01-04T14:38:54.644816+01:00 linux-cvew systemd[1]: Unit media-readyshare.mount entered failed state.
2014-01-04T14:38:54.644945+01:00 linux-cvew systemd[1]: Starting LSB: VirtualBox Linux Additions kernel modules...
2014-01-04T14:38:54.645087+01:00 linux-cvew systemd[1]: Starting LSB: VirtualBox Linux module...
2014-01-04T14:38:54.645268+01:00 linux-cvew systemd[1]: Starting Trigger Flushing of Journal to Persistent Storage...
2014-01-04T14:38:54.645483+01:00 linux-cvew systemd[1]: Starting Command Scheduler...
2014-01-04T14:38:54.645674+01:00 linux-cvew systemd[1]: Started Command Scheduler.
2014-01-04T14:38:54.645870+01:00 linux-cvew systemd[1]: Started Bluetooth service.
2014-01-04T14:38:54.646151+01:00 linux-cvew bluetoothd[901]: Bluetooth daemon 5.8
2014-01-04T14:38:54.646382+01:00 linux-cvew dbus[708]: [system] Successfully activated service 'org.bluez'
2014-01-04T14:38:54.646594+01:00 linux-cvew /usr/sbin/cron[907]: (CRON) INFO (running with inotify support)
2014-01-04T14:38:54.646910+01:00 linux-cvew mount[806]: mount error(101): Network is unreachable
2014-01-04T14:38:54.647069+01:00 linux-cvew mount[806]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I’ve already started to dive into the secrets of the autofs configuration :slight_smile: and will give it a try soon. But I also would like to find out, what is wrong with the familiar fstab-approach.


Three suggestions:

  1. Mount options this should be enough: guest,_netdev,uid=1000,gid=100 (I can’t remember but maybe also chown the folder readyshare to user/owner in unmounted state, can’t remember, but I don’t think this is key thing)
  2. In Yast → system → runlevels. Set the daemons cifs, nmb and smb to “enabled” (probably already are)
  3. A diagnostic test: after the boot-fstab-mount process has failed, let things settle (30 secs after boot). Then open a terminal, su to root, and run the command “mount -a”. That might load the cifs mount. Report back here whether it does or not? (this is not a fix, just a diagnostic test. I think it will come back as “yes” but let’s see)

After this, if still not works, there is a fix (you might be able to find it here, the after.local trick: Is something delaying the network at boot time?. This might be key thing for openSUSE)

NetworkManager can take long time to actually establish connection. If you rely on it, you need to enable NetworkManager-wait-online.service (systemctl enable NetworkManager-wait-online.service) and set NM_ONLINE_TIMEOUT in /etc/sysconfig/network/config to a value that is large enough to establish connection after NM is started.

Thanks a lot for the suggestions.

These are the results:

  1. I’ve also checked the things with the proposed mount options, but the options seemed to be irrelevant for mounting at boot time
  2. The daemons nmb and smb were already enabled, but nether the cifs nor smbfs daemons were in the list.
  3. Diagnostic test succeeded.
  4. Using /etc/init.d/after.local still haven’t fixed the issue.
  5. In the linked article proposed option with the cron task has done the job.

So that was the needed action:

#crontab -e

and then add a line with text:

@reboot sleep 10;mount -a

so the mount -a command is executed with the delay of 10 seconds after the boot.

I wonder if it will solve the issue on my laptop, where the NetworkManager connects to the WLAN after the master key was entered into the KWallet…

You should have told it from the very beginning.

In this case it is incorrect to attempt to mount any network filesystem on system boot. You should either use automount or configure NetworkManager dispatcher to call mount when connection is established. Saw another thread that explains exactly that just recently (may be in Applications or Networking forums).

Thanks a lot for a suggestion, arvidjaar.

It has also done the job. (With the timeout of 10).
The drawback of the method is, the whole system boot time seems to be increased.
(systemd-analyse blame) has shown, that the NetworkManager-wait-online.service needs 8.493s.

I’ll compare the boot time with the option in crontab, but it seems that the crontab option is a little bit faster at boot.

The solution with the crontab seems to be about 8 seconds faster at boot time.

Looking at the whole boot time (as reported by the systemd-analyse), it doesn’t seems to be relevant, but it is, because this extra delay happens before I’m able to enter a password.

Startup finished in 2.274s (kernel) + 1min 42.089s (userspace) = 1min 44.364s

Anyway thanks a lot for a working solution suggestions. I was simply asking myself, which one would be better for my desktop pc.

Sorry for that. You’ve answered the question, that I would ask after having set up my desktop pc and having found that it doesn’t work for my laptop. :slight_smile:

The only solution for automounting I’ve learned about some years ago, was using fstab. Thats why I’ve tried it that way (firstly with users option and then with the mounting during boot).
Unfortunately using users option wasn’t successfull - it seems not to work on openSuse with smb mounts.

automount is UNIX facility that mounts file system on access, not unconditionally during boot. In Linux it is implemented as special filesystem type “autofs”. Check “man autofs” or Google.

I apologize for coming so late to this party. Somewhere, I came across a simple solution to the problem of automounting a ReadyShare drive using OpenSuse. I wish I could remember where I found this solution so that I could credit the blogger. At the very least, I say thank you to him.

Here are the three steps I have used to Enable* Automount of a ReadyShare Drive* on several computers running OpenSuse13.2.

  1. **Mkdir /media/public

  2. Edit /etc/fstab to add this line:
    //[routerIPaddress]/USB_Storage /media/public cifs guest 0 0

    e.g., ** // /media/public cifs guest 0 0**

  3. **sudo mount -a
    I haven’t installed Leap 42.1 on any of my computers, but I expect this method to work when I do.

Thanks @AltoHombreGordito.

In addition one can set the mount command (mount -a) to run at boot time using cron.

True. However, in this case it is a one time CLI entry to mount the Readyshare drive at that time. Subsequently it automounts on boot, no cron required.