How do I fix the GPG error NO_PUBKEY?

Reading Time: 1 minute

Recently, I am working with Ubuntu 16.04, and the task was to install multiple PHP version in Virtualmin, however, whenever I run apt-get update, this returns “The following signatures couldn’t be verified because the public key is not available”. For example:

: GPG error: http://dl.google.com/linux/mod-pagespeed/deb stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6494C6D6997C215E
W: The repository 'http://dl.google.com/linux/mod-pagespeed/deb stable Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
W: The repository 'http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
W: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Based on my research, we could correct these by:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PUBKEY>

In my case, I use:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C

The 4F4EA0AAE5267A6C is the key shown on the error message. I hope this will help you out in some way.

Source:

How do I fix the GPG error “NO_PUBKEY”?

Was this post helpful?

Leave a Reply

Close Menu