+3 votes
in Operating Systems by (56.7k points)

I am running apt-get update on my new Ubuntu VPS, but it is giving the following error: "The following signatures couldn't be verified because the public key is not available"

How can I fix this error? The details are below:

Err:1 http://nginx.org/packages/mainline/ubuntu bionic InRelease

  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62

Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease

Get:6 http://apt.vestacp.com/bionic bionic InRelease [2,187 B]

Err:6 http://apt.vestacp.com/bionic bionic InRelease

  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 42C5B2130A1F7714

Reading package lists... Done

W: GPG error: http://nginx.org/packages/mainline/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62

E: The repository 'http://nginx.org/packages/mainline/ubuntu bionic InRelease' 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.

W: GPG error: http://apt.vestacp.com/bionic bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 42C5B2130A1F7714

E: The repository 'http://apt.vestacp.com/bionic bionic InRelease' 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.

Reading package lists... Done  

1 Answer

+1 vote
by (349k points)
selected by
 
Best answer

From the error message, it is clear that the following keys are missing: ABF5BD827BD9BF62 and 42C5B2130A1F7714.

Add these keys by running the following commands:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 42C5B2130A1F7714

If you have more missing keys, you can run the above command by replacing the key.


...