Why Server Time Matters
- TLS: certificates are valid between two dates. A clock that is far off makes valid certificates look expired or not yet valid.
- Logs: comparing events across servers only works when their clocks agree.
- Two-factor codes: time-based codes, such as those in SSH two-factor authentication, fail when the clock drifts by more than a short window.
- Schedules: cron jobs and database replication depend on correct time.
Which Time Service Your System Uses
timedatectl
Look for "System clock synchronized: yes" and "NTP service: active". AlmaLinux and Rocky Linux use chrony by default. New Ubuntu 26.04 installs use chrony with NTS, which authenticates the time servers. Ubuntu 24.04 and Debian usually use systemd-timesyncd, a smaller client that only sets the clock. Run one time service, never two.
Install chrony
On Debian and Ubuntu systems that still use systemd-timesyncd:
sudo apt install chrony
The package replaces systemd-timesyncd and starts on its own. On AlmaLinux and Rocky Linux it is normally installed; if not:
sudo dnf install chrony
sudo systemctl enable --now chronyd
The service is called chrony on Debian and Ubuntu and chronyd on AlmaLinux and Rocky Linux.
Check the Sync
chronyc tracking
chronyc sources -v
In the tracking output, "Reference ID" names the server the clock follows, "System time" shows the current offset, and "Leap status" should read Normal. In the sources list, the source marked ^* is the one in use, ^+ marks good sources that are combined with it, and ^? marks sources that cannot be reached or have not passed the checks yet. A list of only ^? lines usually means outgoing UDP port 123 is blocked, or TCP port 4460 for NTS sources.
The Configuration File
- Debian and Ubuntu:
/etc/chrony/chrony.conf. - AlmaLinux and Rocky Linux:
/etc/chrony.conf.
Time sources are set with pool or server lines. Debian and Ubuntu can also read extra source files from /etc/chrony/sources.d/. To use a time server with NTS, add the nts option:
server ntp.example.com iburst nts
iburst speeds up the first sync after a start. NTS first contacts the server on TCP port 4460 to exchange keys, then uses NTP on UDP port 123. Restart the service after a change, and check chronyc -N authdata to see whether NTS sources were authenticated.
makestep and Large Offsets
chrony normally corrects the clock gradually, slowing it down or speeding it up, so time never jumps backward under running programs. The default configuration includes a line such as:
makestep 1 3
It allows chrony to step the clock at once if it is more than one second off during the first three updates, which fixes a wrong clock right after boot. To correct a large offset now:
sudo chronyc makestep
Expect a jump in log timestamps when you do this.
chrony vs systemd-timesyncd
- systemd-timesyncd: a simple client that sets the clock from one server at a time. Enough for many single servers.
- chrony: uses several sources, corrects drift more precisely, supports NTS, and can act as a time server for other machines.
On a virtual server, the guest clock is kept by the guest system, so a sync service is needed there too.
Time Zone Is Separate
chrony keeps the clock correct in UTC; the time zone only changes how that time is shown. To set it, see how to change the time zone in Ubuntu. To read the service's own messages, use journalctl with -u chrony or -u chronyd.