You are not logged in.

#1 2012-10-03 22:38:49

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

[SOLVED - kludge/hack] Confused with autofs and NFS

I have had a good read through the wiki and tried some autofs configs but I cannot seem to get what I want to work.
I have an NFS server ( 192.168.0.10 ) with an exported directory ( /mnt/Files ) that I would like to automount on my local machine under /mnt/Files and to be mountable by any user

I have edited /etc/autofs/auto.master to look like this:

# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).

#/media /etc/autofs/auto.media

/mnt    /etc/autofs/auto.mnt    --timeout=60 --ghost
/media  /etc/autofs/auto.media  --timeout=5 --ghost

and have created the /etc/autofs/auto.mnt file - but  do not know how to configure it for my NFS setup

I have tried the way mentioned in the wiki (which needs updated to reflect systemd) , by putting

# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).

#/media /etc/autofs/auto.media

/mnt   -hosts    --timeout=60 --ghost
/media  /etc/autofs/auto.media  --timeout=5 --ghost

but this mounts my NFS share using root (meaning I can't access) and mounts it as /mnt/kphmsrv/mnt/Files  instead of /mnt/Files.

Can anybody help, what am I not seeing?

Last edited by kaipee (2013-05-18 17:22:09)

Offline

#2 2012-10-04 20:28:45

Roukoswarf
Member
From: Ontario, Canada
Registered: 2012-10-04
Posts: 8
Website

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Offline

#3 2012-10-04 20:36:38

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,838

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

If you're using systemd, forget about autofs and use systemd's automount instead. Details in the man and wiki pages.

Offline

#4 2012-10-06 12:04:46

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

@tomk I don't get it, I keep getting told different things. Someone else said to forget about fstab and use autofs??

All I want is to mount an NFS share, at boot, by any user, with full rw (as on the server) on a native systemd setup. I can't seem to get a straight answer that actually works

Offline

#5 2012-10-06 12:09:19

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,838

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Nothing special required then - specify it in /etc/fstab as you have always done, then boot your system. Both autofs and systemd's automount functionality provide automounting on demand, which we now know is not your requirement.

Offline

#6 2012-10-06 12:14:46

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

But /etc/fstab doesn't work.
Apparently there are some issues with fstab and systemd when using wireless connection.

192.168.0.10:/ /mnt/Files nfs4 auto,x-systemd.automount,users,bg,hard,async,intr,rsize=81920,wsize=81920,clientaddr=192.168.0.2 0 0

I can use that to mount /mnt/Files once logged in, but not at boot. Also with NFS the boot can hang if the share is not available so I was advised to use the automount units as they will mount automatically upon first access

Offline

#7 2012-10-06 12:50:10

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

For my current autofs setup I have the following (which mounts as root):

/etc/autofs/auto.master

# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).

#/media /etc/autofs/auto.media

/-      /etc/autofs/auto.mnt    --timeout=60 --ghost
/media/misc     /etc/autofs/auto.misc   --timeout=5 --ghost

/etc/autofs/auto.mnt

/mnt/Files      -fstype=nfs,gid=users     ://192.168.0.10:/mnt/Files
#/mnt/CIFS/Files -fstype=cifs,users,username=kaipee,password={password} ://192.168.0.10/mnt/Files

When I manually start the autofs.service my auto.mnt unit does mount in the correct format I want (/mnt/Files) but mounts as root meaning I cannot access anything (even though I expressly added the gid=users option):

[kaipee@zoostorm-arch ~]$ ls -al /mnt/
total 24
drwxr-xr-x  6 root   root  4096 Oct  4 00:04 .
drwxr-xr-x 21 root   root  4096 Oct  5 18:50 ..
drwxr-xr-x  2 kaipee http  4096 Sep 30 16:24 Files
[kaipee@zoostorm-arch ~]$ sudo systemctl start autofs.service
[kaipee@zoostorm-arch ~]$ ls -al /mnt/
total 20
drwxr-xr-x  6 root   root  4096 Oct  4 00:04 .
drwxr-xr-x 21 root   root  4096 Oct  5 18:50 ..
drwxr-xr-x  2 root   root     0 Oct  6 13:37 Files
[kaipee@zoostorm-arch ~]$ 

Also I cannot list anything in the directory once mounted (even as root):

[kaipee@zoostorm-arch ~]$ sudo ls -al /mnt/Files
ls: cannot open directory /mnt/Files: No such file or directory

EDIT: just to confirm that it does mount when manually connecting to NFS:

[kaipee@zoostorm-arch ~]$ sudo systemctl stop autofs.service
[kaipee@zoostorm-arch ~]$ sudo mount -t nfs4 192.168.0.10:/ /mnt/Files
[kaipee@zoostorm-arch ~]$ sudo ls -al /mnt/
total 24
drwxr-xr-x  6 root   root  4096 Oct  4 00:04 .
drwxr-xr-x 21 root   root  4096 Oct  5 18:50 ..
dr-xr-xr-x  2 root   root  4096 Oct  6 13:52 CIFS
drwxrwx--- 19 http   http  4096 Sep 28 17:55 Files
drwxrwx---  5 kaipee users 4096 Jul 24 21:12 Files_Local
drwxrwxr-x  2 root   users 4096 Sep 24 17:17 sshfs
[kaipee@zoostorm-arch ~]$ sudo ls -al /mnt/Files
total 96
drwxrwx---  19 http http  4096 Sep 28 17:55 .
drwxr-xr-x   6 root root  4096 Oct  4 00:04 ..
drwxrwx---   8 http http  4096 Sep 30 04:36 Backups
drwxrwx---   8 http http  4096 Sep  8 16:03 Design Resources
drwxrwx---  11 http http  4096 Jul 22 14:19 Documents
drwxrwx---   6 http http  4096 Oct  5 19:08 Downloads
drwxrwx---   4 http http  4096 Jul 13 03:29 Games
drwxrwx---   9 http http  4096 Jul 13 14:48 Images
drwxrwx---   2 http http 16384 Jul 13 01:57 lost+found
drwxrwx--- 166 http http 12288 Sep 30 13:44 Music
drwxrwx---   4 http http  4096 Jul 13 03:48 OS
drwxrwx---   5 http http  4096 Oct  2 12:35 owncloud
drwxrwx---   2 http http  4096 Jul 13 22:58 Playlists
drwxrwx---   2 http http  4096 Jul 13 19:58 Podcasts
drwxrwx---  17 http http  4096 Jul 29 17:28 Projects
drwxrwx---   6 http http  4096 Sep  6 18:09 Software
drwxrwx---   5 http http  4096 Sep  8 22:48 .Trash-1000
drwxrwx---   8 http http  4096 Sep 28 17:56 Videos
drwxrwx---   2 http http  4096 Jul 13 13:53 Websites
[kaipee@zoostorm-arch ~]$

Last edited by kaipee (2012-10-06 12:57:58)

Offline

#8 2012-10-06 13:02:30

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,838

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

kaipee wrote:

But /etc/fstab doesn't work.
Apparently there are some issues with fstab and systemd when using wireless connection.

Works fine here over wifi, wiith this fstab entry:

server:/			/mnt/media			nfs4	tcp,rsize=32768,wsize=32768,rw,user,hard,intr	0	0

What are the apparent issues with nfs over wifi?

Offline

#9 2012-10-06 13:08:09

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

using systemd it doesn't wait for the network connection to become active.
Are you switched to native systemd and using NetworkManager.service?

Offline

#10 2012-10-06 13:10:44

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Although it may have something to do with my other issue of constant disconnects (perhaps is disconnected at point of attempting mount?)
https://bbs.archlinux.org/viewtopic.php?id=149964

Offline

#11 2012-10-06 22:10:03

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,838

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

kaipee wrote:

Are you switched to native systemd

Yes.

kaipee wrote:

and using NetworkManager.service?

No, netcfg.

Offline

#12 2012-10-20 12:33:28

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Due to my ongoing issues with constantly disconnecting wireless connection under systemd, I am now connected via ethernet (using NetworkManager)

Testing tomk's fstab entry I now actually can see an attempt to mount at boot, however it hangs and fails.
Here is my everything.log;

Oct 20 14:23:19 localhost systemd[1]: Started NFS server.
Oct 20 14:23:19 localhost systemd[1]: Starting NFS Mount Daemon...
Oct 20 14:23:19 localhost systemd[1]: Starting NFSv4 ID-name mapping daemon...
Oct 20 14:23:19 localhost rpc.mountd[420]: Version 1.2.6 starting
Oct 20 14:23:19 localhost systemd[1]: Started NFS Mount Daemon.
Oct 20 14:23:19 localhost rpc.idmapd[419]: libnfsidmap: using domain: kphmsrv
Oct 20 14:23:19 localhost rpc.idmapd[419]: libnfsidmap: Realms list: 'KPHMSRV'
Oct 20 14:23:19 localhost rpc.idmapd[419]: libnfsidmap: processing 'Method' list
Oct 20 14:23:19 localhost rpc.idmapd[419]: rpc.idmapd: libnfsidmap: using domain: kphmsrv
Oct 20 14:23:19 localhost rpc.idmapd[419]: rpc.idmapd: libnfsidmap: Realms list: 'KPHMSRV'
Oct 20 14:23:19 localhost rpc.idmapd[419]: rpc.idmapd: libnfsidmap: processing 'Method' list
Oct 20 14:23:19 localhost rpc.idmapd[419]: libnfsidmap: loaded plugin /usr/lib/libnfsidmap/nsswitch.so for method nsswitch
Oct 20 14:23:19 localhost rpc.idmapd[421]: Expiration time is 600 seconds.
Oct 20 14:23:19 localhost rpc.idmapd[421]: Opened /proc/net/rpc/nfs4.nametoid/channel
Oct 20 14:23:19 localhost rpc.idmapd[421]: Opened /proc/net/rpc/nfs4.idtoname/channel
Oct 20 14:23:19 localhost rpc.idmapd[419]: rpc.idmapd: libnfsidmap: loaded plugin /usr/lib/libnfsidmap/nsswitch.so for method nsswitch
Oct 20 14:23:19 localhost systemd[1]: Started NFSv4 ID-name mapping daemon.
Oct 20 14:23:19 localhost systemd[1]: Starting Remote File Systems (Pre).
Oct 20 14:23:19 localhost systemd[1]: Reached target Remote File Systems (Pre).
Oct 20 14:23:19 localhost systemd[1]: Mounting /mnt/Files...
Oct 20 14:23:20 localhost rpc.idmapd[421]: New client: 0
Oct 20 14:23:20 localhost kernel: [    9.950444] NFS: Registering the id_resolver key type
Oct 20 14:23:20 localhost kernel: [    9.950453] Key type id_resolver registered
Oct 20 14:23:20 localhost kernel: [    9.950454] Key type id_legacy registered
Oct 20 14:23:20 localhost NetworkManager[373]: <info> (eth0): carrier now ON (device state 20)
Oct 20 14:23:20 localhost kernel: [   10.419155] r8169 0000:03:00.0: eth0: link up
Oct 20 14:23:20 localhost kernel: [   10.419162] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Oct 20 14:23:20 localhost NetworkManager[373]: <info> (eth0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Auto-activating connection 'Wired connection 1'.
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) starting connection 'Wired connection 1'
Oct 20 14:23:20 localhost NetworkManager[373]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Oct 20 14:23:20 localhost NetworkManager[373]: <info> (eth0): device state change: prepare -> config (reason 'none') [40 50 0]
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Oct 20 14:23:20 localhost NetworkManager[373]: <info> (eth0): device state change: config -> ip-config (reason 'none') [50 70 0]
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Configure Commit) scheduled...
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
Oct 20 14:23:20 localhost NetworkManager[373]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) started...
Oct 20 14:23:20 localhost avahi-daemon[371]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.0.2.
Oct 20 14:23:20 localhost avahi-daemon[371]: New relevant interface eth0.IPv4 for mDNS.
Oct 20 14:23:20 localhost avahi-daemon[371]: Registering new address record for 192.168.0.2 on eth0.IPv4.
Oct 20 14:23:21 localhost NetworkManager[373]: <info> (eth0): device state change: ip-config -> activated (reason 'none') [70 100 0]
Oct 20 14:23:21 localhost NetworkManager[373]: <info> Policy set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS.
Oct 20 14:23:21 localhost NetworkManager[373]: <info> Activation (eth0) successful, device activated.
Oct 20 14:23:21 localhost NetworkManager[373]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) complete.

As you can see NFS clearly attempts to connect before the network is up. I thought systemd natively didn't attempt to mount network shares until after network was configured?

Offline

#13 2012-10-20 13:26:06

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Now using netcfg profile home-eth

CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.0.2'
#ROUTES=('192.168.0.0/24 via 192.168.0.1')
GATEWAY='192.168.0.1'
DNS=('192.168.0.1' '8.8.8.8')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'

enabling netcfg@home-eth.service and fstab entry:

192.168.0.10:/ /mnt/Files nfs4 tcp,rsize=32768,wsize=32768,rw,user,hard,intr    0       0

...it still fails to mount.

everything.log shows:

Oct 20 15:05:41 localhost avahi-daemon[357]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.0.2.
Oct 20 15:05:41 localhost avahi-daemon[357]: New relevant interface eth0.IPv4 for mDNS.
Oct 20 15:05:41 localhost avahi-daemon[357]: Registering new address record for 192.168.0.2 on eth0.IPv4.
Oct 20 15:05:41 localhost netcfg[358]: :: home-eth up [done]
Oct 20 15:05:41 localhost systemd[1]: Started Netcfg networking service for profile home-eth.
Oct 20 15:05:41 localhost systemd[1]: Starting Network.
Oct 20 15:05:41 localhost systemd[1]: Reached target Network.
Oct 20 15:05:41 localhost systemd[1]: Starting RPC Bind...
Oct 20 15:05:41 localhost systemd[1]: Starting Network Time Service...
Oct 20 15:05:41 localhost systemd[1]: Starting Samba SMB/CIFS server...
Oct 20 15:05:41 localhost systemd[1]: Started Samba SMB/CIFS server.
Oct 20 15:05:41 localhost systemd[1]: Starting Samba NetBIOS name server...
Oct 20 15:05:41 localhost systemd[1]: Started Samba NetBIOS name server.
Oct 20 15:05:41 localhost systemd[1]: Started RPC Bind.
Oct 20 15:05:41 localhost systemd[1]: Starting RPC Port Mapper.
Oct 20 15:05:41 localhost systemd[1]: Reached target RPC Port Mapper.
Oct 20 15:05:41 localhost systemd[1]: Starting NFS server...
Oct 20 15:05:42 localhost ntpd[428]: ntpd 4.2.6p5@1.2349-o Tue Aug 21 15:06:24 UTC 2012 (1)
Oct 20 15:05:42 localhost ntpd[433]: proto: precision = 0.132 usec
Oct 20 15:05:42 localhost ntpd[433]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Oct 20 15:05:42 localhost ntpd[433]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Oct 20 15:05:42 localhost ntpd[433]: Listen and drop on 1 v6wildcard :: UDP 123
Oct 20 15:05:42 localhost ntpd[433]: Listen normally on 2 lo 127.0.0.1 UDP 123
Oct 20 15:05:42 localhost ntpd[433]: Listen normally on 3 eth0 192.168.0.2 UDP 123
Oct 20 15:05:42 localhost ntpd[433]: Listen normally on 4 lo ::1 UDP 123
Oct 20 15:05:42 localhost ntpd[433]: peers refreshed
Oct 20 15:05:42 localhost ntpd[433]: Listening on routing socket on fd #21 for interface updates
Oct 20 15:05:42 localhost systemd[1]: Started Network Time Service.
Oct 20 15:05:42 localhost kernel: [   10.422894] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Oct 20 15:05:42 localhost kernel: [   10.434090] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
Oct 20 15:05:42 localhost kernel: [   10.675298] NFSD: starting 90-second grace period
Oct 20 15:05:43 localhost systemd[1]: Started NFS server.
Oct 20 15:05:43 localhost systemd[1]: Starting NFS Mount Daemon...
Oct 20 15:05:43 localhost systemd[1]: Starting NFSv4 ID-name mapping daemon...
Oct 20 15:05:43 localhost rpc.mountd[457]: Version 1.2.6 starting
Oct 20 15:05:43 localhost systemd[1]: Started NFS Mount Daemon.
Oct 20 15:05:43 localhost rpc.idmapd[454]: libnfsidmap: using domain: kphmsrv
Oct 20 15:05:43 localhost rpc.idmapd[454]: libnfsidmap: Realms list: 'KPHMSRV'
Oct 20 15:05:43 localhost rpc.idmapd[454]: libnfsidmap: processing 'Method' list
Oct 20 15:05:43 localhost rpc.idmapd[454]: rpc.idmapd: libnfsidmap: using domain: kphmsrv
Oct 20 15:05:43 localhost rpc.idmapd[454]: rpc.idmapd: libnfsidmap: Realms list: 'KPHMSRV'
Oct 20 15:05:43 localhost rpc.idmapd[454]: rpc.idmapd: libnfsidmap: processing 'Method' list
Oct 20 15:05:43 localhost rpc.idmapd[454]: libnfsidmap: loaded plugin /usr/lib/libnfsidmap/nsswitch.so for method nsswitch
Oct 20 15:05:43 localhost rpc.idmapd[454]: rpc.idmapd: libnfsidmap: loaded plugin /usr/lib/libnfsidmap/nsswitch.so for method nsswitch
Oct 20 15:05:43 localhost rpc.idmapd[458]: Expiration time is 600 seconds.
Oct 20 15:05:43 localhost rpc.idmapd[458]: Opened /proc/net/rpc/nfs4.nametoid/channel
Oct 20 15:05:43 localhost rpc.idmapd[458]: Opened /proc/net/rpc/nfs4.idtoname/channel
Oct 20 15:05:43 localhost systemd[1]: Started NFSv4 ID-name mapping daemon.
Oct 20 15:05:43 localhost systemd[1]: Starting Remote File Systems (Pre).
Oct 20 15:05:43 localhost systemd[1]: Reached target Remote File Systems (Pre).
Oct 20 15:05:43 localhost systemd[1]: Mounting /mnt/Files...
Oct 20 15:05:43 localhost rpc.idmapd[458]: New client: 0
Oct 20 15:05:43 localhost rpc.idmapd[458]: Opened /var/lib/nfs/rpc_pipefs/nfs/clnt0/idmap
Oct 20 15:05:43 localhost rpc.idmapd[458]: New client: 1
Oct 20 15:05:43 localhost kernel: [   11.260030] NFS: Registering the id_resolver key type
Oct 20 15:05:43 localhost kernel: [   11.260037] Key type id_resolver registered
Oct 20 15:05:43 localhost kernel: [   11.260038] Key type id_legacy registered
Oct 20 15:05:43 localhost rpc.idmapd[458]: Stale client: 1
Oct 20 15:05:43 localhost rpc.idmapd[458]: 	-> closed /var/lib/nfs/rpc_pipefs/nfs/clnt1/idmap
Oct 20 15:05:43 localhost rpc.idmapd[458]: Stale client: 0
Oct 20 15:05:43 localhost rpc.idmapd[458]: 	-> closed /var/lib/nfs/rpc_pipefs/nfs/clnt0/idmap
Oct 20 15:05:43 localhost mount[459]: mount.nfs4: access denied by server while mounting 192.168.0.10:/
Oct 20 15:05:43 localhost systemd[1]: mnt-Files.mount mount process exited, code=exited status=32
Oct 20 15:05:43 localhost systemd[1]: Failed to mount /mnt/Files.
Oct 20 15:05:43 localhost systemd[1]: Dependency failed for Remote File Systems.
Oct 20 15:05:43 localhost systemd[1]: Job remote-fs.target/start failed with result 'dependency'.
Oct 20 15:05:43 localhost systemd[1]: Unit mnt-Files.mount entered failed state.

The only thing I can see here that may be the issue is that the timestamp of these errors is 15:05 , the actual time (and time held by the NFS server) is 14:05 (14:25 as I type). Obviously this is due to daylight savings only being adjusted after the attempt to mount NFS... ?? correct ?

Offline

#14 2012-10-20 13:47:04

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Adding x-systemd.automount to the fstab entry now allows for a faster boot, but I'm back to the old problem of it mounting incorrectly

/etc/fstab

192.168.0.10:/ /mnt/Files nfs4 x-systemd.automount,tcp,rsize=32768,wsize=32768,rw,user,hard,intr        0       0

(changing user to users has no effect)

incorrectly mounted NFS

[kaipee@zoostorm-arch ~]$ ls -al /mnt/
ls: cannot access /mnt/Files: No such device
total 20
drwxr-xr-x  6 root   root  4096 Oct  4 00:04 .
drwxr-xr-x 21 root   root  4096 Oct  5 18:50 ..
dr-xr-xr-x  2 root   root  4096 Oct  6 13:52 CIFS
d?????????  ? ?      ?        ?            ? Files
drwxrwx---  5 kaipee users 4096 Jul 24 21:12 Files_Local
drwxrwxr-x  2 root   users 4096 Sep 24 17:17 sshfs
[kaipee@zoostorm-arch ~]$ su
Password: 
[root@zoostorm-arch kaipee]# ls -al /mnt/
ls: cannot access /mnt/Files: No such device
total 20
drwxr-xr-x  6 root   root  4096 Oct  4 00:04 .
drwxr-xr-x 21 root   root  4096 Oct  5 18:50 ..
dr-xr-xr-x  2 root   root  4096 Oct  6 13:52 CIFS
d?????????  ? ?      ?        ?            ? Files
drwxrwx---  5 kaipee users 4096 Jul 24 21:12 Files_Local
drwxrwxr-x  2 root   users 4096 Sep 24 17:17 sshfs

I really don't have any idea what is going wrong here. I'm doing everything as I should be?!

Last edited by kaipee (2012-10-20 14:00:39)

Offline

#15 2012-10-20 13:51:56

archbert
Member
Registered: 2010-02-18
Posts: 6

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Have you tried adding _netdev,noauto to your fstab options when using x-systemd.automount?

Offline

#16 2012-10-20 14:00:01

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

@archbert would that make it mount as a usable share by any user?

Offline

#17 2012-10-20 14:07:15

archbert
Member
Registered: 2010-02-18
Posts: 6

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

That's a different setting.  I believe _netdev informs systemd that the mount depends on a network connection (just saw this today).  And, noauto prevents your system from mounting /mnt/Files at boot (x-systemd.automount will handle mounting when you first use /mnt/Files).

Offline

#18 2012-10-20 14:12:49

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Thanks archbert, I have managed to get it to mount at boot - my issue is now that it mounts as some unknown user (even root cannot unmount it)

Offline

#19 2012-10-20 14:51:53

archbert
Member
Registered: 2010-02-18
Posts: 6

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Do the UIDs/GIDs match between your host and clients?

Offline

#20 2012-10-20 16:04:06

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

@archbert probably not, though when I issue the following command after logging in (not using fstab), everything mounts perfectly with the right permissions:

sudo mount -t nfs4 192.168.0.10:/ /mnt/Files

Offline

#21 2012-10-21 14:22:08

archbert
Member
Registered: 2010-02-18
Posts: 6

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

If you still have anything in /etc/autofs/auto.master or /etc/autofs/auto.mnt related to /mnt/Files, you should comment it out (while using systemd's automount for /mnt/Files).  Or, stop/disable autofs, if you're not using it.

If the autofs settings are not the issue, have you tried checking the difference between auto and manual mounting in /proc/mounts.

Offline

#22 2012-11-10 19:22:27

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Apologies for not getting back on this (busy working and studying degree)

So where do I go from here?
What steps do I take to test the correct configuration for systemd to have NFS share automount at boot for all users? (if possible also have it work using NetworkManager and not netcfg)

Offline

#23 2013-05-18 17:21:37

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

Re: [SOLVED - kludge/hack] Confused with autofs and NFS

Found a script here that works flawlessly.

To do this, add a file /etc/NetworkManager/dispatcher.d/nfs.sh (with executable permissions) with the following contents:

#/bin/sh

if [ "$2" = "up" ]
then
	mount "/mnt/media"
elif [ "$2" = "down" ]
then
	umount "/mnt/media"
fi

Offline

Board footer

Powered by FluxBB