ntpd.service change
Richard Laager
rlaager at wiktel.com
Tue Mar 6 04:04:29 UTC 2018
Moving to devel@, with permission.
On 03/05/2018 08:06 AM, Udo van den Heuvel wrote:
> How can we please get these lines in the ntpd.service file?
>
> EnvironmentFile=-/etc/sysconfig/ntpd
> ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS
>
> and of course:
>
> # cat /etc/sysconfig/ntpd
> # Command line options for ntpd
> OPTIONS="-g"
>
>
> This will make it easier to configure ntpsec's ntpd without changing
> service files, e.g. for running in a chroot
I suggest some caution in this. If ntpsec adds EnvironmentFile, then it
becomes difficult to remove, as removing it is a backwards-incompatible
change.
As a user, you might consider using other methods to adjust your
settings. Specifically, to override ExecStart, you can copy the unit
from /lib/systemd/system to /etc/systemd/system, and customize it to
your heart's content, without the package manager overwriting your
changes on upgrade. The one in /etc will completely override the one
from /lib.
For parameters other than ExecStart, you can use a drop-in unit (e.g.
/etc/systemd/system/ntpd.service.d/10-whatever.conf) to *add*
configuration without needing to override everything. In this model,
changes from upstream merge with your local changes.
These two methods are very handy for system administrators in practice,
and represent a significant improvement that systemd brings. Trying to
convert systemd units back into the sysvinit approach that you're used
to may not be the best path forward. It also might be, in some
situations, which is arguably why EnvironmentFile exists.
What you have suggested should work correctly. In fact, you could use
the override approach combined with this to get the /etc/sysconfig
approach on your system, without upstream ntpsec having to adopt it.
I went down the EnvironmentFile path for Debian, but ultimately had to
use a wrapper script, just like the ntp (NTP Classic) package, as Debian
has additional code which cannot be handled by an EnvironmentFile. For
the curious: specifically, it uses a different conf file (if present)
for DHCP integration and uses a lock file to coordinate with ntpdate
calls from the ifup scripts.
It also honors /etc/default, because once I'm running /bin/sh, I might
as well. Also, in Debian, I can't completely eliminate the sysvinit
scripts, because of A) user preference, and B) ports like Debian
GNU/kFreeBSD and GNU/Hurd that can't run systemd.
Adding EnvironmentFile to the upstream ntpsec units would not be a
problem for me doing Debian packaging. I'll continue to patch the
ExecStart either way.
--
Richard
More information about the devel
mailing list