Keeping system time correct
Keeping the clock right: setting it by hand, synchronising it with NTP or chrony, and the systemd command that has quietly replaced most of the older ones.
Lesson 1 of 4 in objective 108. Essential system services, part of LPIC-1 Exam 102-500.
Setting it by hand, and why that is not enough
date prints the system time and, given a +FORMAT string, prints it however you like; date -s sets it. hwclock talks to the firmware clock, the battery-backed one on the board that keeps time while the machine is off: hwclock --systohc (or -w) copies system time into it and hwclock --hctosys (or -s) copies it back, which are the two directions worth remembering by name. Setting a clock by hand is always a correction, never a solution — quartz drifts, and a machine left alone will be seconds out within weeks and minutes out within a year.
hwclock writes to hardware, so it is an administrative tool and lives with the others: /sbin/hwclock, or /usr/sbin/hwclock on a merged system. A question that gives the full path is asking whether you know that an ordinary user cannot set the hardware clock. /etc/adjtime is where it records the drift it has measured, and whether the hardware clock is being kept in UTC or in local time.
The time ZONE is separate from the clock. /etc/localtime is the file the C library reads to convert the stored UTC into local time, and it is a copy of — or, on most distributions, a symlink to — one of the zone files under /usr/share/zoneinfo, so /etc/localtime pointing at /usr/share/zoneinfo/Europe/Berlin IS how the machine knows it is in Berlin. Debian family systems also keep the name in /etc/timezone. timedatectl set-timezone Europe/Berlin does the whole thing on a systemd machine, and timedatectl list-timezones prints the names it will accept.
timedatectl Local time: Mon 2026-08-03 19:24:11 CEST RTC time: Mon 2026-08-03 17:24:09 Time zone: Europe/Berlin (CEST, +0200)System clock synchronized: yesls -l /etc/localtime... /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin/sbin/hwclock --systohcsystem time written into the battery-backed clock
Synchronising
NTP arranges servers in strata: stratum 0 is a reference clock such as GPS or an atomic clock, stratum 1 is a server directly attached to one, and each level below is one hop further away. A client picks servers, measures round-trip delay, and steers its clock gradually rather than jumping — because a clock that jumps backwards breaks anything that assumes time only moves forward.
The classic daemon is ntpd, configured in /etc/ntp.conf with server or pool lines, and queried with ntpq -p, which prints the peers and which one is currently selected. chrony is the modern replacement, configured in /etc/chrony.conf and queried with chronyc sources; it copes far better with intermittent connections and virtual machines. ntpdate set the clock once at boot and is deprecated in favour of the daemons doing it properly.
Both configurations offer the same pair of directives, and the difference between them is asked directly. server binds ONE source. pool names something expected to resolve to several addresses and binds several of them as independent sources, which is what the public pool.ntp.org names are for — the numbered prefixes 0. through 3. exist so a host can list several pool lines and be handed different sets of servers. Per-source options are written after either directive: iburst sends a short rapid burst on the first exchange so a freshly booted machine synchronises in seconds rather than minutes, and maxsources caps how many sources are taken from a pool, so pool 2.pool.ntp.org iburst maxsources 4 yields at most four.
On a systemd machine, systemd-timesyncd is a lightweight SNTP client that does the common case, and timedatectl set-ntp true turns it on. timedatectl is also where you read whether the clock is synchronised at all.
Worth carrying in
- date -s "…"
- Set the system clock. date +FORMAT prints it your way.
- /sbin/hwclock --systohc
- System clock to hardware clock.
-wis the same;--hctosysand-sare the other direction. - /etc/localtime
- The zone file the C library reads. A copy of, or a symlink to, one under
/usr/share/zoneinfo. - timedatectl set-timezone
- Set the zone by name.
list-timezonesprints the names it accepts. - /etc/ntp.conf
- ntpd configuration: server and pool lines.
- ntpq -p
- Peers and which is selected.
- chronyc sources
- The chrony equivalent;
/etc/chrony.confis its configuration. - pool … iburst maxsources 4
- One name, several sources, capped at four.
serverbinds exactly one. - timedatectl set-ntp true
- Turn on systemd-timesyncd synchronisation.
- stratum
- Distance from a reference clock. Stratum 0 is the reference itself.
What the exam does with this
- Stratum 0 is the reference clock, stratum 1 the server attached to it. Off-by-one here is a whole question.
- ntpd and chrony do the same job;
ntpdateis the one-shot tool that has been deprecated. - NTP steers the clock gradually rather than stepping it, except at startup.
- The clock and the ZONE are different questions.
/etc/localtimedecides what local time is called;hwclockand NTP decide what the instant is.
- Objective
- 108. Essential system services
- Share of the exam
- 18.33% (the whole objective)
- Questions in this lesson
- 15
- Signed for by a person
- 0
Partly checked. None of the 15 questions here has been read against the cited source by a person. 15 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.
Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
Drill this lesson
A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.
Practise Keeping system time correct
Questions in this lesson
- You corrected the running system's clock with `date -s`, but after the next power cycle the machine came back with the old wrong time. Which command copies the corrected system clock into the hardware (RTC) clock? machine-checked
- On a systemd-based distribution, which file determines the local time zone used by the C library when formatting times? machine-checked
- A host runs chrony as its NTP client. Which command shows the list of time sources chrony is currently talking to and how it rates each one? machine-checked
- In /etc/ntp.conf you find the line `server 0.pool.ntp.org iburst`. What does the `iburst` keyword do? machine-checked
- A minimal systemd host synchronises its clock with systemd-timesyncd. Which statement about that service is accurate? machine-checked
- On a systemd host, type the single command that turns on automatic network time synchronisation (do not include a path). machine-checked
- You have just set the system clock correctly by hand and want the hardware clock to match, so the correction survives a reboot. Type the command, using its short option. machine-checked
- A monitoring script must stamp every record it writes with the current time expressed as a plain integer count of seconds since the Unix epoch. Which command prints exactly that value and nothing else? machine-checked
- A systemd host was installed with the wrong region and reports timestamps in UTC. Every user on it should see local time for Europe/Lisbon from now on. Which command makes that the system-wide setting? machine-checked
- An isolated machine has no network time source. Its battery-backed real-time clock is known to be right, but a script has left the running system clock hours adrift. Which command copies the hardware clock's time into the running system clock? machine-checked
- A workstation dual-boots with an operating system that keeps the real-time clock in local time, so Linux must not assume the RTC holds UTC. Which file records whether the hardware clock is interpreted as UTC or as local time when hwclock is invoked without --utc or --localtime? machine-checked
- A host that runs no time daemon has come up several minutes fast. Before starting the applications you want one command that contacts an NTP server, sets the system clock from the reply and then exits. Which command is the traditional tool for that? machine-checked
- ntpd has been running for an hour on a server. You want a table of the configured servers with their stratum, poll interval and current offset, in which the peer the daemon has actually selected is marked. Which command produces it? machine-checked
- A client's /etc/chrony.conf contains the line `pool 2.pool.ntp.org iburst maxsources 4`. Which TWO statements about that line are correct? (Choose two.) machine-checked
- Type the absolute path of the directory holding the system's compiled time-zone files — the tree that /etc/localtime normally points into. machine-checked
Practise Keeping system time correct
The rest of objective 108
- Keeping system time correct — you are here
- System logging
- Mail transfer agent basics
- Printers and printing