5

I've used systemd-timesyncd as my system timekeeper for several years now. I run a Debian derivative called raspbian for my Raspberry Pis. I'm mostly very pleased with the SNTP client that is systemd-timesyncd, but would like to experiment with chronyd for use in off-grid applications.

The following command may be used to list the configuration of systemd-timesyncd:

$ systemctl cat systemd-timesyncd

In buster, there was a section of code in this listing that provided systemd-timesyncd with the ability to "excuse itself" if it found another timekeeping service (NTP daemon) installed:

# /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf
[Unit]
# don't run timesyncd if we have another NTP daemon installed
ConditionFileIsExecutable=!/usr/sbin/ntpd
ConditionFileIsExecutable=!/usr/sbin/openntpd
ConditionFileIsExecutable=!/usr/sbin/chronyd
ConditionFileIsExecutable=!/usr/sbin/VBoxService

At some point after the release of buster (concurrent w/ release of bullseye??), the above scheme was altered; the command systemctl cat systemd-timesyncd no longer contains any references to restricting or inhibiting startup of systemd-timesyncd if other timekeepers are found.

Does anyone recall the history of this change? More importantly, does systemd-timesyncd still inhibit its startup if it finds another timekeeping daemon installed? Where/how is this done?

1 Answer 1

11

The systemd-timesyncd service no longer checks for conflicts itself. Instead, the conflict is handled by having systemd-timesyncd in its own package, which conflicts with other time service packages: it’s therefore now impossible to have two time servers installed (using Debian packages).

The way this works, in more detail, is that the systemd-timesyncd package has a Conflicts: time-daemon entry. time-daemon is a virtual package provided by all time daemons, and they all conflict with it so that only a single time daemon can be installed at once (packages can’t conflict with themselves so the apparent self-conflict isn’t a problem). This is the standard mechanism in Debian to ensure that a single package of a set providing a given feature is provided. The package split is significant because such a package conflict couldn’t be defined on the systemd package itself.

This might seem more fragile, since it doesn’t deal with manually-installed time servers. However those aren’t supposed to go in /usr/sbin anyway, so the previous scheme wouldn’t have handled them either. On top of that, automatically enabling and disabling time daemons proved unreliable, and it didn’t seem possible at the time to fix that.

6
  • Thanks for the quick answer! If you could clarify something for me, I'd appreciate it: How is it that putting systemd-timesyncd in "its own package" makes it impossible to install (as in apt install xxxx?) - for example - chrony??
    – Seamus
    Oct 4 at 4:53
  • The systemd-timesyncd package has a Conflicts: time-daemon entry; time-daemon is a virtual package provided by all time daemons. This is the standard mechanism in Debian to ensure that a single package of a set providing a given feature is provided. The package split is significant because such a package conflict couldn’t be defined on the systemd package itself. Oct 4 at 5:07
  • You're right (of course :) - I just tried to apt install chrony, and got this message: "The following packages will be REMOVED: systemd-timesyncd". I have to say I'm not entirely happy with that approach as it limits my prerogatives for using whichever package was most appropriate at a specific time. I guess this gets into systemd-politics though, so let's drop it. :)
    – Seamus
    Oct 4 at 5:20
  • Right, installing and removing packages is “heavier” than enabling or disabling daemons... Unfortunately the latter couldn’t be handled automatically in a reliable way, see #947936 for the gory details. Oct 4 at 5:46
  • 1
    "Heavy" it is... this sounds like a number of other systemd issues... but I'm going to follow my advice & let it go at that. :)
    – Seamus
    Oct 4 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .