You are not logged in.

#1 2012-10-15 22:50:54

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,732
Website

Systemd cannot mount NFS4 shares on client [solved]

I can't get the NFS mounts to mount under systemd whereas they work just fine under sysv on my client box.  I see no errors on the server.

Assuming the server is correct, I suspect my problem is on the client.  I have the nfsd service running and the following in my /etc/fstab:

mars:/media	/mnt/media nfs4	defaults    0 0

The box hangs on boot for several minutes before entering X.  The mount is not present and manually attempting to mount it also leads to hanging.  Oddly enough, I get no errors from systemd itself.  I did find this thread and I do have rpc.idmap.service enabled.

% systemctl list-units | grep rpc
rpc-idmapd.service        loaded active running       NFSv4 ID-name mapping daemon
rpcbind.service           loaded active running       RPC Bind
rpcbind.target            loaded active active        RPC Port Mapper
% systemd-analyze blame          
 89994ms mnt-media.mount
  1728ms systemd-vconsole-setup.service
  1413ms rc-local.service
  1035ms ntpd.service
  1013ms console-kit-log-system-start.service
   997ms systemd-remount-fs.service
   942ms dev-mqueue.mount
   927ms systemd-modules-load.service
   835ms systemd-udevd.service
   640ms tmp.mount
   525ms var-lib-nfs-rpc_pipefs.mount
   486ms systemd-sysctl.service
   394ms systemd-udev-trigger.service
   380ms console-kit-daemon.service
   361ms systemd-logind.service
   343ms nfsd.service
   323ms rpcbind.service
   297ms sys-kernel-debug.mount
   285ms dev-hugepages.mount
    96ms systemd-tmpfiles-setup.service
    79ms home.mount
    67ms boot.mount
    64ms dev-sda3.swap
    54ms rpc-idmapd.service
    49ms udisks.service
     1ms systemd-user-sessions.service

Last edited by graysky (2012-10-16 21:04:49)

Offline

#2 2012-10-16 14:16:07

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,542

Re: Systemd cannot mount NFS4 shares on client [solved]

If you have anything in /etc/rc.conf related to rpcbind or nfs-common or nfs-server you need to put ! in front of it.
If you have the IP address for mars, I would suggest using it instead, but in certain cases won't be any faster (NFS server is down).
Comment it out in /etc/fstab momentarily to check the condition of the NFS server manually.
My diskless client finds NFS fairly quickly, and mounts it (root filesystem).  There is possibly something enabled as a result of it being dependent on NFS for its' root filesystem.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#3 2012-10-16 15:21:59

mangus
Member
From: Bologna, Italy
Registered: 2007-04-07
Posts: 289

Re: Systemd cannot mount NFS4 shares on client [solved]

How do you bring your network up? probably the network is down when  mnt-media.mount tries to do its stuff.
I don't see a dhcpcd service running so I assume you want a static IP. I've become mad myself to simply mount my network shares with a systemd pure system. Never had luck with fstab mounts. The only thing that seems to be working for that is to rely to netcfg for static IP , but I always found this way overkill for my tastes. And sometimes fstab fails with that too.
So here's my solution:
I bring my network up with this custom service:

[Unit]
Description=Network Connectivity
Requires=sys-devices-pci0000:00-0000:00:1c.5-0000:04:00.0-net-eth0.device
After=sys-devices-pci0000:00-0000:00:1c.5-0000:04:00.0-net-eth0.device
Wants=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down

[Install]
WantedBy=multi-user.target 

Note the reference to your network card , that has to be present (module loaded) when the service starts

/etc/conf.d/network:

interface=eth0
address=192.168.1.10
netmask=24
broadcast=192.168.1.255
gateway=192.168.1.251

then another custom service to execute a mounting script (or you use rc.local service if you manage to do)

[Unit]
Description=Mount some network stuff

Requires=network.service rpc-idmapd.service
After=network.service rpc-idmapd.service

[Service]
Type=oneshot
RemainAfterExit=True
ExecStart=/usr/local/bin/mountlocal

[Install]
WantedBy=multi-user.target

mount your nfs share in that script.

I know, seems crazy but this is the only sane way that I found to simply mount a network share.Other methods always failed on me sooner or later.
I could say a lot more but I'll stop here for not let this thread dustbinned.

hope this helps.

Offline

#4 2012-10-16 21:04:39

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,732
Website

Re: Systemd cannot mount NFS4 shares on client [solved]

Thanks guys.  I retraced my steps and everything is working now.  I updated the NFS article on the wiki.

Offline

Board footer

Powered by FluxBB