omarchy install terminal <pkg> reports failure but still mutates xdg-terminals.list and copies config when package is missing on aarch64
Bug
Running omarchy install terminal ghostty on aarch64 prints "Failed to install ghostty" but still:
- Copies
/usr/share/omarchy/config/ghostty/into~/.config/ghostty/ - Overwrites
~/.config/xdg-terminals.listso it points atcom.mitchellh.ghostty.desktop
The package was never installed (pacman -Q | grep ghostty is empty afterwards, no ghostty binary on PATH), but xdg-terminal-exec and any Hyprland keybinding that resolves the default terminal now look for ghostty and fail to launch a terminal.
Steps to reproduce
- Use Omarchy on aarch64 (Apple Silicon). Ghostty is not in the aarch64 repos and there is no
ghosttypackage in AUR (aur/ghosttydoes not exist; only derivatives likeghostty-git/ghostty-nightly-bin). - Run
omarchy install terminal ghostty.
What happens
Installing ghostty...
Skipping 'ghostty': not available in the repos on this system
But then the script silently:
- creates
~/.config/ghostty/(copied from/usr/share/omarchy/config/ghostty/) - rewrites
~/.config/xdg-terminals.listto:com.mitchellh.ghostty.desktop
The user has no terminal they can launch and no package they can run.
Expected
When the package cannot be installed, omarchy install terminal should:
- Print the error and exit non-zero
- Leave
~/.config/xdg-terminals.listunchanged - Leave
~/.config/<package>/untouched
Root cause
omarchy install terminal (in /usr/bin/omarchy-install-terminal) gates the config-copy and xdg-terminals.list rewrite on if omarchy-pkg-add $package; then. But omarchy-pkg-add (in /usr/bin/omarchy-pkg-add) does exit 0 when none of the requested packages are installable:
to_install=()
for pkg in "$@"; do
if pacman -Q "$pkg" &>/dev/null || pacman -Si "$pkg" &>/dev/null; then
to_install+=("$pkg")
else
echo -e "\033[33mSkipping '$pkg': not available in the repos on this system\033[0m" >&2
fi
done
((${#to_install[@]})) || exit 0
So the if branch fires, even though no package was actually installed. The script needs a separate "did anything actually get installed?" check (e.g. omarchy-pkg-present $package after the call, or a non-zero exit from omarchy-pkg-add when nothing was installable).
Environment
- Omarchy 4.0.1-2
- aarch64 (Apple M1, Icestorm)
- Kernel: Linux 7.1.6-1-1-ARCH
Opened a fix in https://github.com/omacom/omarchy/pull/9365.
Repro
Isolated HOME with a stub omarchy-pkg-add that prints the skip line and exits 0 without installing (the shape from the report), against stock omarchy-install-terminal on quattro:
Installing ghostty...
Skipping 'ghostty': not available in the repos on this system
EXIT:0
xdg-terminals.list → com.mitchellh.ghostty.desktop
~/.config/ghostty/ created
Two cooperating bugs, not just one:
- Success branch ran on
omarchy-pkg-addexit 0 without checking the package was present. - Failure branch printed
Failed to install …but exited 0, soomarchy-default-terminal --install(which doesomarchy-install-terminal || exit 1) continued and rewrote the default anyway — confirmed in the same harness.
Fix
Require omarchy-pkg-add success and omarchy-pkg-present before seeding config or rewriting xdg-terminals.list; exit non-zero on failure.
# after
Installing ghostty...
Skipping 'ghostty': not available in the repos on this system
Failed to install ghostty
EXIT:1
xdg-terminals.list left at kitty.desktop
~/.config/ghostty absent
Tests
test/shell.d/install-terminal-test.sh covers:
pkg-addnon-zero → no mutation, exit 1pkg-addexit 0 without package present (this issue) → no mutation, exit 1- successful install sets desktop id + seeds config
- existing config not overwritten
omarchy-default-terminal --installpreserves previous default when install fails
$ bash test/shell.d/install-terminal-test.sh
… 6 ok
$ bash test/shell.d/default-apps-test.sh
… ok (terminals still install before selection)
Reporter verification, run on the machine from the report.
Box: MacBook Air M1 (2020), aarch64, omarchy 4.0.1-2, kernel 7.1.6.asahi1-1. Script under test: stock /usr/bin/omarchy-install-terminal (md5 5fb4229412aa8ac00e30d30b637618fa), driven with an isolated HOME and a stub omarchy-pkg-add that prints the skip line and exits 0 (the same shape as your repro).
Before (4.0.1-2, unpatched)
- direct
omarchy-install-terminal ghostty:EXIT:0,~/.config/xdg-terminals.listrewritten tocom.mitchellh.ghostty.desktop,~/.config/ghosttycreated,pacman -Q ghosttyempty afterwards. - through
omarchy-default-terminal --install ghostty:kitty.desktop->com.mitchellh.ghostty.desktopand the "Ghostty is now the default terminal" notification fires,EXIT:0. So the box both loses its working terminal default and is told the switch succeeded.
Your branch at head aefa83e, same stub
- direct:
Failed to install ghostty,EXIT:1,xdg-terminals.listleft atkitty.desktop,~/.config/ghosttyabsent. - through
omarchy-default-terminal --install ghostty:EXIT:1,xdg-terminals.listleft atkitty.desktop.
Confirmed on the aarch64 path: both cooperating bugs reproduce exactly as described and the fix resolves both, with the previous default preserved on failure. I also checked that the presence gate does not lock out the derived packages mentioned in the original report - pacman -Q resolves provides as well (pacman -Q sh reports the installed bash here), so ghostty-git / ghostty-nightly-bin machines still satisfy omarchy-pkg-present ghostty.
Thanks for picking this up, and for wiring it into test/shell.d/.
Reviewed against quattro (fcf9eeb) and v4.0.1, reading the source; nothing was run on a worker, since the mechanism is a few lines of control flow and #9365 is verified as its own item.
The omarchy-pkg-add quoted in the report, with the "Skipping '…': not available in the repos on this system" loop and the exit 0 when nothing is installable, is not Omarchy's. No version of it exists in this repository's history, v4.0.1 included. Omarchy's bin/omarchy-pkg-add runs pacman -S, exits 1 if that fails, and exits 1 again if pacman -Q still cannot find the package afterwards. The Apple M1 install the manual points to (manual/49-omarchy-on.md) is a community port on Asahi Alarm, which presumably carries its own copy; the skip-and-succeed behaviour, and the config copy that follows from it, come from there rather than from Omarchy.
There is a real bug in the same place on stock quattro, though, and it gives the same end result:
bin/omarchy-install-terminalends its failure branch withecho "Failed to install $package", so it exits 0 when the install fails. Called directly, it leaves~/.config/<terminal>andxdg-terminals.listalone, but reports success.bin/omarchy-default-terminal --installrelies on that status (omarchy-install-terminal "$terminal" || exit 1, line 41), so after a failed install it goes on to rewritexdg-terminals.listto the uninstalled terminal and sends the "is now the default terminal" notification.
That --install path came in with #6950 (b724f76) and is not in a release yet, so 4.0.x users are not affected by it.
#9365 fixes it: the failure branch now exits 1, which stops omarchy-default-terminal before it touches the default. Its added omarchy-pkg-present check is redundant against Omarchy's own omarchy-pkg-add but harmless. It is already linked to close this issue.
Reviewed by Claude Opus 5.5 and, as a second opinion, Codex Medium, which agreed with these findings from the source and added that v4.0.1's omarchy-default-terminal has no --install path at all; independence between the two is not guaranteed. This is waiting on the maintainer's decision on #9365.