chrony: time synchronization over NTP
cheat sheet · Ubuntu 24.04 · chrony 4.5 https://lab.dimsanych.ru/en/wiki/chrony/Cheat sheet
-
chronyc trackingis the clock in sync, and how close -
chronyc sourcestime servers and their state -
chronyc sourcestatsoffset and spread per server -
sudo chronyc reload sourcesreread /etc/chrony/sources.d -
sudo chronyc burst 4/4poll the servers now -
sudo chronyc makestepcorrect the clock in one step -
chronyc waitsync 10 0.5wait for sync (for scripts) -
sudo systemctl restart chronyreread chrony.conf and conf.d
Configuration
Files and directories
The main file is /etc/chrony/chrony.conf. In Ubuntu 24.04, without
comments, it is:
Your own settings go into two directories:
| Directory | Files | How to apply |
|---|---|---|
/etc/chrony/conf.d/ |
*.conf — any directives |
sudo systemctl restart chrony |
/etc/chrony/sources.d/ |
*.sources — only server, pool, peer |
sudo chronyc reload sources |
reload sources rereads only sources.d: a server line in conf.d
does not appear after it, a restart is needed. The lab machine has no
network to the outside, the pool names do not resolve, and
chronyc activity prints 16 sources with unknown address — these
lines do no harm.
Directives are in the table below; the full list is man chrony.conf.