Make NFS client/server work under systemd
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | apparmor (Debian) |
Fix Released
|
Unknown
|
||
| | apparmor (Ubuntu) |
Undecided
|
Martin Pitt | ||
| | nfs-utils (Ubuntu) |
High
|
Martin Pitt | ||
| | rpcbind (Debian) |
Fix Released
|
Unknown
|
||
| | rpcbind (Ubuntu) |
Undecided
|
Martin Pitt | ||
Bug Description
nfs-utils can not be used with systemd due to missing systemd unit or init.d script.
| tags: | added: systemd-boot |
I had an attempt to bring back the init.d script in https:/
| summary: |
- nfs-utils can not be installed with systemd + nfs-utils needs systemd unit or init.d script |
| Changed in nfs-utils (Ubuntu): | |
| status: | Confirmed → Triaged |
| Changed in nfs-utils (Ubuntu): | |
| importance: | Undecided → High |
| assignee: | nobody → Steve Langasek (vorlon) |
| Andy Whitcroft (apw) wrote : | #3 |
Note there are three units needed.
invoke-rc.d: Unit statd.service is masked
invoke-rc.d: Unit gssd.service is masked
invoke-rc.d: Unit idmapd.service is masked
| Tom H (tomh0665) wrote : | #4 |
I'd posted this to ubuntu-
I installed the upstream nfs-utils units and adapted them with "/etc/" overrides; and I created rpcbind units.
# diff /etc/systemd/
/lib/systemd/
7c7
< ExecStart=
---
> ExecStart=
# diff /etc/systemd/
/lib/systemd/
19c19
< ExecStart=
---
> ExecStart=
# diff /etc/systemd/
/lib/systemd/
16,17c16,17
< PIDFile=
< ExecStart=
---
> PIDFile=
> ExecStart=
# cat /lib/systemd/
#!/bin/sh
NFS_CONFIG=
if [ -e $NFS_CONFIG ] ; then
rm -f $NFS_CONFIG
fi
if [ -r /etc/default/
. /etc/default/
fi
if [ -r /etc/default/
. /etc/default/
fi
RPCNFSDARGStmp=
mkdir -p /run/sysconfig
echo "GSSDARGS=\"\"" >> $NFS_CONFIG
echo "RPCIDMAPDARGS=
echo "SMNOTIFYARGS=\"\"" >> $NFS_CONFIG
echo "STATDARGS=
echo "RPCMOUNTDARGS=
echo "RPCNFSDARGS=
echo "SVCGSSDARGS=
[Note on RPCIDMAPDARGS: I set it to "-p /var/lib/
"/etc/default/
without it. The path to rpc_pipefs was defaulting to "/run/rpc_pipefs"
even though the man page says that the default is
"/var/lib/
# cat /lib/systemd/
[Unit]
Description=RPC Bind
After=network.
[Service]
Type=forking
ExecStart=
Restart=always
[Install]
WantedBy=
[Note on rpcbind.service: I'm not sure whether this is the right unit
or whether it should have "Before=
and "Requires=
"WantedBy=
# cat /lib/systemd/
[Unit]
Description=RPC Bind Socket
[Socket]
ListenStream=
[Install]
WantedBy=
| Gabriel Mazetto (brodock) wrote : | #5 |
Can't we have a solution to this, please?
My nfs-common doesn't upgrade if I'm using systemd instead of sysvinit and upstart:
Configurando nfs-common (1:1.2.
Failed to issue method call: Unit statd.service failed to load: No such file or directory.
invoke-rc.d: initscript statd, action "restart" failed.
dpkg: erro ao processar o pacote nfs-common (--configure):
sub-processo script post-installation instalado retornou estado de saída de erro 6
Erros foram encontrados durante o processamento de:
nfs-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
| Changed in nfs-utils (Ubuntu): | |
| milestone: | none → ubuntu-15.02 |
| Martin Pitt (pitti) wrote : | #6 |
I've recently seen some upstream activity on the native systemd jobs (like on http://
| Changed in nfs-utils (Ubuntu): | |
| milestone: | ubuntu-15.02 → ubuntu-15.03 |
| Martin Pitt (pitti) wrote : | #7 |
Taking over from Steve as discussed on IRC, he doesn't find enough time for this.
These are the steps to set up a VM to test both server and client:
# set up exports
sudo apt-get install -y nfs-kernel-server
echo -e '/home *(rw,no_
sudo service nfs-kernel-server start
# set up client mounts
sudo mkdir /mnt/nfs_home /mnt/nfs_log
cat << EOF | sudo tee -a /etc/fstab
localhost:/home /mnt/nfs_home nfs defaults,nofail 0 0
localhost:/var/log /mnt/nfs_log nfs defaults,nofail 0 0
EOF
sudo reboot
# some simple tests to see that it worked
ls -l /mnt/nfs_log/wtmp /mnt/nfs_
echo hello > /mnt/nfs_
cat ~/world.txt # should give "hello"
sudo touch /mnt/nfs_log/pwned # should fail with "read-only fs"
This works fine under upstart, but as expected fails once you install systemd-sysv:
$ sudo systemctl status nfs-kernel-server
● nfs-kernel-
Loaded: loaded (/etc/init.
Active: active (exited) since Mon 2015-03-02 14:42:41 CET; 1min 9s ago
Docs: man:systemd-
Process: 507 ExecStart=
Mar 02 14:42:41 autopkgtest systemd[1]: Starting LSB: Kernel NFS server support...
Mar 02 14:42:41 autopkgtest nfs-kernel-
Mar 02 14:42:41 autopkgtest nfs-kernel-
Mar 02 14:42:41 autopkgtest nfs-kernel-
Mar 02 14:42:41 autopkgtest nfs-kernel-
Mar 02 14:42:41 autopkgtest systemd[1]: Started LSB: Kernel NFS server support.
and the client mounts hang:
$ ps aux|grep nfs
root 608 0.0 0.0 21544 1696 ? S 14:42 0:00 /bin/mount localhost:/var/log /mnt/nfs_log -n -t nfs -o defaults
root 610 0.0 0.0 21544 1688 ? S 14:42 0:00 /bin/mount localhost:/home /mnt/nfs_home -n -t nfs -o defaults
root 611 0.0 0.1 40192 3052 ? S 14:42 0:00 /sbin/mount.nfs localhost:/var/log /mnt/nfs_log -n -o rw
root 612 0.0 0.1 40192 3180 ? S 14:42 0:00 /sbin/mount.nfs localhost:/home /mnt/nfs_home -n -o rw
| Changed in nfs-utils (Ubuntu): | |
| assignee: | Steve Langasek (vorlon) → Martin Pitt (pitti) |
| status: | Triaged → In Progress |
| description: | updated |
| Martin Pitt (pitti) wrote : | #8 |
As we are quite a few upstream versions behind, I went through all systemd related upstream commits. There were a ton for adding the systemd/ directory with the units, which we should just start with as a whole and adjust to the ubuntu specifics/what the upstart jobs do: http://
Aside from those, there were just 4 commits to utils/statd/
| Martin Pitt (pitti) wrote : | #9 |
There is an ordering cycle in rpcbind which needs to be fixed first. This is because /etc/init.d/rpcbind depends on $network which in Ubuntu is implemented to actually wait for ifupdown/NM/etc. But that needs dbus, which in turn needs $remote_fs, which needs rpcbind.
| Changed in rpcbind (Ubuntu): | |
| assignee: | nobody → Martin Pitt (pitti) |
| status: | New → In Progress |
| Changed in rpcbind (Ubuntu): | |
| status: | In Progress → Fix Committed |
| Martin Pitt (pitti) wrote : | #10 |
Finally there are two dependency cycles which we need to fix:
Found ordering cycle on basic.target/start
Found dependency on sysinit.
Found dependency on apparmor.
Found dependency on remote-
Found dependency on remote-
Found dependency on nfs-client.
Found dependency on rpc-statd-
Found dependency on nfs-server.
Found dependency on rpc-svcgssd.
Found dependency on basic.target/start
Breaking ordering cycle by deleting job apparmor.
Job apparmor.
Found ordering cycle on basic.target/start
Found dependency on sysinit.
Found dependency on console-
Found dependency on remote-
Found dependency on remote-
Found dependency on nfs-client.
Found dependency on rpc-statd-
Found dependency on nfs-server.
Found dependency on rpc-svcgssd.
Found dependency on basic.target/start
Breaking ordering cycle by deleting job console-
Job console-
This is because these two don't have native systemd units, and their init.d script depends on $remote_fs. But remote-fs.target requires quite a lot (networking, dbus, perhaps NetworkManager, etc.), and we do want to protect those with apparmor. Also, apparmor only uses files in /, so $local_fs is sufficient even for the hypothetical "/usr on NFS" case.
That's less true for console-setup: This does use files from /usr; however, as we've never officially supported /usr on NFS, and nobody ever tested that under upstart, I'm very much inclined to just fix its init.d dependency to $local_fs, too.
| Changed in apparmor (Ubuntu): | |
| assignee: | nobody → Martin Pitt (pitti) |
| status: | New → In Progress |
| Changed in console-setup (Ubuntu): | |
| status: | New → In Progress |
| assignee: | nobody → Martin Pitt (pitti) |
| Changed in apparmor (Ubuntu): | |
| status: | In Progress → Fix Committed |
| Changed in console-setup (Ubuntu): | |
| status: | In Progress → Fix Committed |
| summary: |
- nfs-utils needs systemd unit or init.d script + Make NFS client/server work under systemd |
| Changed in console-setup (Ubuntu): | |
| status: | Fix Committed → In Progress |
| Martin Pitt (pitti) wrote : | #11 |
First test package available in https:/
I added the current upstream units as a big patch, and then added separate patches for our changes, so that it's easier to see what we changed; these also become easier to upstream that way.
TODO:
- debian/
- $NEED_STATD isn't taken into account. At the moment, rpc.statd is started unconditionally.
- unmounting the NFS mounts hangs on shutdown
| Launchpad Janitor (janitor) wrote : | #12 |
This bug was fixed in the package rpcbind - 0.2.1-6ubuntu2
---------------
rpcbind (0.2.1-6ubuntu2) vivid; urgency=medium
* Add systemd unit. Patch by Simon McVittie. (Closes: #748074, LP: #1312976)
-- Martin Pitt <email address hidden> Tue, 03 Mar 2015 08:32:38 +0100
| Changed in rpcbind (Ubuntu): | |
| status: | Fix Committed → Fix Released |
| Changed in rpcbind (Debian): | |
| status: | Unknown → New |
| Launchpad Janitor (janitor) wrote : | #13 |
This bug was fixed in the package apparmor - 2.9.1-0ubuntu5
---------------
apparmor (2.9.1-0ubuntu5) vivid; urgency=medium
* debian/
$local_fs. This is sufficient as during boot we don't use anything from
/usr. It's also necessary to avoid dependency cycles when using NFS (as
its dependencies should be covered by AppArmor). (LP: #1312976)
-- Martin Pitt <email address hidden> Tue, 03 Mar 2015 08:54:33 +0100
| Changed in apparmor (Ubuntu): | |
| status: | Fix Committed → Fix Released |
| Martin Pitt (pitti) wrote : | #14 |
pitti2 uploaded to PPA now. This fixes the umount hang, and drops the manual modprobing. The modules get loaded automatically without that too. Neither upstream nor the Fedora package do any extra modprobing.
| Changed in console-setup (Ubuntu): | |
| milestone: | none → ubuntu-15.03 |
| Martin Pitt (pitti) wrote : | #15 |
nfs-utils - 1:1.2.8-
I now tested this on both a single machine as well as two separate VMs (one server, one client), with some /mnt/* mounts as well as /home on NFS. Works fine now.
The remaining TODO is
- $NEED_STATD isn't taken into account. At the moment, rpc.statd is started unconditionally.
But that's an optimization and thus we could do this in a followup upload.
| Martin Pitt (pitti) wrote : | #16 |
debdiff for review: http://
| Changed in nfs-utils (Ubuntu): | |
| status: | In Progress → Fix Committed |
| no longer affects: | console-setup (Ubuntu) |
| Changed in console-setup (Ubuntu): | |
| assignee: | nobody → Martin Pitt (pitti) |
| status: | New → In Progress |
| no longer affects: | console-setup (Ubuntu) |
| Martin Pitt (pitti) wrote : | #17 |
I split out the remaining issues into bug 1428486 and bug 1428487. I'm also going to create an autopkgtest.
| Launchpad Janitor (janitor) wrote : | #18 |
This bug was fixed in the package nfs-utils - 1:1.2.8-9ubuntu3
---------------
nfs-utils (1:1.2.8-9ubuntu3) vivid; urgency=medium
* Add 00git-start-
1.3.2 to start rpc-statd.service under systemd.
* Add 23-systemd-
/var/lib/nfs/, like in the upstart units.
* Add 24-systemd-
* debian/
symlink, to match SysV init script.
* Add 25-systemd-
to make mounting NFS shares from localhost work reliably.
* Add debian/
configuration for nfs-config.service.
* debian/
* debian/rules: Enable/start systemd units. (LP: #1312976)
-- Martin Pitt <email address hidden> Thu, 05 Mar 2015 07:46:41 +0100
| Changed in nfs-utils (Ubuntu): | |
| status: | Fix Committed → Fix Released |
| Changed in apparmor (Debian): | |
| status: | Unknown → New |
| Changed in apparmor (Debian): | |
| status: | New → Fix Committed |
| Changed in apparmor (Debian): | |
| status: | Fix Committed → Fix Released |
| Changed in rpcbind (Debian): | |
| status: | New → Fix Released |


Status changed to 'Confirmed' because the bug affects multiple users.