systemd-timesyncd

From LinuxReviews
Jump to navigationJump to search

systemd-timesyncd is a network time synchronization daemon bundled with systemd. It is small and simple and it works, but it is not as powerful as other other NTP client and server software.

Configuration[edit]

systemd-timesyncd is configured by the file /etc/systemd/timesyncd.conf and its system service is named systemd-timesyncd.service. Its configuration file can be as simple as two lines with NTP= and FallbackNTP= and a list of NTP servers separated by whitespace.

[Time]
NTP=ntp.uio.no gbg1.ntp.se gbg2.ntp.se sth1.ntp.se sth2.ntp.se
FallbackNTP=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org 2.fedora.pool.ntp.org 3.fedora.pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048

RootDistanceMaxSec sets the maximum distance to a root server in seconds. The default is five - which is a lot.

PollIntervalMinSec and PollIntervalMaxSec chooses how frequently systemd-timesyncd asks the configured NTP servers what time it is. PollIntervalMinSec can not be lower than 16.

You can check if this service is running with systemctl status systemd-timesyncd.service

systemctl enable systemd-timesyncd.service makes it start when the machine is booted and

systemctl disable systemd-timesyncd.service makes sure it does not start.

Advantages and Disadvantages[edit]

systemd-timesyncd is a client-only NTP server and is not very advanced or good at smoothly adjusting the clock if it is wildly off.

systemd-timesyncd saves the clock to disk every single time it adjusts the clock. This may be good if your system clock is broken and you reboot. The saved timestamp will be wildly off if you leave the machine turned off for a day. This "feature" is not an advantages if the system clock is working. It causes regular disk I/O (though it is small) and it can not be turned off.

See also[edit]