Guest time synchronization validation
The unreleased implementation on main following Barn 1.2.0 provides manual host-relative clock correction, startup checks, and optional OS-scheduled checks. Validation covered seven Linux distributions, the four-node EL10 offline lab, and an additional clean EL8 guest. Real host sleep/resume remains unverified.
The command reference describes the resulting interface.
Implementation
barn time status measures host-relative offsets and reports guest NTP state. barn time sync forces and verifies a correction on selected running guests, defaulting to all applied nodes, after converging exited VM runtimes under the deployment lock. Startup commands check selected ready nodes and report time failures separately from management SSH readiness.
barn time auto enable/disable/status manages a per-user launchd calendar job or systemd oneshot timer. Checks run every minute, use a two-second correction threshold, skip busy deployments, and retain the latest result. Transport failures before measurement get one retry within the existing deadline. Repeated drift during continuous guest execution while guest NTP is synchronized produces a source-conflict diagnostic, whereas host sleep, VM pause, and guest reboots are distinguished using the guest monotonic clock.
The implementation lives under cmd/barn/command_time.go, internal/private/time.go, internal/timesync/, and internal/timejob/, with lifecycle integration in cmd/barn/lifecycle_integrations.go. Matching tests cover process cancellation, early SSH exit, trailing protocol output, high latency, wrong guest identity, incomplete guest setup, exited VM settlement, host sleep vs. NTP conflicts, structured CLI error contracts, selected-node scope, timer registration, removal, and purge cleanup. The guest helper uses Python 3.6-compatible interfaces.
Real guest results
The final manual correction completed at 2026-11-19 21:39:41 +08:00. The table shows absolute estimated offsets after correction and reported measurement uncertainty, in milliseconds. These are measurements from this run, not a precision guarantee.
| Guest group | Nodes | Maximum absolute offset | Maximum uncertainty |
|---|---|---|---|
| Rocky 9 | 1 | 0.030 | 0.146 |
| Rocky 10 single node | 1 | 0.008 | 0.126 |
| Debian 12 | 1 | 0.043 | 0.093 |
| Debian 13 | 1 | 0.016 | 0.098 |
| Ubuntu 22.04 | 1 | 0.041 | 0.133 |
| Ubuntu 24.04 | 1 | 0.0004 | 0.131 |
| Ubuntu 26.04 | 1 | 0.040 | 0.085 |
| EL10 four-node offline lab | 4 | 0.039 | 0.138 |
| Clean Rocky 8, Python 3.6.8 | 1 | 0.444 | 0.425 |
The existing seven single-node guests initially lagged the host by roughly 15–16 minutes. Management SSH corrected their clocks without reopening Internet access. EL8 used Barn’s existing arm64 TCG path on Apple Silicon.
Lifecycle and timer checks
| Check | Observed result |
|---|---|
| Clean EL10 startup | Ready; no time synchronization warning |
Inject a 120-second positive offset, then barn start |
Corrected to about −0.29ms |
| Inject a 180-second negative offset, then enable the macOS timer | Launchd corrected the guest; the deployment check had no failed nodes |
| macOS periodic scheduling | Multiple calendar invocations observed with exit status 0 |
| Linux user timer | Enabled, fired, reported its latest result, and disabled inside an EL10 arm64 guest |
Paths with spaces, %, and $ |
Linux timer preserved the executable/data paths |
| Temporarily unavailable guest SSH | Exit 5 with one failed node; the other node was checked; SSH was restored |
| Initial SSH exit 255 | One retry succeeded in about 1.225 seconds |
| Four-node EL10 service check | Patroni, Chrony, HAProxy and node_exporter active on all four; Docker active on the infrastructure node |
The Linux timer check ran the actual Linux CLI and systemd user manager inside the guest. The full Linux-host virtualization path and x86_64 guests were not replayed in this validation; the source checks include all four host build targets.
Remaining acceptance and evidence
The source make check passed, including unit/race tests, static checks, cross-compilation, installer and image-pipeline checks, and license verification. The companion documentation’s make check also passed, including a production build and internal link and asset checks across 307 HTML pages.
Actual host sleep/resume requires a user-assisted sleep and wake: passwordless host sudo is unavailable, so an automatic wake could not be scheduled, and the host was not put to sleep during this run. VM startup and injected drift tests are recorded separately from this remaining acceptance item.
Existing offline guests still lack a reachable NTP source. Direct correction does not establish NTP synchronization or guarantee removal of Pigsty’s NodeTimeDrift alerts; configure a reachable host/internal NTP service for that requirement.
Raw validation logs, input inventories, and SHA-256 records from the 2026-11-19 run were archived outside the Git repository, and all temporary test VMs and scheduler registrations were cleaned up after verification.