On Wed, 6 Mar 2024 12:53:47 -0500 Jeffrey Walton <noloa...@gmail.com> wrote:
Package: systemd
Version:  255.4-1
Tags: sid

It looks like Systemd's timedatectl does not recognize ntpsec. Using
it results in 'NTP service: n/a':

$ timedatectl
               Local time: Wed 2024-03-06 12:35:32 EST
           Universal time: Wed 2024-03-06 17:35:32 UTC
                 RTC time: Wed 2024-03-06 17:35:32
                Time zone: America/New_York (EST, -0500)
System clock synchronized: yes
              NTP service: n/a
          RTC in local TZ: no

According to <https://wiki.debian.org/DateTime#Installing_NTP>, ntpsec
is an option for Debian 11 and below; and default for Debian 12 and

I searched for an upstream bug at <https://github.com/systemd/systemd>
(is that the right place?), but there were no relevant hits. See

Also see <https://lists.debian.org/debian-user/2024/03/msg00145.html>.
That's the debian-users mailing list discussion with GW's comment.

If an NTP service want's to be recognized by timedated, it needs to ship a config snippet in /usr/lib/systemd/ntp-units.d/
See man systemd-timedated

       systemd-timesyncd will look for files with a ".list" extension in 
ntp-units.d/ directories. Each file is parsed as a list of unit names, one per
          this is a typo, should be systemd-timedated [1]
       line. Empty lines and lines with comments ("#") are ignored. Files are 
read from /usr/lib/systemd/ntp-units.d/ and the corresponding directories
       under /etc/, /run/, /usr/local/lib/. Files in /etc/ override files with 
the same name in /run/, /usr/local/lib/, and /usr/lib/. Files in /run/
       override files with the same name under /usr/. Packages should install 
their configuration files in /usr/lib/ (distribution packages) or
       /usr/local/lib/ (local installs).

       Example 1. ntp-units.d/ entry for systemd-timesyncd

           # /usr/lib/systemd/ntp-units.d/80-systemd-timesync.list

       If the environment variable $SYSTEMD_TIMEDATED_NTP_SERVICES is set, 
systemd-timesyncd will parse the contents of that variable as a
       colon-separated list of unit names. When set, this variable overrides 
the file-based list described above.

systemd-timesyncd and chrony do this properly.

# apt-file search /usr/lib/systemd/ntp-units.d/
chrony: /usr/lib/systemd/ntp-units.d/50-chrony.list
systemd-timesyncd: /usr/lib/systemd/ntp-units.d/80-systemd-timesync.list

I've CCed the ntpsec maintainers.
If they have interest in shipping such an integration, then we can reassign the bug report. Otherwise I'll just close it, as there is nothing we can do on the systemd side


[1] https://github.com/systemd/systemd/pull/31658

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to