In distributed Linux environments, microservice clusters, database replications, and cryptographic security protocols, precise system time synchronization is mandatory. If an Ubuntu server’s clock drifts by even a few seconds, distributed databases (such as CockroachDB or Cassandra) experience transaction conflicts, TLS/SSL certificate validation handshakes fail, and Kerberos authentication tokens expire prematurely. While Ubuntu includes basic time synchronization via systemd-timesyncd, that lightweight client only performs periodic SNTP polls and cannot compensate for clock drift when networks disconnect or high precision is demanded. For mission-critical servers, enterprise networks, and virtual machines, the industry standard is Chrony on Ubuntu.
Why Chrony Outperforms systemd-timesyncd and Classic ntpd
Chrony is a modern implementation of the Network Time Protocol (NTP) optimized for contemporary systems:
- Rapid Clock Synchronisation: While classic
ntpdtakes hours of continuous polling to gradually slew system clocks, Chrony synchronizes the system clock in seconds using aggressive stepping upon boot. - Superior Clock Drift Compensation: Chrony continuously monitors and records the hardware real-time clock’s (RTC) physical drift rate. Even if your server loses network connectivity for hours, Chrony continues adjusting time internally to prevent drift.
- Intermittent Connection Resilience: Engineered to function reliably on mobile laptops, intermittent cellular IoT gateways, and congested cloud VPS networks with packet jitter.
- Hardware Timestamping Support: Capable of utilizing PTP (Precision Time Protocol) hardware timestamping on modern network interface cards (NICs) to achieve sub-microsecond precision.
Step-by-Step: Installing Chrony on Ubuntu
Chrony is distributed directly within the standard Ubuntu repositories across Ubuntu 20.04, 22.04, and 24.04 LTS:
- Update your package index and install the Chrony daemon:
sudo apt update sudo apt install chrony -y - Installing Chrony automatically disables and supersedes Ubuntu’s default
systemd-timesyncdservice, preventing conflicting clock adjustments. - Verify that the Chrony daemon is running and enabled on boot:
sudo systemctl status chrony
Configuring NTP Servers in chrony.conf
Chrony stores its master configuration file in /etc/chrony/chrony.conf:
- Open the configuration file in your terminal editor:
sudo nano /etc/chrony/chrony.conf - Locate the pool or server directives. By default, Ubuntu points to the standard Ubuntu NTP pool:
pool ntp.ubuntu.com iburst maxsources 4 pool 0.ubuntu.pool.ntp.org iburst maxsources 1 pool 1.ubuntu.pool.ntp.org iburst maxsources 1 - To optimize for low latency, you can replace or supplement these with geographically close NTP pool servers (e.g.,
uk.pool.ntp.org) or public ultra-low-latency providers like Cloudflare and Google:server time.cloudflare.com iburst server time.google.com iburst(The
iburstdirective instructs Chrony to send a burst of initial packets upon startup to achieve instant synchronization). - Configure the makestep directive. This allows Chrony to instantly step (jump) the clock rather than slowly slewing if the initial offset exceeds a specific limit:
makestep 1.0 3(Steps the clock if the offset is larger than 1 second, but only during the first 3 clock updates upon boot).
- Save and exit the file (press Ctrl + O, then Enter, followed by Ctrl + X).
- Restart Chrony to apply changes:
sudo systemctl restart chrony
Auditing Time Accuracy with chronyc
Chrony includes a dedicated management utility called chronyc to inspect time sources, offset errors, and network jitter:
1. Checking Active NTP Sources
chronyc sources -v
The terminal outputs a table of upstream time servers. Key indicator symbols:
- ^* (Asterisk): The current primary time source Chrony is synchronized to.
- ^+ (Plus): Acceptable candidate time sources combined into the algorithm.
- ^- (Minus): Cluster outliers discarded by the algorithm.
- ^? (Question mark): Reachability lost or unresolved.
2. Checking Detailed Tracking Statistics
To inspect system clock performance, offset, and stratum level:
chronyc tracking
Look at System time (offset from the reference server) and RMS offset. On healthy servers, the system time offset typically measures in single-digit microseconds or milliseconds.
Chrony vs systemd-timesyncd vs Classic ntpd
| Feature | Chrony | systemd-timesyncd | Classic ntpd |
|---|---|---|---|
| Initial Sync Speed | Instant (seconds via makestep) | Moderate | Very slow (hours of slewing) |
| Offline Drift Compensation | Yes (calculates RTC frequency drift) | No | Limited |
| Local NTP Server Serving | Yes (can act as LAN time server) | No (client only) | Yes |
| Resource Usage | Lightweight C binary | Minimal (part of systemd) | Moderate |
| Virtual Machine Stability | Excellent (handles VM clock pauses) | Basic | Poor |
Troubleshooting Common Chrony Issues on Ubuntu
If Chrony fails to synchronize or reports unsynchronized clocks:
- UDP Port 123 Blocked: NTP operates over UDP port 123. If your corporate firewall, AWS Security Group, or local UFW firewall blocks outbound or inbound UDP port 123 traffic, Chrony cannot reach time servers. Whitelist port 123:
sudo ufw allow out 123/udp. - Conflicting Daemons Running: Ensure classic
ntpdwas not installed alongside Chrony. Runsudo apt remove ntp -yto prevent daemon conflicts over the local NTP socket. - Hardware Clock Synchronization: To write the synchronized system time back to your motherboard’s physical battery-backed RTC, execute
sudo hwclock --systohc.
Frequently Asked Questions
Can I configure Chrony as a local NTP time server for my home lab or office LAN?
Yes. In /etc/chrony/chrony.conf, add the directive allow 192.168.1.0/24. Chrony will accept incoming NTP queries from other computers on that local subnet.
Why does chronyc tracking show Leap status: Normal?
Leap status: Normal indicates that the upstream international time authorities have not scheduled an imminent leap second insertion, and Chrony is tracking time normally.
Does Chrony work inside Docker containers?
Typically, containers share the host Linux kernel’s system clock. Chrony should be installed and managed on the host Ubuntu OS rather than inside individual unprivileged containers.