I was performing a standard system upgrade on an Arch server this morning and received the following messages (maintainer details redacted):
$ sudo pacman -Syyu
... # Download of packages
(159/159) checking keys in keyring [######################] 100%
(159/159) checking package integrity [######################] 100%
error: fail2ban: signature from "... <...>" is unknown trust
:: File /var/cache/pacman/pkg/fail2ban-0.11.2-2-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] Y
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.
I followed advice in the forums and tried refreshing and repopulating the keys, clearing the Pacman cache, and a combination of these things. I still kept getting the same problem each time I tried to upgrade.
Eventually I just removed the package, ran the upgrade, and then re-installed it:
$ sudo pacman -R fail2ban
$ sudo pacman -Syyu
$ sudo pacman -S fail2ban
That fixed the problem, but I’m still not really sure why re-fetching the keys manually didn’t help!