systemd-timesyncd
is a daemon that has been added for synchronizing the system clock across the network.
It implements an SNTP client. In contrast to NTP implementations such as chrony or
the NTP reference server this only implements a client side, and does not bother with
the full NTP complexity, focusing only on querying time from one remote server and
synchronizing the local clock to it. The daemon runs with minimal privileges, and
has been hooked up with networkd to only operate when network connectivity is available.
The daemon saves the current clock to disk every time a new NTP sync has been acquired,
and uses this to possibly correct the system clock early at bootup, in order to accommodate
for systems that lack an RTC such as the Raspberry Pi and embedded devices, and make
sure that time monotonically progresses on these systems, even if it is not always
correct. To make use of this daemon a new system user and group "systemd-timesync"
needs to be created on installation of systemd.
The default configuration is set during compilation, so configuration is only needed
when it is necessary to deviate from those defaults. Initially, the main configuration
file in /etc/systemd/ contains commented out entries showing the defaults as a guide
to the administrator. Local overrides can be created by editing this file or by creating
drop-ins, as described below. Using drop-ins for local configuration is recommended
over modifications to the main configuration file.
In addition to the "main" configuration file, drop-in configuration snippets are read
from /usr/lib/systemd/*.conf.d/
, /usr/local/lib/systemd/*.conf.d/
, and
/etc/systemd/*.conf.d/
. Those drop-ins have higher precedence and override the main configuration file.
Files in the *.conf.d/ configuration subdirectories are sorted by their filename in
lexicographic order, regardless of in which of the subdirectories they reside. When
multiple files specify the same option, for options which accept just a single value,
the entry in the file sorted last takes precedence, and for options which accept a
list of values, entries are collected as they occur in the sorted files.
When packages need to customize the configuration, they can install drop-ins under
/usr/. Files in /etc/ are reserved for the local administrator, who may use this logic
to override the configuration files installed by vendor packages. Drop-ins have to
be used to override package drop-ins, since the main configuration file has lower
precedence. It is recommended to prefix all filenames in those subdirectories with
a two-digit number and a dash, to simplify the ordering of the files.
To disable a configuration file supplied by the vendor, the recommended way is to
place a symlink to /dev/null in the configuration directory in /etc/, with the same
filename as the vendor configuration file.
Note:
- The recommendations in this section only apply if timesyncd is in use on the system
-
The systemd-timesyncd service specifically implements only SNTP.
- This minimalistic service will set the system clock for large offsets or slowly adjust
it for smaller deltas
- More complex use cases are not covered by systemd-timesyncd
- If chrony or ntp are used, systemd-timesyncd should be stopped and masked, and this
section skipped
- One, and only one, time synchronization method should be in use on the system