[systemd-devel] Questions about timedatectl and NTP

Jakub Klinkovsk√Ĺ j.l.k at gmx.com
Sun Apr 5 04:25:45 PDT 2015


As per systemd 216 NEWS [1], alternative NTP implementations should add
Conflicts=systemd-timesyncd.service to be recognized by systemd, which
ntpd.service on Arch Linux does. But still, active ntpd.service does not seem
to be recognized by timedatectl:

$ timedatectl
...
     NTP enabled: no
NTP synchronized: yes
...

If I'm reading the code [2] correctly, the 'timedatectl set-ntp' command only
handles systemd-timesyncd.service and does not take into account any other NTP
implementations. This is in contrast with timedatectl(1) [3] which explicitly
shows an example where timedatectl starts chronyd.service.

Also, I think that since systemd 216 the "NTP enabled" field in timedatectl's
output should read "timesyncd enabled" to avoid confusion. Many people still
have trouble understanding that NTP != ntpd and timedatectl currently adds
another term to the inequality.

Finally, I think there is a bug in how the Conflicts= specification is supposed
to work. Suppose that systemd-timesyncd.service is inactive and some other
service, specifying Conflicts=systemd-timesyncd.service is active -- let's call
it ntpd.service as mentioned above. Now, when the user runs
'timedatectl set-ntp true' the systemd-timesyncd.service is first enabled and
then started. Due to the Conflicts= declaration, ntpd.service is stopped, but
remains enabled. Later on, when the user reboots, ntpd.service will be started
instead of systemd-timesyncd.service -- this is the behaviour described in
systemd.unit(5) [4].

[1] http://cgit.freedesktop.org/systemd/systemd/tree/NEWS?id=06b643e7f5a3b79005dd57497897ab7255fe3659#n5 
[2] http://cgit.freedesktop.org/systemd/systemd/tree/src/timedate/timedated.c#n254
[3] http://www.freedesktop.org/software/systemd/man/timedatectl.html#Examples
[4] http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Conflicts=
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150405/12acd38a/attachment.sig>


More information about the systemd-devel mailing list