Skip to content

Wait for the clock to sync before updating when it is behind the keyrings - #19587

Open
seanfreiburg wants to merge 1 commit into
omacom:quattrofrom
seanfreiburg:fix/update-wait-for-clock-sync
Open

seanfreiburg wants to merge 1 commit into
omacom:quattrofrom
seanfreiburg:fix/update-wait-for-clock-sync

Conversation

@seanfreiburg

Copy link
Copy Markdown

What changes

Fixes #19584.

Apple Silicon reads its RTC as 1970, so for the first minute or so after boot the system clock sits at the epoch until timesyncd syncs. An omarchy update started in that window failed in omarchy-update-keyring: gpg rejected every key as "created 20682 days in the future", and pacman-key stopped with could not be locally signed. The snapshot and the dev checkout's HTTPS fetch run earlier on the same clock, so they were wrong too.

omarchy update now runs omarchy-update-time --if-behind right after sudo authorization, before pruning, the snapshot, the dev fetch, the keyrings and the main transaction:

  • It acts only when the clock is unsynced and earlier than the mtime of /usr/share/pacman/keyrings, i.e. provably behind. Any other clock is left alone, so a network that blocks NTP adds no wait to every update.
  • It then restarts systemd-timesyncd (only if that is the running NTP client, so chrony is not displaced) and waits up to 30 seconds.
  • If the clock never catches up, the update stops with a message saying the clock is wrong and how to fix it, instead of a gpg error.

Plain omarchy-update-time (Update › Time) behaves as before.

Related: #13629 waits for NTP before snapshotting, for the opposite dual-boot clock-ahead case. #15019 and #18434 make timesyncd resync sooner.

Verification

  • New test/shell.d/update-time-test.sh, fully stubbed (sudo, systemctl, timedatectl, sleep): a clock behind the keyrings restarts timesyncd and waits until it syncs; one that never syncs fails with the reason and leaves a non-timesyncd NTP client alone; an unsynced clock past the keyrings returns at once. The last two fail on the base branch.
  • Added the new step to the stubbed step lists in the update sequence, lock and disk-space tests and the sudo-boundary fixture. Without the stub the tests fell through to the installed omarchy-update-time and ran a real systemctl restart.
  • Ran update-time, update-sequence, update-lock, update-disk-space, update-hangup, update-hook-security, update-user-path, update-boot-verify, update-restart-phases and ./test/cli: all pass.
  • On the affected machine (MacBook Pro M1 Max, Asahi, Omarchy 4.5.0 stable), I confirmed the cause from the journal: RTC time: 1970-01-01, and timesyncd's initial sync came after the failed update. I haven't yet booted it with this branch and updated inside that window.

Screenshots

No visible change: update-pipeline step; the only output is a terminal message when the clock is behind.

🤖 Generated with Claude Code

…ings

Apple Silicon reads its RTC as 1970, so an update started right after boot
ran on an epoch clock and failed in the keyring step with keys "created in
the future". omarchy update now runs omarchy-update-time --if-behind first:
a clock older than the installed keyrings restarts timesyncd and is waited
for, and stops the update with the reason if it never syncs.

Fixes omacom#19584

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds omarchy-update-time --if-behind after sudo authorization and before cache pruning, snapshots, source fetches, and signing-key updates.

  • Updates check a clock that is clearly behind before continuing.

Review was based on code inspection; no tests were run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Sudo authorization] --> B{Unsynchronized and behind keyrings?}
  B -- No --> F[Continue update]
  B -- Yes --> C[Restart timesyncd only if active]
  C --> D[Check clock for up to 30 polls]
  D --> E{Clock no longer wrong?}
  E -- Yes --> F
  E -- No --> G[Explain clock problem and stop]
  F --> H[Prune cache and create snapshot]
  H --> I[Fetch sources and update signing keys]
Loading

Reviews (1) · Last reviewed commit: "Wait for the clock to sync before updati..." · Reviewed by Greptile

@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 High in Codex read this diff, the update/keyring call paths, the quattro contributor rules, and the report in #19584 at head 6108d7ac47edb9f57ff61b7b3d6a14eb25ab124c. My assessment is bug, but the configured second classifier (deepseek-v4p1-flash) returned no classification, so classification remains unsettled.

No worker tests or reproduction ran, and no second model completed a review of this pull request. The availability check found that the primary reviewer, Opus 5.5 High, did not answer; the muse-wonder panel member answered the availability probe only. This is waiting on the maintainer to restore classification/review availability and rerun triage before verification can continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy update fails at the keyring step when the clock hasn't synced yet after boot (Apple Silicon RTC reads 1970)

2 participants