ntpd.service change

Udo van den Heuvel udovdh at xs4all.nl
Tue Mar 6 15:06:19 UTC 2018

On 06-03-18 05:04, Richard Laager wrote:
> 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.

In the latter case the user will miss any changes by the
developers/packager to the service file.
I was looking for the compromise: small change to the service file
making a copy in /etc/systemd/system unnecessary.

> 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.

I must look into this way of solving things as it did not work for me yet.
I installed the default ntpd.service file.
Then in  /etc/systemd/system/ntpd.service.d/ I created
10-environment.conf with contents:
ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS

/etc/sysconfig/ntpd contains:
# Command line options for ntpd

But it appears that these suggestions are not used (despite reload of
systemd) as the -N option is still passed to ntpd.


More information about the devel mailing list