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
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)
If the autofs settings are not the issue, have you tried checking the difference between auto and manual mounting in /proc/mounts.
]]>sudo mount -t nfs4 192.168.0.10:/ /mnt/Files
/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?!
]]>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 ?
]]>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?
]]>Are you switched to native systemd
Yes.
and using NetworkManager.service?
No, netcfg.
]]>