Awesome FOSS Logo
Discover awesome open source software
Launched 🚀🧑‍🚀

Fixing GPGME Error on Arch

Categories
Arch Linux logo

Recently I ran into some GPG errors with pacman that were quite frustrating to fix. The symptoms look something like this when trying to run a command like sudo pacman -Syu:

error: GPGME error: No data
error: GPGME error: No data
error: GPGME error: No data
:: Synchronising package databases...
 core                                                                974.9 KiB  1134 KiB/s 00:01 [#########################################################] 100%
 extra                                                               974.9 KiB  1547 KiB/s 00:01 [#########################################################] 100%
 community                                                           974.9 KiB  1486 KiB/s 00:01 [#########################################################] 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))

It evidently happens from time to time, as evidenced by previous internet threads:

This post is mostly a note to myself on how to fix this if I run into it again, which you might also benefit from.

Step 0: Restart

It annoys me when I have to, but it’s just… a good idea. Save your work, take a deep breath, and restart.

Step 1: Re-generate your Pacman mirror list

You can use the Pacman Mirrorlist generator to re-generate your pacman mirror list.

Remember that you can select multiple (individual) entries in list of options by pressing CTRL when clicking!

Once you have a list you like, copy it to your clipboard and then run the following to backup the current list and edit the main list:

sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
sudo vim /etc/pacman.d/mirrorlist

Step 2: Re-generate the keys for pacman with pacman-key

You can re-generate the keys for pacman by first getting rid of the stored secrets:

sudo rm -rf /etc/pacman.d/gnupg
sudo rm -R /var/lib/pacman/sync

Then, you can run pacman-key to initialize and re-generate the trust roots:

sudo pacman-key --init
sudo pacman-key --populate

Step 3: Update pacman

At this point hopefully you should be able to update pacman without errors:

sudo pacman -Syy