Skip to content

Trust the Asahi Alarm signing key during the Quattro upgrade - #262

Open
JeanBaeez wants to merge 1 commit into
omacom:quattrofrom
JeanBaeez:fix/upgrade-asahi-keyring
Open

JeanBaeez wants to merge 1 commit into
omacom:quattrofrom
JeanBaeez:fix/upgrade-asahi-keyring

Conversation

@JeanBaeez

Copy link
Copy Markdown

install.sh learned to bootstrap the Asahi Alarm signing key before it refreshes the package databases (b3770ce, #229). The Quattro upgrade refreshes the same databases from its own copy of that code path and never got the same treatment, so a 3.x Mac that was put together on a generic aarch64 base still walks into #235 — just later, and with a worse error.

ensure_arm_package_repo adds the [omarchy-aarch64] stanza and then runs pacman -Sy. On a machine whose /etc/pacman.conf also carries [asahi-alarm] without asahi-alarm-keyring installed, pacman stops on the unknown master key:

error: asahi-alarm: key "12CE6799A94A3F1B5DDFFE88F576553597FB8FEB" is unknown
error: failed to synchronize all databases (unexpected error)

The refresh output is discarded and the failure is downgraded to a warning, so the upgrade continues and install_quattro_packages reports the misleading database file for 'asahi-alarm' does not exist instead — for a package that has nothing to do with the key.

This ports ensure_asahi_alarm_keyring from install.sh verbatim and calls it before the refresh. Both guards are kept: no [asahi-alarm] stanza means nothing to trust, and an already-installed keyring is left alone, so a Mac installed from the Asahi Alarm image (the common case) does not touch a keyserver on upgrade.

The upgrade script is self-contained by design — 3.x users pipe it straight from curl — so it carries its own copy rather than sourcing the installer. The test pins the fingerprint to install.sh's, since that is the part that would go quiet if the two ever drift.

Tests

test/shell.d/upgrade-to-quattro-mac-test.sh gains the wiring checks that install-mac-test.sh already makes for the installer, plus a stubbed run of the function itself covering all three paths (no stanza, keyring present, keyring missing).

bash test/shell.d/upgrade-to-quattro-mac-test.sh   # 12 ok
bin/omarchy commands --check                       # 453 commands
bash -n on both changed files

./test/all has four failures on my machine that are also present on a pristine quattro checkout, so they are not from this change: two want a sibling omarchy-pkgs checkout for PKGBUILD coverage, and two need a live session (config-test's per-screen IPC count, theme-install-guards-test's URL check).

Reverting the bin/ change alone fails the new test.

Note

Overlaps textually with #250, which restructures the same function. Whichever lands first, I'll rebase.

install.sh trusts the asahi-alarm master key before refreshing the package
databases; the upgrade carries its own copy of that path and did not, so a
3.x Mac on a generic aarch64 base fails the refresh on an unknown key and
reports a missing database from the package pass instead (omacom#235).

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bootstrap itself is right — same fingerprint I verified against the installed asahi-alarm-keyring package, ordering pinned before the refresh, and pinning the key against install.sh's copy so the two cannot drift is a nice touch. One placement problem below.

log "Adding the Omarchy ARM package repo"
printf '\n%s\n' "$block" | sudo tee -a /etc/pacman.conf >/dev/null

ensure_asahi_alarm_keyring

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure_arm_package_repo returns early on its first line when [omarchy-aarch64] is already in pacman.conf, so the bootstrap called from here never runs on those machines. Confirmed with a fake pacman.conf carrying both stanzas: zero pacman-key invocations.

The two conditions are unrelated — #235 is about [asahi-alarm] present without its keyring — and the realistic way in is a retry: the upgrade fails during the package pass (exactly the symptom this fixes), the ARM stanza was already written on that attempt, so the second run takes the early return and skips the fix.

Suggestion drops the call from here:

Suggested change
ensure_asahi_alarm_keyring

and it wants to move into main() instead, just above ensure_arm_package_repo:

  validate_quattro_tree
  ensure_asahi_alarm_keyring
  ensure_arm_package_repo
  install_quattro_packages

That is reachable whatever pacman.conf already contains, and reads more honestly — trusting a signing key has nothing to do with adding a package repo. Your ordering assertion still holds, since it stays above the refresh. (I could not attach a suggestion to main() directly, since those lines are not part of this diff.)

@malik-na

malik-na commented Sep 9, 2026

Copy link
Copy Markdown
Member

Move ensure_asahi_alarm_keyring into main before ensure_arm_package_repo; the current early return skips it whenever the ARM stanza already exists. Then rebase onto current quattro and rerun the retry case.

@wesleygrimes wesleygrimes added the defer Parked. Needs a decision, or may die with the fork. Do not close or port yet. label Sep 12, 2026
@malik-na malik-na added lvl 0 Core userspace: display, audio, video, graphics, memory, storage, battery, keyboard, network, BT. US labels Sep 18, 2026

This branch has not been deployed

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

Labels

defer Parked. Needs a decision, or may die with the fork. Do not close or port yet. lvl 0 Core userspace: display, audio, video, graphics, memory, storage, battery, keyboard, network, BT. US

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants