Bug#768006: nfs-common: systemd fails to start nfs-common daemons before attmpting NFS mounts (NFSv3)
Package: nfs-common
Version: 1:1.2.8-9
Followup-For: Bug #768006
Dear Maintainer,
I also encountered this problem, and had a nasty time trying to fix
it. In my case I just want to nfs mount /home with this /etc/fstab
entry;
ngurra:/Minkirri /home nfs defaults,bg 0 0
On reboot it was not getting mounted, with errors indicating the mount
failed because rpc.statd was not running. I then tried the
/etc/systemd/system/nfs-common.service.d/remote-fs-pre.conf fix
suggested above but found it failed because the rpcbind portmapper was
not running. In the end I created the following file like this;
/etc/systemd/system/nfs-common.service.d/bug768006.conf
[Unit]
Requires=rpcbind.target
After=rpcbind.target
Before=remote-fs-pre.target
Wants=remote-fs-pre.target
It now appears to be working, but I'm not entirely sure why or if it's a
lucky race condition since my system shows this;
$ systemctl status home.mount
● home.mount - /home
Loaded: loaded (/etc/fstab; bad; vendor preset: enabled)
Active: active (mounted) since Thu 2016-05-05 23:16:34 AEST; 30min ago
Where: /home
What: ngurra:/Minkirri
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 672 ExecMount=/bin/mount ngurra:/Minkirri /home -t nfs -o defaults,bg
Tasks: 1 (limit: 512)
CGroup: /system.slice/home.mount
└─747 rpc.statd --no-notify
May 05 23:16:34 minkirri systemd[1]: home.mount: Directory /home to mount over i
May 05 23:16:34 minkirri systemd[1]: Mounting /home...
May 05 23:16:34 minkirri rpc.statd[747]: Version 1.2.8 starting
May 05 23:16:34 minkirri rpc.statd[747]: Flags: TI-RPC
May 05 23:16:34 minkirri systemd[1]: Mounted /home.
Which tells me that rpc.statd was started when the mount was done. And
looking at nfs-common.service I get;
$ systemctl status nfs-common.service
● nfs-common.service - LSB: NFS support files common to client and server
Loaded: loaded (/etc/init.d/nfs-common; bad; vendor preset: enabled)
Drop-In: /etc/systemd/system/nfs-common.service.d
└─bug768006.conf
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
Which tells me nfs-common has never even been started. Trying to track
down the dependency sequence I get;
$ systemctl show home.mount | egrep "Want|Require|After|Before"
Requires=-.mount system.slice
Wants=network-online.target
RequiredBy=remote-fs.target
Before=remote-fs.target umount.target
After=remote-fs-pre.target system.slice -.mount
systemd-journald.socket network- online.target
network.target
RequiresMountsFor=/
$ systemctl show remote-fs-pre.target | egrep "Want|Require|After|Before"
WantedBy=rpcbind.service nfs-common.service remote-fs.target
Before=mnt-multimedia.mount remote-fs.target home.mount
After=nfs-common.service rpcbind.service
$ systemctl show nfs-common.service | egrep "Want|Require|After|Before"
RemainAfterExit=yes
Requires=rpcbind.target system.slice
Wants=remote-fs-pre.target
WantedBy=graphical.target multi-user.target sysinit.target
Before=multi-user.target sysinit.target shutdown.target
graphical.target remote-fs-pre.target
After=systemd-journald.socket time-sync.target rpcbind.target
system.slice
$ systemctl show rpcbind.target | egrep "Want|Require|After|Before"
Requires=rpcbind.service
RequiredBy=nfs-common.service
WantedBy=rpcbind.service
Before=nfs-common.service
After=rpcbind.service
Which I think all means that nfs-common.service should have been
started. Note that when it was failing systemd was telling me that
nfs-common.service was successfully started, but it was being done
after the home.mount which is why the mount was failing.
I don't understand why the change to put nfs-common in the right
sequence now means it's not starting at all, but the mount is working.
This suggests that only rpcbind.service is required before the mount,
which seems to start the rpc.statd on demand. Maybe nfs-common can be
dropped and just a "Requires: rpcbind.target" added somewhere.
*** End of the template - remove these template lines ***
-- Package-specific info:
-- rpcinfo --
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 55586 status
100024 1 tcp 39377 status
100021 1 udp 55258 nlockmgr
100021 3 udp 55258 nlockmgr
100021 4 udp 55258 nlockmgr
100021 1 tcp 41904 nlockmgr
100021 3 tcp 41904 nlockmgr
100021 4 tcp 41904 nlockmgr
-- /etc/default/nfs-common --
NEED_STATD=
STATDOPTS=
NEED_IDMAPD=
NEED_GSSD=
-- /etc/idmapd.conf --
[General]
Verbosity = 0
Pipefs-Directory = /run/rpc_pipefs
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
-- /etc/fstab --
ngurra:/Minkirri /home nfs defaults,bg 0 0
ngurra:/Multimedia /mnt/multimedia nfs defaults,noauto,x-systemd.automount,x-systemd.device-timeout=30s,x-systemd.idle-timeout=3600 0 0
-- /proc/mounts --
ngurra:/Minkirri /home nfs rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.7.3,mountvers=3,mountport=30000,mountproto=udp,local_lock=none,addr=192.168.7.3 0 0
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing'), (300, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.5.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages nfs-common depends on:
ii adduser 3.114
ii initscripts 2.88dsf-59.3
ii libc6 2.22-7
ii libcap2 1:2.24-12
ii libcomerr2 1.43~WIP.2016.03.15-2
ii libdevmapper1.02.1 2:1.02.123-1
ii libevent-2.0-5 2.0.21-stable-2+b1
ii libgssapi-krb5-2 1.13.2+dfsg-5
ii libk5crypto3 1.13.2+dfsg-5
ii libkeyutils1 1.5.9-8
ii libkrb5-3 1.13.2+dfsg-5
ii libmount1 2.28-1
ii libnfsidmap2 0.25-5
ii libtirpc1 0.2.5-1
ii libwrap0 7.6.q-25
ii lsb-base 9.20160110
ii rpcbind 0.2.3-0.2
ii ucf 3.0036
Versions of packages nfs-common recommends:
ii python 2.7.11-1
Versions of packages nfs-common suggests:
pn open-iscsi <none>
pn watchdog <none>
-- no debconf information
Reply to: