Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get some errors when trying to update the package list with sudo apt-get update command, specifically the error messages are as follows:

W: GPG error: http://dl.google.com stable Release: The following signatures were invalid: BADSIG A040830F7FAC5991 Google, Inc. Linux Package Signing Key 
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.canonical.com precise Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key 

W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key 

W: Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/Release  

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release  

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

I'm using Kubuntu 12.04.

EDIT
I performed the commands suggested by terdon in his answer, but it still doesn't work; when trying to update the keys, I got the following output:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.OE3Vb6NDgl --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com A040830F7FAC5991
gpg: requesting key 7FAC5991 from hkp server keyserver.ubuntu.com
gpg: key 7FAC5991: "Google, Inc. Linux Package Signing Key " not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.QFmVRIYHrE --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
gpg: requesting key 437D05B5 from hkp server keyserver.ubuntu.com
gpg: key 437D05B5: "Ubuntu Archive Automatic Signing Key " not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.kJGIgNoOEW --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
gpg: requesting key 3E5C1192 from hkp server keyserver.ubuntu.com
gpg: key 3E5C1192: "Ubuntu Extras Archive Automatic Signing Key " not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

And trying to use sudo apt-get update still gives me the same errors as before.

share|improve this question
    
I hate to be that guy, but you have tried restarting, and trying a different network right? – Dudemcman Apr 22 '13 at 13:38
    
Yes. I managed to solve it with the latest terdon's advice, thank you anyway ;) – Sekhemty Apr 22 '13 at 13:46
up vote 3 down vote accepted

You will need to import the correct GPG keys for each repository. So, for each missing key, run this command:

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

In your case, you are missing the keys for A040830F7FAC5991, 40976EAF437D05B5 and 16126D3A3E5C1192, you can get all three by running:

for key in A040830F7FAC5991 40976EAF437D05B5 16126D3A3E5C1192; do 
 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $key; done

After running this command, try sudo apt-get update again and it should work perfectly well.


Update, I was assuming that reimporting the keys would fix them, it looks like that did not work. Try this instead (source):

sudo apt-get clean
sudo mv /var/lib/apt/lists /var/lib/apt/lists.old 
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update
share|improve this answer
    
It didn't work. I edited my question by adding what I obtained. – Sekhemty Apr 21 '13 at 16:55
    
I've also tried to delete the not-working keys before updating, this time they are correctly imported (at least I think so) but for each one of these, I get the message gpg: no ultimately trusted keys found and keep getting the errors of my original question. Do you have some more suggestions? – Sekhemty Apr 22 '13 at 8:52
    
@Sekhemty see updated answer. – terdon Apr 22 '13 at 13:21
    
This time it worked, I went trough the update process without any errors. I suppose that it is safe to delete the lists.old directory now, right? – Sekhemty Apr 22 '13 at 13:43
    
Yes, that is just a backup just in case, you should not need it if the command worked. – terdon Apr 22 '13 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .