Where to start First steps track · 15 stages
Linux Labs

chrony: time synchronization over NTP

cheat sheet · Ubuntu 24.04 · chrony 4.5 https://lab.dimsanych.ru/en/wiki/chrony/

Cheat sheet

  • chronyc tracking is the clock in sync, and how close
  • chronyc sources time servers and their state
  • chronyc sourcestats offset and spread per server
  • sudo chronyc reload sources reread /etc/chrony/sources.d
  • sudo chronyc burst 4/4 poll the servers now
  • sudo chronyc makestep correct the clock in one step
  • chronyc waitsync 10 0.5 wait for sync (for scripts)
  • sudo systemctl restart chrony reread 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:

text
confdir /etc/chrony/conf.d
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
pool 2.ubuntu.pool.ntp.org iburst maxsources 2
sourcedir /run/chrony-dhcp
sourcedir /etc/chrony/sources.d
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
ntsdumpdir /var/lib/chrony
logdir /var/log/chrony
maxupdateskew 100.0
rtcsync
makestep 1 3
leapsectz right/UTC

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.

Loading…