How to Fix the Arch Linux Pacman PGP Key Update Error

The problem…

I have an Arch Linux installation on a Virtual Machine (VM) run by Virtualbox. Because it is one of the many VMs that I have created, it is not regularly updated. I get to it maybe once a month, but often longer. This sometimes causes PGP key issues during the pacman updating process.

Scroll down to the last section to avoid the commentary and just see the fix…

The problem first appears as shown in the following screenshot from the Arch Linux Terminal.

Prior to installing the updates, you are asked if you want to “Import PGP key…” Of course this looks harmless, and I want to finish installing the 160 updates, so I answer “y” (yes.)

Then, as shown in the next screenshot, there is an error. The package “libcap…is corrupted”. Do I want to delete it? Of course, I want to delete a corrupted package, and continue on with the updates. I answer “y”

So, as shown in the next screenshot, the errors keep coming. In this instance, I just entered “y” until I was dropped back to the prompt (“Bash: y: command not found”)

The Solution…

The original error message means that the PGP key in question has expired or most probably was changed. It could be since the last attempted update the named developer has moved on, changed their key, or the package has been signed with a different key. Regardless of the reason, you need a new key (or keys) to finish the installation of the updates.

To fix this, update the keyring: pacman -Sy archlinux-keyring

Then try the update again: pacman -Su

  • S means synchronize the local package database from the remote repositories
  • y means refresh the local cache
  • u means run a system update

This can all be accomplished in one line, as shown in the last screenshot:

pacman -Sy archlinux-keyring && pacman -Su

See the following…

And, it is finished. You can answer yes and proceed with the updates.

Remember, if you run into a situation where your system will not boot, you can always use chroot. A tutorial for booting into chroot can be found here.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.