GPGME error in Arch (failed to synchronize all databases)
It had been a couple months since updating Arch (bad, I know, but it's headless and I forgot!)
When I went to run an update I saw this error happen...
sudo pacman -Syu
:: Synchronizing package databases...
core 998.0 B 1399 B/s 00:01 [#############################################################] 100%
extra 998.0 B 37.5 KiB/s 00:00 [#############################################################] 100%
community 998.0 B 37.5 KiB/s 00:00 [#############################################################] 100%
error: GPGME error: No data
error: GPGME error: No data
error: GPGME error: No data
error: failed to synchronize all databases (invalid or corrupted database (PGP signature))
So I inspected the database - and it was an HTML page!
less /var/lib/pacman/sync/core.db
The .db file clearly should not be a webpage - it turns out the mirror url was stale. So I moved the entire sync directory...
sudo mv /var/lib/pacman/sync /var/lib/pacman/sync.BROKEN
And updated the mirror I was using by commenting out the broken one
> sudo nano /etc/pacman.d/mirrorlist
# I commented out the first
# Server = https://archlinux.qern-industries.pw/$repo/os/$arch
Server = https://america.mirror.pkgbuild.com/$repo/os/$arch
Server = https://mirror.hackingand.coffee/arch/$repo/os/$arch
Ran the update again - but more things were also stale >.<
(61/61) checking package integrity [#############################################################] 100%
error: openssl: signature from "Pierre Schmitz <[email protected]>" is marginal trust
:: File /var/cache/pacman/pkg/openssl-3.0.7-4-x86_64.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.
# Fix keys
sudo pacman-key --init
sudo pacman-key --populate archlinux
# Update keyring
sudo pacman -Sy archlinux-keyring
# Update system
sudo pacman -Syu
(Solution for keyring found https://wiki.archlinux.org/title/Pacman/Package_signing#Upgrade_system_regularly)