Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 544772

Summary: net-fs/nfs-utils-1.3.1-r5 ships systemd service files with invalid references to environment variables
Product: Gentoo Linux Reporter: Łukasz Stelmach <stlman>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED OBSOLETE    
Severity: normal CC: aklhfex, alex3255, leho, maxime.deroucy, systemd
Priority: Normal Keywords: PATCH
Version: 10.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Edit environment variable names to march conf.d/nfs

Description Łukasz Stelmach 2015-03-28 16:10:31 UTC
The systemd service files shipped with nfs-utils load configuration from /etc/conf.d/nfs but refer to different variables in their ExecStart lines. For example in nfs-server.service there is a line

ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS

although in /etc/conf.d/nfs the variable is named OPTS_RPC_NFSD.

Please use the following patch to fix the problem. At least until the unit files are fully compliant with https://wiki.gentoo.org/wiki/Project:Systemd/Ebuild_policy#Unit_file_guidelines

Reproducible: Always
Comment 1 Łukasz Stelmach 2015-03-28 16:11:10 UTC
Created attachment 399964 [details, diff]
Edit environment variable names to march conf.d/nfs
Comment 2 Andrew Savchenko gentoo-dev 2015-04-01 22:54:24 UTC
*** Bug 538780 has been marked as a duplicate of this bug. ***
Comment 3 Leho Kraav (:macmaN @lkraav) 2015-10-27 20:00:14 UTC
This is definitely real and the patch is correct. I'm running my nfs server with the updated env variables for several months now.
Comment 4 Denis Romanchuk 2015-10-29 12:10:31 UTC
(In reply to Leho Kraav (:macmaN @lkraav) from comment #3)
> This is definitely real and the patch is correct. I'm running my nfs server
> with the updated env variables for several months now.

Yeah, same things here, variables in /etc/conf.d/nfs are irrelevant to those actually passed to the systemd service file. Also it seems like there are missing one crucial dependency, during nfs-server.service activation rpc_pipefs should be mounted, so I suggest to also add to the nfs-server.service file next lines:
Requires=var-lib-nfs-rpc_pipefs.mount
After=var-lib-nfs-rpc_pipefs.mount
Comment 5 Mike Gilbert gentoo-dev 2016-08-09 22:13:49 UTC
Using /etc/conf.d/nfs is not an option. That's a step backward and violates our policy.

We should instead set a reasonable default for RPCNFSDARGS in a systemd drop-in file.
Comment 6 Maxime de Roucy 2016-08-10 07:52:30 UTC
I agree
Comment 7 Łukasz Stelmach 2016-08-10 08:30:59 UTC
This won't make /etc/conf.d/nfs relevant on systems with systemd anyway.
Comment 8 Chris Paras 2017-09-05 13:40:23 UTC
Any progress on this ? Maybe use something like this as an drop-in replacement for systemd:

/etc/systemd/system/nfs-server.service.d/00gentoo.conf:

[Service]

Environment="RPCNFSDARGS=-v"
Environment="RPCIDMAPDARGS=-v"
Environment="SVCGSSDARGS=-v"
Environment="RPCMOUNTDARGS=-v"
Environment="STATDARGS -v"
Environment="GSSDARGS -v"

And change the EnvironmentFile=/etc/conf.d/nfs in all nfs-related unit files to EnvironmentFile=/etc/systemd/system/nfs-server.service.d/00gentoo.conf
Comment 9 Chris Paras 2017-09-05 13:42:33 UTC
Sorry i forgot to add '=' in the last 2 Environment= lines.
Comment 10 Chris Paras 2018-06-04 18:41:01 UTC
It seems like nfs-utils-2.3.1-r3 added the possibility to specify certain options for most of the rpc.* daemons in a central (distribution-independent) /etc/nfs.conf file. Here's an excerpt from man rpc.nfsd:

<-- excerpt
.....
CONFIGURATION FILE
Many of the options that can be set on the command line can  also  be  controlled  through values  set  in the [nfsd] section of the /etc/nfs.conf configuration file.  Values recognized include:

       threads
              The number of threads to start.

       host   A host name, or comma separated list of host names, that rpc.nfsd will  listen  on. Use of the --host option replaces all host names listed here.
......
......
--> excerpt

AFAICS, rpc.gssd, rpc.mountd rpc.svcgssd rpc.idmapd options can all be set in /etc/nfs.conf. Check your manpages !
Comment 11 Leho Kraav (:macmaN @lkraav) 2018-06-30 12:50:23 UTC
Tyvm Chris. After 1hr of head-scratching and finally arriving at your message, I was able to migrate my custom port configuration over from `/etc/conf.d/nfs -> /etc/nfs.conf`

```
leho@gusto /etc $ cat nfs.conf 
[mountd]
port = 32767

[statd]
port = 32765
outgoing-port = 32766
```