Linux Labs

Inside the system: resources, kernel, processes / Stage 11 of 12

Time, time zone and synchronisation

Not running Starting usually ~20 s
Leave the lesson

Step 4 of 7 · on a machine · 6 min

Clocks drift

Even a clock that was set right drifts with time: on every machine it runs a little fast or slow.

That is why clocks are checked against a time server over the NTP protocol. On a clean machine systemd-timesyncd does this: timedatectl shows it as NTP service: active. The machine has no network, the service finds no server, and System clock synchronized stays no.

Servers often get chrony instead: it is more precise and can hand out time to other machines. The chronyd service keeps the clock, and chronyc shows its state. chrony takes its time servers from /etc/chrony/chrony.conf and the files /etc/chrony/sources.d/*.sources — as server <name> iburst lines. On this machine chrony is already installed and checks against the training server time.lab.test.

Exercise · look

Look at the clock and chrony

The machine's clock is checked through chrony against the time server time.lab.test. Look at what timedatectl shows, which servers chrony works with and how far apart the clocks are.

First, predict

chrony is running and can see the time server. Will the machine's clock match the server?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in

chronyc sources lists the servers (in the Wiki). ^* marks the server chrony is keeping the clock by right now, ^? a server that does not answer. Reach is an octal record of the last eight requests: 377 means all of them were answered, 0 — none. chronyc tracking is the summary (in the Wiki): Reference ID is the chosen server, and System time says how far the machine's clock is ahead (fast) or behind (slow) it.

Ubuntu 24.04
Loading…