Files
mesh-catalog/modules/time-sync/README.md
T
jochen 21d8a7f6b4 time-sync: one time daemon, timesyncd, with its servers declared
Three machines ran timesyncd and one ran ntpd. The module declares
timesyncd running with a 50-mesh.conf drop-in (European pool) and ntp absent
(hq ADR 0180). A run-once step of its Go binary stops and disables ntpd first
and takes out only dangling wants-links, so removing the package leaves no
enabled unit pointing at nothing. A provider's drop-in sorting after the
mesh's still wins and is reported, not removed. Tools: time_sync_status,
_servers, _sync_now (to-be 42 Phase 1).
2026-10-04 12:50:20 +02:00

40 lines
2.2 KiB
Markdown

# time-sync
The machine's clock, kept by one daemon: systemd-timesyncd (novox/hq to-be 42 Phase 1,
research 027).
## What it owns
- `/etc/systemd/timesyncd.conf.d/50-mesh.conf`, written whole: `NTP=` the four European pool
servers, `FallbackNTP=` the distribution's pool.
- `systemd-timesyncd.service`, running and enabled, and restarted when the drop-in changes.
- `ntp`, declared **absent** (ADR 0180).
- A **step**, `time-sync-retire-ntpd`. The host runs the module's own binary once per version of the
bundle, as root, *before* timesyncd is started and ntp removed:
`time-sync-tools retire ntpd.service ntpdate.service`. The step stops and disables each unit that
is installed and running or enabled. Removing a package does not disable its units, so without the
step ntp's removal would leave `multi-user.target.wants/ntpd.service` pointing at nothing. Where
the package is already gone, the step takes out only such a dangling link, never a link it can
still follow.
## What it improves
- One daemon on every machine. Three ran timesyncd and one ran ntpd, with timesyncd disabled.
- The servers are declared, not left to whatever a machine was installed with. One machine had
edited `timesyncd.conf` itself; the drop-in now overrides that.
## What it leaves found
- **A hosting provider's own drop-in.** On a machine whose provider installed a timesyncd drop-in
(found on the anchor), that file sorts after `50-mesh.conf`, so its servers win. They are in the
same network as the machine. It is kept, and `time_sync_servers` names it as the file that decides.
- `/etc/systemd/timesyncd.conf`, and an `/etc/ntp.conf` that the package manager keeps as `.pacsave`.
## Tools
| tool | | answers |
|---|---|---|
| `time_sync_status` | r | synchronised, NTP on, timesyncd's unit; server, offset, delay, jitter (ms), stratum, packets, and every line of `timesync-status`; any other time daemon installed. If timesyncd is not running, that is said, not failed |
| `time_sync_servers` | r | the server in use; system, fallback, link and runtime servers; every config file in reading order with what it sets; which file decides |
| `time_sync_sync_now` | a | restarts timesyncd (sudo -n) and answers the status after waiting up to 10 s for a packet |