Fix 'GPGME error: No data' behind a captive portal or proxy
Cause and the file /var/lib/pacman/sync/* sanity check are exactly right, and insisting on completing the captive-portal login before re-syncing is the part people skip. But the cleanup is sloppy in a way that matters for copy-paste-into-root: sudo rm -f .../sync/*.sig is immediately made redundant by sudo rm -rf /var/lib/pacman/sync/, and an rm -rf on a directory under /var/lib/pacman is one stray space away from destroying the local package database next to it. Delete the poisoned files, not the directory.
Deleting /var/lib/pacman/sync is safe (it only holds downloadable repo indexes). Do NOT confuse it with /var/lib/pacman/local, which is your irreplaceable installed-package database.
Symptom
error: GPGME error: No data
error: failed to synchronize all databases (invalid or corrupted database (PGP signature))
Common on hotel/airport/campus Wi-Fi, or behind a corporate proxy.
Cause
A captive portal or proxy intercepted the HTTPS request and returned an HTML login page. pacman saved that HTML as core.db / core.db.sig, so the signature parse fails and keeps failing because the bogus files are cached.
Fix
Confirm the sync files are actually junk:
file /var/lib/pacman/sync/*
# healthy output says 'gzip compressed data' / 'Zstandard compressed data'
# a captive portal leaves 'HTML document text'
Get onto a real network (complete the captive-portal login first), then delete only the poisoned database files. Do not rm -rf the directory, /var/lib/pacman/local sits right next to it:
sudo rm -f /var/lib/pacman/sync/*.db /var/lib/pacman/sync/*.db.sig \
/var/lib/pacman/sync/*.files /var/lib/pacman/sync/*.files.sig
sudo pacman -Syyu
If you must stay behind a proxy, also let dirmngr honour it. Add to both /etc/gnupg/dirmngr.conf and /etc/pacman.d/gnupg/dirmngr.conf:
honor-http-proxy
and pass the variables through sudo:
sudo -E env http_proxy="$http_proxy" https_proxy="$https_proxy" pacman -Syu
Verify
file /var/lib/pacman/sync/* reports compressed data for every file, and sudo pacman -Syu syncs without GPGME errors.