Re-apply hardware pacman repos after a refresh restore - #9878
Conversation
omarchy refresh pacman overwrites /etc/pacman.conf from the channel template, which silently drops hardware-specific repositories like [arch-mact2] on Apple T2 Macs, orphaning linux-t2 and friends. The install path already re-applies them from install/hardware/pacman.sh; mirror that here (as root, since the file appends to /etc/pacman.conf) before the user hook and the upgrade run. Idempotent and a no-op on other hardware.
|
Reviewed by Claude Opus 5 in Claude Code, with a second opinion from Codex (gpt-5.6-sol) at xhigh reasoning. Everything executable ran on a disposable Omarchy 4.0.0 VM, never against this machine's own The fix is correct and I pushed nothing. The two properties worth checking hardest both hold. Idempotence. The append cannot duplicate the stanza, because the template Ordering. The stanza lands at EOF, after Tests, all on the worker: Two things for the maintainer rather than defects in the diff: 1. 2. A non-zero exit from the sourced script is swallowed. One more, confirmed on the worker: a user who applied the workaround #9853 suggests — a On the second opinion: most of what Codex returned was in answer to questions I put to it, so read it as agreement rather than independent discovery, and its independence is not currently guaranteed in this setup. What it added on its own: that a checkout path containing an apostrophe would break the Nothing pushed to your branch. Waiting on the maintainer for the repair-migration question and for how this sequences against #8709 and #9461. |
A failing re-apply used to be swallowed: the command has no set -e, so the refresh printed nothing, returned 0 and ran pacman -Syyuu with the repository absent, the exact silent failure omacom#9853 is about. Stop before the upgrade and say why.
|
Thanks for the worker verification, it is exactly the scrutiny this needed. I took the exit-status point further: since the whole bug class here is silent failure, a failed re-apply now aborts the refresh before the upgrade instead of only echoing. The command has no set -e, so the step is checked explicitly; test/shell.d/refresh-pacman-test.sh gained a failing-hardware-script case that fails on the unchecked version and passes now. The repair-migration question I am leaving to the maintainer as agreed: a migration that re-adds the unsigned stanza would collide with #8709 and #9461, so I did not touch it. The pre-refresh-pacman double-append note is worth a release line. |
Fixes #9853
What broke
omarchy refresh pacmanoverwrites/etc/pacman.confwith the channel template and never re-applies hardware-specific repository additions. On Apple T2 Macs that silently drops the[arch-mact2]stanza, solinux-t2(the running kernel),t2fanrd,apple-t2-audio-configandapple-bcm-firmwarelose their update source with no visible symptom.The install path does this correctly:
install/post-install/pacman.shsourcesinstall/hardware/pacman.sh, which appends the T2 stanza and is idempotent (it guards ongrep -q '^\[arch-mact2\]'). That same file states the intent in its own comment: the extension "must survive the final pacman.conf restore". The refresh path never copies it.Fix
After the template restore, source
$OMARCHY_PATH/install/hardware/pacman.shthe same way the install path does:Notes on why this shape:
source "$OMARCHY_INSTALL/hardware/pacman.sh"cannot work inbin/omarchy-refresh-pacman:$OMARCHY_INSTALLis not defined at runtime (onlyomarchy-apply-hardware/omarchy-apply-systemset it). At runtime the tree lives at$OMARCHY_PATH/install/(docs/file-layout.md mapsinstall/**to/usr/share/omarchy/install/)./etc/pacman.conf, so it must run as root; the copy steps just above already usesudo, so the script runs as the user and elevates.pre-refresh-pacmanuser hook, matching the issue's ordering, so user hooks see the final repo set.[[ -f ]]guard keeps the refresh a no-op on anything where the install tree is absent, and ifinstall/hardware/pacman.shis ever removed the refresh simply skips it.Security context
install/hardware/pacman.shis also in the sights of open security PRs #8709 (arms verification on the T2 stanza) and #9461 (draft: remove the unsigned source). This PR deliberately does not take a side: it sources whatever the packaged file contains at runtime, so if #8709 lands the refresh re-applies the armed stanza, and if a removal lands the-fguard no-ops. Only the "refresh drops hardware repos" bug is fixed here.Tests
New
test/shell.d/refresh-pacman-test.shruns the command against a sandboxed/etc/pacman.conf(absolute paths rewritten) with stubbedlspci/sudo/pacman/omarchy-hook:lspcishows106b:1801):[arch-mact2]with the mirror server is present after the refresh, the user hook still runs, andpacman -Syyuustill runs.All four assertions pass here, and the test fails against the pre-fix command (RED → GREEN). Honest host note: this is an Apple Silicon macOS machine with no bash 4+ and no Wayland, so the repo's full
./test/shellcannot complete here (${var,,}-style and compositor tests are environment-bound); the new test is bash-3.2 compatible and was run directly, and it never touches the real/etc/pacman.conf. Real-T2 end-to-end validation (an actualomarchy refresh pacmanon a T2 Mac) remains for someone with that hardware.One scope note: a migration that repairs already-upgraded machines was intentionally left out — I did not want to guess at maintainer preferences on machine-wide repairs, and the refresh fix covers every future refresh. Happy to add one if you want it.