[systemd-devel] Variables in the [Unit] section of a server

Lennart Poettering lennart at poettering.net
Thu Jan 14 12:48:13 PST 2016


On Thu, 14.01.16 20:37, Tom H (tomh0665 at gmail.com) wrote:

> I understand that you'd prefer that we use drop-ins to set
> "Environment=Foo=bar" or override "ExecStart=..." and it probably
> works for most daemons - and should also be non-distro-specific.
> 
> But in the case of nfs, it would mean more messing around for admins
> because there are many variables to set.
> 
> This is on Ubuntu 16.04 but RHEL and Fedora are similar because the
> units are from upstream and distros simply have to modify
> "/usr/lib/systemd/scripts/nfs-utils_env.sh":
> 
> root at localhost:/lib/systemd/system# grep Start= nfs-* rpc-*
> nfs-blkmap.service:ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
> nfs-config.service:ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh
> nfs-idmapd.service:ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
> nfs-kernel-server.service:ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
> nfs-mountd.service:ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
> nfs-server.service:ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
> nfs-utils.service:ExecStart=/bin/true
> rpc-gssd.service:ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
> rpc-statd-notify.service:ExecStart=-/sbin/sm-notify $SMNOTIFYARGS
> rpc-statd.service:ExecStart=/sbin/rpc.statd --no-notify $STATDARGS
> rpc-svcgssd.service:ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
> 
> root at localhost:/lib/systemd/system# grep Env nfs-* rpc-*
> nfs-idmapd.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> nfs-kernel-server.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> nfs-mountd.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> nfs-server.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> rpc-gssd.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> rpc-statd-notify.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> rpc-statd.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> rpc-svcgssd.service:EnvironmentFile=-/run/sysconfig/nfs-utils
> 
> root at localhost:/lib/systemd/system#
> 
> nfs-config.service runs "/usr/lib/systemd/scripts/nfs-utils_env.sh",
> which sources "/etc/default/nfs-{common,kernel-server}"
> ("/etc/sysconfig/nfs" on RHEL and Fedora) and generates
> "/run/sysconfig/nfs-utils". Setting the variables unit-by-unit would
> be a PitA.

Well, apparently the NFS daemons want to receive all their config via
the command line. I think that's a quite a poor choice, and they
better had proper configuration files.

To say this clearly: "EnvironmentFile=" is an awful replacement for
proper configuration files. systemd really isn't in the business of
faking configuration files for daemons that have none. If you do it
anyway, then this will be necessarily crappyish...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list