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?

  • Alex Markessinis

    That did not work for me, however this did:

    curl | sudo apt-key add –

  • Rob

    Thanks for the alternative fix – I will look to incorporate that into the guide.

  • kogak

    Hey ! I’ve got the same problem, but for Debian… Do you have any idea how I can adapt the fix to Debian…? (I also think this appeared after my last Plex Server update…)

  • Rob

    Does this work for you?

    curl… | sudo apt-key add –

    Alex suggested it in the comments.

  • kogak

    No it didn’t, but I understand why now. I just don’t use sudo on this serv, but by removing it from the command while being root it worked like a charm.

    Here is what I used, in case somebody else has the same trouble and is at the same level of Linux noobness as me :

    curl | apt-key add –

    Also, more about it here :

  • Rob

    That’s a fair catch. It is a double hyphen however it doesn’t look like it in the browser.

    Thanks for the spot.

  • Same issue here – browser converting double dashes to those stupid single ones. 🙂

%d bloggers like this: