Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have just installed Ubuntu 12.04 and I added some repo and when apt-get update i got missing gpg key. Following command seems to doesn't work for me:

apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; gpg --keyserver subkeys.pgp.net --recv $key && sudo gpg --export --armor $key | apt-key add -; done

How to fix this problem?

share|improve this question
    
It would be good if answers to this question included why this error is happening in the first place, and what to do to avoid it in future. –  Flimm Jul 6 '12 at 11:34
    
I solved my problem using Y-ppa-manager. Thanks to Ashu for the solution! –  user152704 May 7 '13 at 1:53
1  
Detailed solution with screenshots opensourceforgeeks.blogspot.in/2013/04/… –  Aniket Thakur Dec 5 '13 at 6:58

9 Answers 9

I liked this solution, re-download the missing keys from the Ubuntu key server.

http://naveenubuntu.blogspot.com/2011/08/fixing-gpg-keys-in-ubuntu.html

In my case

Reading package lists... Done
W: GPG error: http://ppa.launchpad.net precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2EA8F35793D8809A

Here is the command to add the missing key mentioned in the error message.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2EA8F35793D8809A

So I take the missing key 2EA8F35793D8809A and ask the keyserver.ubuntu.com to added it to the list of keys I have in apt.

share|improve this answer
    
askubuntu.com/a/136735/10998 did not work for me. –  nelaar May 23 '12 at 9:21
2  
perfect! thanks! –  HDave Jul 16 '12 at 18:26
    
Works for me. Need to ignore the " in the original blog post. –  Aw Qirui Guo Jun 9 '13 at 3:03
    
It worked for me too. I think it is the easiest solution of all. –  Cristiana Nicolae Oct 11 '13 at 20:49
    
Are there any security implications to doing this? I'm basically just downloading a public key over http, right? –  Ajedi32 May 20 at 21:10

first enter the following command in the terminal

 sudo rm /var/lib/apt/lists/* -vf

then update your system by entering the following command in the terminal

 sudo apt-get update && sudo apt-get upgrade

after this there should be no errors and everything should work fine.

share|improve this answer
    
thx for reply. The sollution for my problem was preety much simpler: type sudo su before typing my command above –  Fih May 14 '12 at 18:14
    
While that will have helped you, sudo su is in no way the correct approach - in this case sudo -s would have done what you needed. –  guntbert Jan 16 '13 at 17:06

For Ubuntu 12.04 Precise: Permanent solution

to this error message occuring after adding a new repository and updating repository list. This is due to a server which address is no more valid. So just change the address to a good one.

  1. Open the file ~/.gnupg/gpg.conf with a text editor.

    In terminal: gedit ~/.gnupg/gpg.conf

  2. then, in this file, find the following bold line (116th line) (which should be default as follow):

    [...]
    keyserver hkp://keys.gnupg.net
    # keyserver mailto:pgp-public-keys@keys.nl.pgp.net
    # keyserver ldap://keyserver.pgp.com

  3. then add the following bold line, to finally give the following result:

    (add # to the second line as follow to comment out the old address)

    [...]
    keyserver http://keyserver.ubuntu.com
    # keyserver hkp://keys.gnupg.net
    # keyserver mailto:pgp-public-keys@keys.nl.pgp.net
    # keyserver ldap://keyserver.pgp.com

  4. Save the file and try to update again:

    In terminal: sudo apt-get update

share|improve this answer

There is a software called as Y PPA manager It can help fix GPG keys errors.
Y PPA manager

To install -

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager

Once you install it start it ,then go to advance and select "import all missing GPG keys"

share|improve this answer
    
You must add sudo to this command! sudo apt-get... –  Fih May 3 '12 at 22:30
    
This worked for me also and I'm very impressed with the clean easy to use interface of Y PPA Manager it was a nice find, Thanks Ashu. –  CoalaWeb Sep 3 '13 at 19:56
    
I did what you say but nothing happened. I mean that I can't find the app anywhere in the menu. –  Cristiana Nicolae Oct 11 '13 at 20:18
    
@CristianaNicolae Once installed, you can find Y PPA Manager under Applications > System Tools. –  Ashu Oct 13 '13 at 4:02
    
Sorry Ashu, I have checked and double checked. I still can't see it there. It seems that it is installed somewhere in the system, but for some reasons, it doesn't show anywhere in menu. –  Cristiana Nicolae Oct 13 '13 at 8:38

First enter the following command in the terminal

sudo rm /var/lib/apt/lists/* -vf

then update your system by entering the following command in the terminal

sudo apt-get update && sudo apt-get upgrade

after this there should be no errors and everything should work fine.

share|improve this answer

Based on nelaar answer:

 apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key ; done
share|improve this answer

The Most Easiest Way Is With Y PPA MAnager

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager 

Open Y PPA Manager From Dash

enter image description here

Enter Your Admin Password

enter image description here

Double Click On Advanced Option

enter image description here

Click Try To Import All Missing GPG Keys

enter image description here

Click Ok To Fix It

share|improve this answer

The automatic download using apt-key adv --recv-keys may not work behind some firewalls.

In this case, open the webpage of Ubuntu Key Server in your web browser and search for the string 0x<hexadecimal code of your missing key>.

Save the key contents (from -----BEGIN PGP PUBLIC KEY BLOCK----- to -----END PGP PUBLIC KEY BLOCK-----) as a file.

Then run:

sudo apt-key add <file-with-saved-key>

(Source: http://opensourceforgeeks.blogspot.in/2013/04/w-gpg-error-httpppalaunchpadnet-precise.html You can look at the screenshots on that page.)

share|improve this answer

This problem occurred to me when I install 12.04 using German settings. The repository list is then using German mirror repositories by default. If that is the case you can edit the repository list and change all German mirror repositories to the Ubuntu standard repositories.

You can use following method:

sudo nano /etc/apt/sources.list

Search and replace in Nano using Alt-r

Search (to replace): /de.

Replace with: /

Replace All (Press A)

Save file Ctrl-x

Then update your system by entering the following command in the terminal:

sudo apt-get update && sudo apt-get upgrade

After this there should be no errors and everything should work fine.

share|improve this answer
    
This doesn't really answer the OPs question especially considering that they weren't using de sources. –  Kevin Bowen Apr 17 '13 at 10:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.