The clock is not synchronised
- Check
time.sync- Severity
- low
- Runs
- on the server, in the daily run of the agent
- Looks at
- systemd-timesyncd, chrony or ntpd active and synchronised
What the check looks at
The agent looks for a running time service (systemd-timesyncd, chrony or ntpd) and asks the kernel whether
the clock is synchronised. That is the same state that timedatectl status shows in the line
System clock synchronized.
Why it matters
A clock that drifts by minutes or days breaks things that depend on time:
- TLS certificates have a start and an end date. A wrong clock makes valid certificates look expired or not yet valid, and outgoing HTTPS calls, package downloads and API clients fail.
- One-time codes (TOTP) are valid for a short time step, 30 seconds by default.
- Logs of several servers can only be lined up during an incident when their clocks agree.
The severity is low because a missing time service does not open a way in, but the failures it causes are hard to trace.
How to fix it
Debian and Ubuntu
Both systemd-timesyncd and chrony are packaged; install one of them. The two packages conflict, so installing one removes the other.
sudo apt install systemd-timesyncd
sudo timedatectl set-ntp true
or
sudo apt install chrony
RHEL, Rocky Linux and AlmaLinux
chrony is the default:
sudo dnf install chrony
sudo systemctl enable --now chronyd
Alpine
sudo apk add chrony
sudo rc-update add chronyd default
sudo rc-service chronyd start
The time service needs outgoing UDP to port 123. If a firewall blocks outgoing traffic, allow it to the NTP
servers named in the configuration (/etc/systemd/timesyncd.conf, /etc/chrony/chrony.conf on Debian and
Ubuntu, /etc/chrony.conf on RHEL).
How to check the fix
timedatectl status
The lines System clock synchronized: yes and NTP service: active show that it works. With chrony:
chronyc tracking
chronyc sources
Leap status : Normal in the first output and a source marked ^* in the second mean the clock follows a
server.
When a warning is fine
Right after a boot, the first synchronisation can take a minute or two; the next report clears the warning.
On a virtual machine without network access to any NTP server, where the hypervisor keeps the clock, check
once that the time is right with date -u, then accept the result on the dashboard.
An accepted result is left out of the digest and the counts until it changes; then it shows again.
Sources
- timedatectl(1) —
status,show,set-ntp - chronyc(1) —
trackingandsourcesoutput - RFC 6238, TOTP — default time step of 30 seconds