"sudo apt-get update" command is not working

July 8, 2016 10.1k views
Nginx LEMP WordPress DigitalOcean Ubuntu 16.04

Hello!

Error log

Last login: Fri Jul  1 00:56:49 2016 from XXX.XXX.XXX.XX
root@xxx:~# sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial InRelease
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates InRelease [94.5                                                                 kB]
Get:4 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports InRelease [92                                                                .2 kB]
Get:5 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 Pack                                                                ages [248 kB]
Get:6 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main i386 Packa                                                                ges [244 kB]
Get:7 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64                                                                 Packages [152 kB]
Get:8 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe i386 P                                                                ackages [149 kB]
Get:9 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe Sour                                                                ces [800 B]
Get:10 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe amd                                                                64 Packages [608 B]
Get:11 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe i38                                                                6 Packages [612 B]
Get:12 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe Tra                                                                nslation-en [300 B]
Fetched 1,076 kB in 8s (131 kB/s)
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. C                                                                urrent value: 25165824. (man 5 apt.conf)
Reading package lists... Error!
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. C                                                                urrent value: 25165824. (man 5 apt.conf)
E: Error occurred while processing science-highenergy-physics (NewVersion2)
E: Problem with MergeList /var/lib/apt/lists/mirrors.digitalocean.com_ubuntu_dis                                                                ts_xenial_universe_binary-amd64_Packages
E: The package lists or status file could not be parsed or opened.
root@xxx:~#

EVEN WHEN I LOGIN IT SHOWING ERROR:

Using username "root".
Authenticating with public key "rsa-key-XXXXXXX"
Passphrase for key "rsa-key-XXXXXXX":
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-24-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

24 packages can be updated.
12 updates are security updates.

Could not load list of meta packages: [Errno 12] Cannot allocate memory
Could not load list of meta packages: [Errno 12] Cannot allocate memory


Last login: Fri Jul  8 09:49:13 2016 from XXX.XXX.XXX.XX
root@XXX:~#

The server was running fine but accidently I had pressed for "SnapShot" without Shutdown server from the command line. After these errors are started arising!

Kindly help me to resolve this issue.

Thank you!

1 comment
  • Hallo!
    In my new 16.04, I receive the propositions :
    "
    redaktor@Hamburger:~$ sudo apt-get upgrade -y

    Paketlisten werden gelesen... Fertig
    Abhängigkeitsbaum wird aufgebaut.

    Statusinformationen werden eingelesen.... Fertig

    Probieren Sie »apt-get -f install«, um dies zu korrigieren.

    Die folgenden Pakete haben unerfüllte Abhängigkeiten:

    gnome-termin`l : Hängt ab von: libnautilus ist aber nicht installierbar
    Hängt ab von: extension1a (>= 1:2.91) ist aber nicht installierbar
    Hängt ab von: gnome-terminal-daua (< 3.19) ist aber nicht installierbar
    indicator-keyboard : Hängt ab von: !libglib2.0-0 (>= 2.37.5) ist aber nicht installierbar

    E: Unerfüllte Abhängigkeiten. Versuchen Sie, -f zu benutzen.

    "

    AND, the attempt to use: " apt-get -f install " results into :

    "
    redaktor@Hamburger:~$ sudo apt-get -f install

    Paketlisten werden gelesen... Fertig
    Abhängigkeitsbaum wird aufgebaut.

    Statusinformationen werden eingelesen.... Fertig
    Abhängigkeiten werden korrigiert ... Fertig
    Die folgenden Pakete werden ENTFERNT:
    gnome-termin`l indicator-bluetooth indicator-keyboard ubuntu-desktop
    unity-control-center unity-control-center-signon
    0 aktualisiert, 0 neu installiert, 6 zu entfernen und 0 nicht aktualisiert.

    2 nicht vollständig installiert oder entfernt.
    Nach dieser Operation werden 6.687 kB Plattenplatz freigegeben.
    Möchten Sie fortfahren? [J/n] J

    dpkg: Fehler: Parsen der Datei »/var/lib/dpkg/status«, nahe Zeile 22953 Paket »indicator-keyboard«:
    Feld »Depends«,

    ungültiger Paketname »!libglib2.0-0«: muss mit alphanumerischem Zeichen beginnen

    E: Sub-process /usr/bin/dpkg returned an error code (2)
    "

    I Do doubt that I can fix that.
    And You ?

2 Answers
jtittle1 July 8, 2016
Accepted Answer

@chinmayrajyaguru

There's a few things we can do in an effort to resolve this. First, I'd clean up the lists for apt-* by running:

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

The above command removes all files and directories located in /var/lib/apt/lists/, which will then be repopulated at the end.

Now we'll configure the cache limit by running:

echo "APT::Cache-Limit "100000000";" >> /etc/apt/apt.conf.d/70debconf

The above command simply adds APT::Cache-Limit "100000000"; to the end of the /etc/apt/apt.conf.d/70debconf file.

At this point, run:

sudo apt-get update

And see if you're able to successfully complete the action. If not, please run:

sudo rm -rvf /var/lib/apt/lists/* \
&& sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad \
&& sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status \
&& sudo apt-get update

If successful, you should be good to go. You may also want to clean up any packages that are not currently in use:

sudo apt-get autoclean \
&& sudo apt-get autoremove -y \
&& sudo apt-get update

The above command will clean up information / cache used by apt-*, remove packages that are not currently in use by existing software (perfectly safe as this command only selects software that isn't actually being used by current packages) and then runs the update command once more.

Lastly, I'd run a quick upgrade to make sure that all current packages are up to date:

sudo apt-get upgrade -y

It looks like you're out of memory. I would check if there aren't processes on the same VM using a lot of it.

  • Yes mate, I have checked it. MySQL is eating 74%+ memory but I don't understand how simple website (low traffic approx 10 visits/day) can eat memory like this?

Have another answer? Share your knowledge.