"sudo apt-get update" command is not working


Error log

Last login: Fri Jul  1 00:56:49 2016 from XXX.XXX.XXX.XX
root@xxx:~# sudo apt-get update
Get:1 xenial-security InRelease [94.5 kB]
Hit:2 xenial InRelease
Get:3 xenial-updates InRelease [94.5                                                                 kB]
Get:4 xenial-backports InRelease [92                                                                .2 kB]
Get:5 xenial-updates/main amd64 Pack                                                                ages [248 kB]
Get:6 xenial-updates/main i386 Packa                                                                ges [244 kB]
Get:7 xenial-updates/universe amd64                                                                 Packages [152 kB]
Get:8 xenial-updates/universe i386 P                                                                ackages [149 kB]
Get:9 xenial-backports/universe Sour                                                                ces [800 B]
Get:10 xenial-backports/universe amd                                                                64 Packages [608 B]
Get:11 xenial-backports/universe i38                                                                6 Packages [612 B]
Get:12 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.


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:

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

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!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer


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

hello sudo apt-get update command is not working in my ubuntu 16.04, it is showing the following error

E: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi’ E: Sub-process returned an error code E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

can anyone please help me thanks in advance

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.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel