You are not logged in.

#1 2012-09-30 12:12:38

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

[SOLVED] - Cannot automount Samba share from fstab

Hi guys, I successfully got Samba working on my home serv last night but for some reason I cannot seem to automount the share at boot time (native systemd)

/etc/fstab

# kphmsrv /mnt/Files  Samba
//kphmsrv/Files /mnt/Files cifs users,username=kaipee,password={mypassword},workgroup=WORKGROUP,ip=192.168.0.10 0 0

errors.log

Sep 30 14:03:02 zoostorm-arch kernel: [    8.721292] CIFS VFS: Error connecting to socket. Aborting operation
Sep 30 14:03:02 zoostorm-arch kernel: [    8.721956] CIFS VFS: cifs_mount failed w/return code = -101

I thought systemd wouldn't attempt mounting until network was up?

I have removed both noauto (as I did want to automount at boot) and noatime (as I read that it causes issues when mounting at boot)

Linux zoostorm-arch 3.5.4-1-ARCH #1 SMP PREEMPT Sat Sep 15 08:12:04 CEST 2012 x86_64 GNU/Linux

Last edited by kaipee (2012-10-02 18:04:25)

Offline

#2 2012-09-30 12:15:16

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

Once logged in, however, I can successfully mount the share with

mount /mnt/Files

with any user

Offline

#3 2012-09-30 12:36:45

elp
Member
Registered: 2007-04-10
Posts: 27

Re: [SOLVED] - Cannot automount Samba share from fstab

My look something like this:

//192.168.0.2/big_drive /media/ArchSamba cifs auto,owner,rw,username=magnus,password=*****blabla 0 0

Offline

#4 2012-09-30 14:41:34

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

OK so I think I have narrowed it down to the network not being connected.

My current /etc/fstab

# kphmsrv /mnt/Files  Samba
//kphmsrv/Files /mnt/Files cifs _netdev,users,username=kaipee,password={mypassword},workgroup=WORKGROUP,ip=192.168.0.10 0 0

Booting shows failed for a dependency.
Error log shows:

Sep 30 15:22:28 zoostorm-arch kernel: [ 1023.268131] CIFS VFS: default security mechanism requested.  The default security mechanism will be upgraded from ntlm to ntlmv2 in kernel release 3.3
Sep 30 16:24:39 zoostorm-arch kernel: [   10.125967] CIFS VFS: Error connecting to socket. Aborting operation
Sep 30 16:24:39 zoostorm-arch kernel: [   10.126602] CIFS VFS: cifs_mount failed w/return code = -101

Upon login I can mount the share, however if I disable my wireless connection and try to mount I get:

[kaipee@zoostorm-arch ~]$ mount /mnt/Files
mount error(101): Network is unreachable
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

...and the same error occurs:

Sep 30 15:33:04 zoostorm-arch kernel: [  515.431106] CIFS VFS: default security mechanism requested.  The default security mechanism will be upgraded from ntlm to ntlmv2 in kernel release 3.3
Sep 30 15:33:33 zoostorm-arch kernel: [  544.010324] CIFS VFS: Error connecting to socket. Aborting operation
Sep 30 15:33:33 zoostorm-arch kernel: [  544.010406] CIFS VFS: cifs_mount failed w/return code = -10

So it does indeed look like it won't mount at boot because of no network connection - however I have included the _netdev option and I am using systemd which is supposed to not attempt mounting until network is available ??

Last edited by kaipee (2012-09-30 14:42:46)

Offline

#5 2012-09-30 15:23:58

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

I just don't get what is happening here. I have updated my /etc/fstab to read:

//192.168.0.10/Files /mnt/Files cifs x-systemd.device-timeout=60s,users,username=kaipee,password={mypassword},workgroup=WORKGROUP,ip=192.168.0.10 0 0

...forcing systemd to wait for at least 60 seconds to mount the share. My machine boots and logs in with a working connection in about 15 seconds after initial loading.

https://lh4.googleusercontent.com/-DOTi … 0409_6.jpg

Yet it still complains that the network is not available and is clearly ignoring the options about timeout and _netdev ??!

[kaipee@zoostorm-arch ~]$ systemctl status mnt-Files.mount
mnt-Files.mount - /mnt/Files
	  Loaded: loaded (/etc/fstab)
	  Active: failed (Result: exit-code) since Sun, 30 Sep 2012 17:06:44 +0100
	   Where: /mnt/Files
	    What: //192.168.0.10/Files
	 Process: 385 ExecMount=/bin/mount //192.168.0.10/Files /mnt/Files -t cifs -o x-systemd.device-timeout=60s,users,username=kaipee,password=P@ss,workgroup=WORKGROUP,ip=192.168.0.10 (code=exited, status=32)
	  CGroup: name=systemd:/system/mnt-Files.mount

Sep 30 17:06:44 zoostorm-arch mount[385]: mount error(101): Network is unreachable
Sep 30 17:06:44 zoostorm-arch mount[385]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Sep 30 17:06:44 zoostorm-arch systemd[1]: Failed to mount /mnt/Files.

Moderator edit: The image is too big. Reduced to url.

Last edited by bernarcher (2012-09-30 15:29:43)

Offline

#6 2012-09-30 16:01:49

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,097
Website

Re: [SOLVED] - Cannot automount Samba share from fstab

_netdev only works if you have proper activation of network.target. How are you establishing a network connection?

Alternatively, just use an automounter on the share and let it be mounted on first access -- add noauto,x-systemd.automount to the options.

Offline

#7 2012-09-30 18:11:13

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

Hi falconindy,

I'm connecting to a wireless network with WPA2 (WUSBN v2) using the NetworkManager service. How do I configure/check this network.target?

Offline

#8 2012-09-30 18:48:01

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,097
Website

Re: [SOLVED] - Cannot automount Samba share from fstab

NetworkManager-wait-online.service should activate network.target. You're still better off using an automount unit.

Offline

#9 2012-09-30 22:12:56

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

How does the automount unit work?
I have a few applications and services that use the samba share/mount so kind of want it always mounted.

Offline

#10 2012-09-30 23:20:56

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,097
Website

Re: [SOLVED] - Cannot automount Samba share from fstab

Automount means its... mounted automatically on first access.

Offline

#11 2012-10-01 12:26:45

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

I was leaning more towards are there any benefits of this over mounting at boot?
Is it configured for every user automatically? Is it mounted by user or root?

Why is an automount unit better than automatically mounting during boot?

Offline

#12 2012-10-01 17:22:30

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,097
Website

Re: [SOLVED] - Cannot automount Samba share from fstab

kaipee wrote:

I was leaning more towards are there any benefits of this over mounting at boot?

Sure. You don't have to worry about when the network comes up.

kaipee wrote:

Is it configured for every user automatically? Is it mounted by user or root?

It's mounted by root according to the options in fstab. It's exactly the same as if you were insisting it mount on boot.

kaipee wrote:

Why is an automount unit better than automatically mounting during boot?

Boot won't explicitly hang waiting for this to mount -- only for the automount to be initialized on the mountpoint.

Offline

#13 2012-10-01 19:55:43

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

But I kind of want boot to hang - at least until the network comes up and continues to mount the share

Offline

#14 2012-10-01 19:59:40

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

...does the automount launch a 'daemon' of sorts, running in the background and waiting for a working network connection before initializing the mount? Allowing the rest of the system to function normally, and mounting the share as soon as a valid connection is confirmed?

Offline

#15 2012-10-01 20:59:22

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,097
Website

Re: [SOLVED] - Cannot automount Samba share from fstab

Again, it mounts on first access by you (or will just fail if the endpoint is unreachable). I suggest trying this and seeing how it works before asking the same question again.

Offline

#16 2012-10-02 18:04:00

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

Working /etc/fstab entry:

//192.168.0.10/Files /mnt/Files cifs auto,x-systemd.automount,cache=none,rsize=130048,wsize=57344,users,username=kaipee,password={mypassword},workgroup=WORKGROUP,ip=192.168.0.10 0 0

Last edited by kaipee (2012-10-02 18:04:10)

Offline

#17 2012-10-03 22:00:22

madchine
Member
From: Denmark
Registered: 2009-11-04
Posts: 62
Website

Re: [SOLVED] - Cannot automount Samba share from fstab

I  gotta admit I was dead set against the automount solution when I read the suggestion but it works beautifully. Hardly any lag at all on first time access and no hanging issues (so far). Thanks, falconindy.

EDIT: Spoke too soon. This thread is marked solved, so I won't bring up my issues here. Started a new thread instead. Apologies for the mess.

Last edited by madchine (2012-10-03 22:33:59)

Offline

#18 2012-10-04 19:55:44

kaipee
Member
From: Belfast, UK
Registered: 2012-07-07
Posts: 202

Re: [SOLVED] - Cannot automount Samba share from fstab

@falconindy can you give me a hand with the automount option? https://bbs.archlinux.org/viewtopic.php?id=150030

Offline

Board footer

Powered by FluxBB