Web lists-archives.com

Re: Systemd services (was Re: If Linux Is About Choice, Why Then ...)

Le quintidi 25 germinal, an CCXXV, Greg Wooledge a écrit :
> Some day there will be actual end-user-friendly systemd documentation
> somewhere, consolidating all of these pieces of wisdom together.  I hope.

Note: systemd is not for end-users, it is for system administrator and
distribution authors.

> 1) To override parts of a distribution's systemd unit locally, you MUST
>    use the foo.service.d/ method.  You can't just put the override bits
>    into an /etc/systemd/system/foo.service file.  That would be too easy.

foo.service.d/*.conf            is for overriding bits.
/etc/systemd/system/foo.service is for overriding the whole file.

I find that fairly natural. Otherwise, how would you override the whole

> 2) The files inside foo.service.d/ MUST end with a .conf suffix.  (Cf.
>    the wheezy->jessie apache2 upgrade, and having to rename every single
>    one of my virtual domain config files AND the symlinks to them.)

After having been bitten by old *.conf~ backup files left by an editor,
I must say I find that restriction quite useful.

> 3) foo.service.d/ must use the CANONICAL service name of whatever it is
>    that you're trying to override.  This may not be the same as the
>    Debian package name.  For example, the nfs-kernel-server package
>    creates a systemd unit named nfs-server.service with an ALIAS of
>    nfs-kernel-server.service.  If you try to create override files in
>    nfs-kernel-server.service.d/ it will not work correctly.  They have
>    to be in nfs-server.service.d/ instead.
>    Don't even get me started on sshd.service vs. ssh.service.  Do you
>    have any idea how hard it is to notice that extra/missing "d", and
>    figure out why things Simply Do Not Work?

On the other hand, if systemd were to read snippets of configuration
with a subtly different name, someone else (or maybe be even yourself!)
would have complained about wasted time because of a stale config
snippet that should not have been read.

I find that strict rules are usually more convenient in the long run.

Note that you can use "systemctl edit" to have an editor started on the
exact correct file.


  Nicolas George

Attachment: signature.asc
Description: Digital signature