How to: Fix Ubuntu repository error when running apt-get update

Reading Time: 2 minutes

I look after several Ubuntu servers. A couple of them recently threw up an error whilst I was running routine repository updates.

In my specific situation, after running apt-get update I received the following message on my terminal:

An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: wheezy InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 0B38CE01521D8275

Failed to fetch

Some index files failed to download. They have been ignored, or old ones used instead.

This, simply put, is because one of the repositories I make use of no longer had a copy of the source server’s public key stored on my server.

To fix this, I made a note of the alphanumeric content after “NO_PUBKEY” from the error message. In my case, “0B38CE01521D8275”

I then typed the following command:

sudo apt-key adv –keyserver –recv-keys 0B38CE01521D8275

(You should replace the last part with the alphanumeric you captured above)

GPG error fixed

When I then re-ran the apt-get update command everything went back to working as desired.

I have a feeling that this may have been to do with Plex Server, given that I experienced the error on three Ubuntu servers running the home media server software and not on the Ubuntu servers I use as web servers.

If you’ve landed here following a Google search, what was the error or problem you were having that brought you here?

%d bloggers like this: