Fix 'GPGME error: General error' caused by an empty DISPLAY variable
The Arch wiki Pacman page (raw wikitext) has a troubleshooting section with this exact error and says a blank DISPLAY breaks the GPG flow, with unset DISPLAY as the fix, linking the cited BBS thread. The thread (pid 2204786) was read in full: the poster found it with strace and an env diff, reproduced it with DISPLAY= pacman -S archlinux-keyring, and a second user confirmed it from a script that could set DISPLAY to empty. The debug lines gpg error: Invalid crypto engine and GPGME error: General error are quoted from the thread. On Omarchy 4 every pacman call goes through sudo, so I checked sudo's source: initial_keepenv_table in plugins/sudoers/env.c keeps DISPLAY under env_reset. That means an empty DISPLAY reaches pacman through sudo and unset DISPLAY before omarchy update is the right Omarchy branch. Read /usr/share/omarchy/bin/omarchy-update and omarchy-update-keyring on 4.0.4-1: nothing there sets or clears DISPLAY, and the keyring step's sudo pacman -Sy --noconfirm archlinux-keyring is the first place a user would see the failure. The plain Arch branch sudo env -u DISPLAY pacman -Syu is correct. Not exercised: I did not reproduce the failure, because that needs a root pacman transaction.
Symptom
Every package fails signature verification in one terminal but works in another:
error: GPGME error: General error
:: File /var/cache/pacman/pkg/archlinux-keyring-20241015-1-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]
pacman --debug shows gpg error: Invalid crypto engine. Refreshing the keyring, pacman-key --init and --populate change nothing, and the same command works from a fresh login or a different terminal.
Cause
pacman verifies signatures through GPGME, which starts gpg with the caller's environment. When DISPLAY is set but empty (DISPLAY=), gpg's setup fails and GPGME reports a general error, which pacman presents as a corrupted signature. An unset DISPLAY or any non-empty value works. The empty value usually comes from a shell profile, a terminal multiplexer, or a script that exports DISPLAY from a variable that can be blank. The Arch wiki documents this, and the forum thread reproduced it with DISPLAY= pacman -S archlinux-keyring.
Fix
Check for an empty-but-set DISPLAY in the shell that runs pacman:
[[ -v DISPLAY && -z $DISPLAY ]] && echo 'DISPLAY is set but empty'
Run pacman without it:
unset DISPLAY
omarchy update # Omarchy 4
sudo env -u DISPLAY pacman -Syu # plain Arch
Then find what sets it to empty and fix that, so it does not come back:
grep -n 'DISPLAY' ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc ~/.config/uwsm/env* 2>/dev/null
Answer n to Do you want to delete it? while diagnosing. The cached file is fine, and keeping it saves a re-download.
Verify
env | grep '^DISPLAY=' shows no empty assignment in the shell you update from, and an upgrade passes the checking package integrity step.