How Debian Handles Time Synchronization with Chrony
This article provides an overview of how the Debian operating system manages time synchronization using Network Time Protocol (NTP) daemons, focusing primarily on Chrony. It explores Debian’s default out-of-the-box configurations, how full-featured daemons like Chrony integrate into the system, how conflicts between competing services are resolved, and the commands used to monitor and maintain accurate system time.
Default Time Sync: systemd-timesyncd vs. Chrony
In base installations of modern Debian releases (such as Debian 11
Bullseye and Debian 12 Bookworm), minimal network time synchronization
is handled by systemd-timesyncd. This built-in service
implements simple SNTP (Simple Network Time Protocol) to fetch the
current time periodically from remote servers. While sufficient for
basic desktop usage, systemd-timesyncd lacks advanced
features like acting as an NTP server, smooth frequency adjustment, or
fast convergence after clock drift.
For production servers, virtualized instances, and environments
requiring millisecond-level precision, Debian designates Chrony as the
preferred full NTP daemon. When installed via
apt install chrony, Debian's package manager automatically
disables and masks systemd-timesyncd to prevent port
conflicts on UDP port 123 and eliminate conflicting clock
adjustments.
How Chrony Operates in Debian
Chrony consists of two primary components: chronyd, the
background daemon, and chronyc, the command-line control
utility.
Debian preconfigures Chrony to handle common network and hardware anomalies:
- Variable Connections: Chrony adjusts seamlessly to intermittent internet connections and high-latency networks, making it ideal for both laptops and remote cloud instances.
- Fast Synchronization: Using the
makestepdirective, Chrony quickly steps the system clock if the offset is larger than a configured threshold (typically 1 second) during the first few updates, rather than waiting through an extended slew period. - Clock Drift Compensation: Chrony continuously
calculates the internal frequency error of the system clock and saves
this drift rate to
/var/lib/chrony/chrony.drift. This allows Debian to maintain accurate time even if network connectivity is temporarily lost.
Configuration and Debian NTP Pools
Chrony's settings in Debian are located at
/etc/chrony/chrony.conf. By default, Debian points Chrony
to the Debian NTP pool:
pool 2.debian.pool.ntp.org iburst
The iburst option instructs chronyd to send
a burst of initial requests to speed up the first synchronization upon
startup. Debian also enables the rtcsync directive by
default, which copies the synchronized system time to the hardware
Real-Time Clock (RTC) every 11 minutes.
Monitoring and Management
Debian systems use chronyc to inspect the status of the
daemon and verify time sources. System administrators can check the
synchronization status using two primary commands:
chronyc sources -v: Displays an interactive list of active upstream NTP servers, their stratum, polling interval, and reachability.chronyc tracking: Details clock performance, including current offset, frequency drift, root delay, and the specific reference source currently driving the system clock.
Through systemd integration, Chrony runs as an isolated service under
its own unprivileged system user (_chrony), maintaining
strict security standards while keeping Debian system time strictly
accurate.