Renew a GPG key when you get “GPG error – KEYEXPIRED”

Getting this error when trying to update packages on your linux distro using apt?

$apt-get update
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://apt.puppetlabs.com jessie Release: The following signatures were invalid: KEYEXPIRED 1468001658

This just means that the GPG key is expired and that you need to renew it.

You can list expired keys and get the ID by using this command:

$apt-key list | grep expired
pub   4096R/4BD6EC30 2010-07-10 [expired: 2016-07-08]

Here, we can see that ID “4BD6EC30” is expired and is leading to the issue.

Let’s now update this key:

$apt-key adv --recv-keys --keyserver keys.gnupg.net 4BD6EC30

And you can now perform the update properly, you won’t get error anymore.