How do I fix the GPG error NO_PUBKEY?

Reading Time: < 1 minutes

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?

This Post Has 2 Comments

  1. Wayne

    Thank you. It worked for the following.

    W: 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 78BD65473CB3BD13
    E: The repository ‘http://dl.google.com/linux/mod-pagespeed/deb stable Release’ is not signed.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

  2. michael

    i had trouble finding public key, the key is within the error message

Leave a Reply