Skip to content

Trust no asahi-alarm key on a Mac - #155

Merged
maralcbr merged 3 commits into
mainfrom
drop-asahi-alarm
Nov 28, 2026
Merged

maralcbr merged 3 commits into
mainfrom
drop-asahi-alarm

Conversation

@maralcbr

@maralcbr maralcbr commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Warning

Blocked by issue 08 (omacom/omarchy: remove [asahi-alarm] from the Apple pacman.conf templates and installed Macs). Do not merge before it. Installed Macs and current images still have [asahi-alarm] with SigLevel = Required; a Mac whose first boot skips its key can't verify that repository.

Summary

Omarchy 4.6 builds every Mac package in omacom/omarchy-pkgs and drops the asahi-alarm repository. This stops the Mac packages from trusting its key.

 omarchy-mac/
-├── share/omarchy-platform/keyrings   # asahi-alarm-keyring, refreshed by omarchy update
 ├── test/desktop-setup-test.sh        # the platform root names no keyrings
 omarchy-mac-boot/files/usr/lib/omarchy/mac-first-boot/omarchy-mac-first-boot
-  keyrings=(archlinuxarm asahi-alarm)
+  keyrings=(archlinuxarm)              # + omarchy when the image ships it
 tools/hardware/mac-check
-  required repos: core extra alarm asahi-alarm
+  required repos: core extra alarm; WARN while [asahi-alarm] cleanup is pending, FAIL if it returns after the helper's marker

omarchy-mac-drop-asahi-alarm (moved here from omacom/omarchy#19261's migration)

omarchy-mac-drop-asahi-alarm.service   # oneshot, root
  started by  multi-user.target.wants link          (every boot)
              91-omarchy-mac-drop-asahi-alarm.hook  (every transaction while not done, or while [asahi-alarm] is back:
                                                     systemctl --no-block start; skipped in a chroot)
  helper
    done and no [asahi-alarm]: exit                 (done and [asahi-alarm] back, from an older template: clear done, go on)
    wait for /var/lib/pacman/db.lck to go          (never pacman inside pacman)
    if [asahi-alarm] configured
      record inventory once                         (installed ∩ asahi-alarm, kept across retries)
      pending unless: each installed import has its omarchy/* build
                      keyring Required By = None
                      platform keyrings doesn't list it
      drop the section: readlink -f target, temp beside it, mode+owner kept, verified by pacman-conf, mv
    pacman -R asahi-alarm-keyring                   (pending if pacman can't)
    pacman-key --delete 12CE6799…FEB if listed      (by fingerprint, even with repo and package gone)
    report: newer than [omarchy] (steam → pacman -S omarchy/steam), no repository any more
    done only when repo, package and key are verifiably gone

It installs and upgrades nothing. The update that brought this release already took the aurora-* replacements and higher-pkgrel builds from [omarchy], which is listed first. The omarchy-mac release that carries it (0.2.8: edge's 0.2.7 is the earlier #161 release, without it) is published to a channel only together with the imports. Per CONTRIBUTING, its version bump is a separate release/omarchy-mac-0.2.8 pull request after this merges. An older Omarchy's pacman templates still carry [asahi-alarm], so a channel switch or omarchy-refresh-pacman can write it back after the move; the helper then drops it again behind the same guards. Pending runs exit 0 with the reason in the journal, so they never fail the unit or an update. Omarchy's update lock is per user ($XDG_RUNTIME_DIR), so a root unit can't take it; the unit uses pacman's database lock plus its own flock instead.

omarchy-update-keyring reads keyrings only if it exists, so removing the file leaves just Arch's and Arch Linux ARM's keyrings.

Follows omarchy-mac-pkgs#154 (merged). Removing [asahi-alarm] from package resolution is a separate draft, because it only resolves once omarchy-mac and omarchy-mac-boot without the keyring dependency are on edge.

Release together with:

  • the omacom/omarchy-pkgs draft that drops asahi-alarm-keyring from both recipes, re-pinned to this merge
  • the issue 06 image build without [asahi-alarm] and its keyring
  • issue 08's migration

Evidence

  • mac-first-boot-test.sh:
    • Before: expected --populate archlinuxarm asahi-alarm[ omarchy]
    • After: expects --populate archlinuxarm[ omarchy]
  • desktop-setup-test.sh:
    • Before: keyrings staged, naming asahi-alarm-keyring
    • After: no keyrings in the platform root
  • mac-check-test.sh: [asahi-alarm] configured and no marker → WARN repos [asahi-alarm] cleanup pending…, exit 0. With the marker → WARN … is back in pacman.conf after its cleanup; … removes it again at the next boot or pacman transaction, exit 0.
  • drop-asahi-alarm-test.sh (new, ported from Take the Apple Silicon packages from Omarchy instead of Asahi ALARM omarchy#19261's asahi-alarm-repo-migration-test.sh), 13 ok:
    ok - the helper drops [asahi-alarm], its keyring and its key, keeps everything else, and reports what Omarchy does not take over
    ok - the helper is idempotent, with or without its marker
    ok - a repository that comes back after the move is dropped again, behind the same guards
    ok - the helper does nothing on anything but an Apple Silicon Mac
    ok - a Mac without [asahi-alarm], its keyring or its key is marked done untouched
    ok - the asahi-alarm key is deleted by fingerprint when nothing else of it is left
    ok - the helper stays pending, changing nothing, while the channel lacks an Omarchy build
    ok - the helper checks only the imports that are installed
    ok - the repository stays, with its keyring and key, while a package requires the keyring or the platform root lists it
    ok - the helper waits for pacman to release its database, and stays pending if it does not
    ok - a keyring removal that fails stays pending, and the rerun finishes from the recorded inventory
    ok - a symlinked pacman.conf keeps its link; the target is rewritten with its mode
    ok - boot and every pacman transaction queue the helper until it is done or while [asahi-alarm] is back, without running pacman inside pacman
    
    The fixture's [omarchy] carries steam 1.0.0.87-2. The helper reports steam 20241231-4: newer than omarchy's 1.0.0.87-2, so pacman keeps it; switch with: pacman -S omarchy/steam.

Merge Danger

Door: one-way once released

A Mac that boots this first-boot with [asahi-alarm] still in pacman.conf can't verify that repository. Hence the hold.

Blast Radius: every new Mac install

First boot's keyring is created once per install.

Omarchy 4.6 builds every Mac package from source in omacom/omarchy-pkgs
and drops the [asahi-alarm] repository. The platform root names no
keyring for omarchy update to refresh, first boot populates only Arch
Linux ARM's (and Omarchy's) keys, and the hardware check fails a Mac
that still configures [asahi-alarm].
omarchy-mac 0.2.7 ships omarchy-mac-drop-asahi-alarm, run as root by a
oneshot unit at boot and after every pacman transaction until it records
a verified cleanup. It waits for pacman to release its database, keeps
the repository while anything still requires or lists the keyring, then
drops the [asahi-alarm] section (following a symlink, keeping mode and
owner), the keyring package and key 12CE6799 by fingerprint. What came
from the repository is recorded once, and what [omarchy] does not take
over is reported, such as asahi-alarm's steam sorting above Omarchy's.

mac-check warns while the cleanup is pending and fails only when the
repository comes back after it.
An older Omarchy's pacman templates still carry [asahi-alarm], so a
channel switch or omarchy-refresh-pacman can write it back after the
move. The helper now treats done as standing only for a pacman.conf
without it: with the repository back it clears done and moves off it
again behind the same guards. The unit no longer stops at the marker,
and the hook queues a marked machine only while [asahi-alarm] is back.
mac-check warns on a returned repository instead of failing, since the
next boot or pacman transaction removes it.
@maralcbr
maralcbr marked this pull request as ready for review November 28, 2026 03:42
@maralcbr
maralcbr requested a review from scottjones as a code owner November 28, 2026 03:42
@maralcbr
maralcbr merged commit f6f441b into main Nov 28, 2026
4 checks passed
@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5 · The reviewed stack appears safe to merge under the stated release hold, with two non-blocking cleanup gaps.RetriggerView in GreptileConfidence Score: 4/5

[High impact] The PR changes repository trust and cleanup across Apple Silicon Macs.

The reviewed stack appears safe to merge under the stated release hold, with two non-blocking cleanup gaps.

Findings

  1. P2 Removals do not retry cleanup ▶
  2. P2 Failed queries erase package warnings ▶

Summary

Removes automatic trust in the asahi-alarm key and adds a guarded cleanup service for installed Macs.

  • A guarded helper moves installed Macs off the asahi-alarm repository.
  • Mac first boot stops adding the asahi-alarm signing key.
  • Mac checks warn while the old repository remains configured.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Boot[Boot] --> Helper[Run cleanup helper]
  Transaction[Package install or upgrade] --> Queue[Queue service]
  Queue --> Helper
  Helper --> Wait[Wait for pacman]
  Wait --> Guards{Required builds and keyring checks pass?}
  Guards -->|No| Pending[Leave cleanup pending]
  Guards -->|Yes| Remove[Remove repository, package and key]
  Remove --> Report[Write package report]
  Report --> Done[Record cleanup complete]
Loading

Reviews (1) · Last reviewed commit: "Drop [asahi-alarm] again when an old tem..." · Reviewed by Greptile

Comment on lines +7 to +9
Operation = Install
Operation = Upgrade
Target = *

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Removals do not retry cleanup

The hook runs after installs and upgrades, but not removals. If cleanup is waiting for a package that requires asahi-alarm-keyring, removing that package does not queue another attempt. Cleanup waits for a reboot or an unrelated install or upgrade. Add Operation = Remove so removing the last blocker also retries cleanup.

Suggested change
Operation = Install
Operation = Upgrade
Target = *
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +58 to +59
comm -12 <(pacman -Slq "$repo" | sort -u) <(pacman -Qq | sort) >"$state/inventory.new"
mv -f "$state/inventory.new" "$state/inventory"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Failed queries erase package warnings

If the repository database is missing or unreadable, pacman -Slq can fail without making comm fail. The helper then saves an empty inventory file and never rebuilds it. Later reports permanently miss packages that no longer get updates. Check that both package queries succeed before saving the inventory.

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.

1 participant