Ubuntu apt-get update error

August 16, 2013 15.5k views
Suddenly recently when i do apt-get update, it will end with this: Reading package lists... Error! How to fix this?
2 comments
  • I just got this error after trying to install mongdb.

    Any luck?

  • This is fixed for me now.

    I removed the file I created in the mongo installation process, ran apt-get clean, then rm /var/lib/apt/lists/* to remove the package list files. After that, sudo reboot to restart the server.

13 Answers
Run this command:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192

I got this error when I installed chef-server on a 1GB server and it was eating up all of the memory on the box, leaving nothing for apt-get to work with. After I removed chef, all was well again. Chef starts up its own copy of nginx, and postresql, so it's a huge memory hog.

  • It's dated, but I spent about 30 minutes with this same problem. When I read this comment, it occured to me to check my mem-usage and low-and-behold, saturated. Doing some house cleaning fixed it. Just in case any body in the future comes across this problem.

firstly having a back up will be good Idea

try this command
sudo dpkg --configure -a
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
Did you add any repositories manually?
Now the error has gone after i do
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update

But when i update, usually there was long list of update but now only this:

Hit http://apt.newrelic.com newrelic Release.gpg
Hit http://apt.newrelic.com newrelic Release
Hit http://apt.newrelic.com newrelic/non-free amd64 Packages
Hit http://apt.newrelic.com newrelic/non-free i386 Packages
Ign http://apt.newrelic.com newrelic/non-free TranslationIndex
Ign http://apt.newrelic.com newrelic/non-free Translation-en
Reading package lists... Done

How to make it back to normal?
The problem probably lies in /etc/apt

What files do you have in /etc/apt/sources.list.d?

Also, what repo's do you see activated when you execute cat /etc/apt/sources.list?
Run
sudo apt-get clean

sudo apt-get update


Does that fix it? It should regenerate the files in /var/lib/apt/lists
Pablo and Kamal,
Inside /etc/apt/sources.list.d there is:
newrelic.list

Inside the /etc/apt/sources.list, i try to use the list given here: http://askubuntu.com/questions/191669/how-to-restore-the-default-repositories-in-12-04

But after i do the update it update smoothly until after reading the package it gives me this error:
Reading package lists... Done
W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192

Here is a simple example of a typical /etc/apt/sources.list file.
Pablo, i use that list but i still get:
W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
Ok its solved, thanks to both of you.
But is it will be ok for my droplet after what has happened? The sources list now i think is different
I believe you will have to re-add any repos you added before you reset the sources.list file.
Have another answer? Share your knowledge.