idmapd not started when booting under systemd

Bug #1428961 reported by Steve Langasek
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
nfs-utils (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

Sorry for not getting a chance to test this before upload, but now that nfs-utils has support for systemd in the archive, I've rebooted and tested it on a system that uses nfs.

I find that the idmapd service is not being started on boot when booting with systemd.

$ pidof rpc.idmapd
$ systemctl status nfs-idmapd -l
● nfs-idmapd.service - NFSv4 ID-name mapping service
   Loaded: loaded (/lib/systemd/system/nfs-idmapd.service; static; vendor preset: enabled)
   Active: inactive (dead)

Mar 05 22:31:24 virgil systemd[1]: Starting NFSv4 ID-name mapping service...
Mar 05 22:31:24 virgil systemd[1]: Started NFSv4 ID-name mapping service.
Mar 05 22:31:24 virgil systemd[1]: Unit nfs-idmapd.service is bound to inactive unit. Stopping, too.
Mar 05 22:31:24 virgil systemd[1]: Stopping NFSv4 ID-name mapping service...
Mar 05 22:31:24 virgil systemd[1]: Stopped NFSv4 ID-name mapping service.
$

Under upstart, it is started unconditionally, which is correct. idmapd is used on both clients and servers, and should be started whenever the nfs-common package is installed.

I'm not sure where the bug lies; I don't completely understand the contents of /lib/systemd/system/nfs-idmapd.service. The 'BindsTo=nfs-server.service' appears to be imply that it will only be started when nfs-server is started, and stopped when nfs-server is stopped, which is certainly incorrect.

gssd is client-side only; idmapd and statd are used on both client and server and should be started unconditionally in nfs-common, AIUI.

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: nfs-common 1:1.2.8-9ubuntu4
ProcVersionSignature: Ubuntu 3.19.0-7.7-generic 3.19.0
Uname: Linux 3.19.0-7-generic x86_64
ApportVersion: 2.16.2-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Mar 5 22:36:57 2015
InstallationDate: Installed on 2010-09-24 (1624 days ago)
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.1)
SourcePackage: nfs-utils
UpgradeStatus: Upgraded to vivid on 2014-12-06 (90 days ago)

Revision history for this message
Steve Langasek (vorlon) wrote :
Changed in nfs-utils (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Martin Pitt (pitti)
Changed in nfs-utils (Ubuntu):
status: New → In Progress
importance: Undecided → High
Martin Pitt (pitti)
Changed in nfs-utils (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Patch sent to upstream ML, I'll send the link here once http://www.spinics.net/lists/linux-nfs/ has it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nfs-utils - 1:1.2.8-9ubuntu5

---------------
nfs-utils (1:1.2.8-9ubuntu5) vivid; urgency=medium

  * Add 27-systemd-start-nfs-idmapd-also-on-clients.patch: idmapd is needed
    for clients too, so start it from nfs-client.target and stop binding to it
    in nfs-server.service. (LP: #1428961)
 -- Martin Pitt <email address hidden> Fri, 06 Mar 2015 11:56:46 +0100

Changed in nfs-utils (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Upstream report: http://www.spinics.net/lists/linux-nfs/msg49991.html . Upstream says that with newer versions this isn't necessary any more?

Revision history for this message
Jacqueline Brendel (jaybee-s) wrote :

This doesn't seem to be fixed. I have two computers with up to date packages running nfs+kerberos+sssd and there is no idmap service and all my mounted stuff comes with those endlessly long ids indicating the idmapping didn't work. -> Thus. Not fixed, not working, idmapd still required on the client.

Revision history for this message
Steve Langasek (vorlon) wrote :

Jacqueline, can you confirm that the output of this command matches on your affected system?

$ cat /etc/request-key.d/id_resolver.conf
create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d

Also, do you have the keyutils package installed? If not, does installing it fix the problem you're seeing?

It's possible that the problem here is because I failed to notice keyutls was not a dependency of the NFS stack.

Revision history for this message
Jacqueline Brendel (jaybee-s) wrote :

Hi Steve,

indeed the package keyutils was missing and now it works as it should - thank you!

Revision history for this message
Steve Langasek (vorlon) wrote :

Ok, thanks for confirming. Opened bug #1449074 to get this dependency fixed in vivid.

Revision history for this message
ganrald (ganrald) wrote :

Please don't kill me if I was supposed to create a new bug report rather than update this one.

This bug is still present in Ubuntu 15.10 (Wily Werewolf).

My Ubuntu NFS client is working fine, apart from the fact that no idmapd is running.

# pgrep idmap
#

# dpkg-query -W nfs-common
nfs-common 1:1.2.8-9ubuntu10

# systemctl status nfs-idmapd
● nfs-idmapd.service - NFSv4 ID-name mapping service
   Loaded: loaded (/lib/systemd/system/nfs-idmapd.service; static; vendor preset: enabled)
   Active: inactive (dead)

# systemctl start nfs-idmapd
Failed to start nfs-idmapd.service: Unit nfs-server.service failed to load: No such file or directory.

I don't have nfs-kernel-server package installed and the dependency is still present in /lib/systemd/system/nfs-idmapd.service file

# grep BindsTo /lib/systemd/system/nfs-idmapd.service
BindsTo=nfs-server.service

I have one more remark in http://www.spinics.net/lists/linux-nfs/msg49996.html Steve mentions that you want to use nfsidmap, however the nfs-idmapd.service unit file starts rpc.idmapd.

# grep ExecStart /lib/systemd/system/nfs-idmapd.service
ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS

tags: added: wily
Revision history for this message
ganrald (ganrald) wrote :

It looks like the current set-up in Ubuntu 15.10 where rpc.idmapd daemon is started on the server only may be correct/intentional after all. I did not find conclusive information, however this BSD idmapd man page http://man7.org/linux/man-pages/man8/idmapd.8.html states:

"Note that on more recent kernels only the NFSv4 server uses rpc.idmapd.
The NFSv4 client instead uses nfsidmap(8), and only falls back to
rpc.idmapd if there was a problem running the nfsidmap(8) program."

Which seems to be intended solution in Ubuntu. In any case current systemd configuration is a bit confusing. There are two idmap unit files:

$ systemctl -a list-unit-files *idmap*
UNIT FILE STATE
idmapd.service masked
nfs-idmapd.service static

Normally one would expect that: idmapd.service starts rpc.idmapd (instead this file is masked) and nfs-idmapd.service starts nfsidmap (instead it starts rpc.idmapd). Of course the latter only before realizing that nfsidmap is not a daemon and it does not need a unit file.

I was able to get NFS4 to correctly map user names in Ubuntu 15.10 after updating /etc/idmapd.conf to explicitly define Domain parameter. Assuming my computer FQDN is nfsclient.lan I had to set:
# set your own domain here, if id differs from FQDN minus hostname
Domain = lan

In case one has a correctly configured DNS server this should apparently work out of the box with an implicit default setting; idmapd.conf man page states:
       Domain The local NFSv4 domain name. An NFSv4 domain is a namespace with a unique username<->UID and group‐
              name<->GID mapping. (Default: Host's fully-qualified DNS domain name)
Most likely it does not as the /etc/hosts contains an entry for the current machine without the domain name, as in:
127.0.0.1 localhost
127.0.1.1 nfsclient

Revision history for this message
Martin Pitt (pitti) wrote :

Indeed nfs-idmapd.service is not meant to be run independently; it's a part of nfs-server.service.

Revision history for this message
andi bachmann (bachmann) wrote :

I have the same experience as described in the original bug description. My system is running
on ubuntu 16.04 and I've installed `nfs-common` (client-only, I don't want `nfs-server` on the system).

# systemctl -a list-unit-files *idmap*
UNIT FILE STATE
idmapd.service masked
nfs-idmapd.service static

# systemctl status nfs-idmapd -l
● nfs-idmapd.service - NFSv4 ID-name mapping service
   Loaded: loaded (/lib/systemd/system/nfs-idmapd.service; static; vendor preset: enabled)
   Active: inactive (dead)

And starting does not work:
# systemctl start nfs-idmapd
Failed to start nfs-idmapd.service: Unit nfs-server.service not found.

Do I understand you, @pitti in #11 correctly that `nfs-server` needs to be installed?

thanks for clarifying!
andi

Revision history for this message
pahnin (pahninsd) wrote :

@backmann same happened with me on 16.04 but I was able to stop and start using
systemctl stop nfs-idmapd -l
systemctl start nfs-idmapd -l

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.