• Home
  • SEM
    • PPC
    • SEO
    • How To
  • Bangladesh
  • School
    • HTTP
    • REP
    • Bots n’ htaccess
    • Source Code
    • Excel 2010
    • HTML XHTML Entities
    • Gmail Operators
    • HTML & ASCII
  • About
    • Privy
    • About This Blog
  • Contact
  • বাংলা

Saidul Hassan

Digital Marketing Evangelist

Home / Linux Mint / E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)

E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)

14 Jun, 2016 By Saidul Hassan · Filed Under: Linux Mint

e-could-not-get-lock-var_lib_apt_lists_lock-open-11-resource-temporarily-unavailable
~ $ sudo apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

Absolute Solution:
This should be used as last resort. If you use this carelessly you can end up with a broken system. Please try the other solutions before doing this.
You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
Possible reason for this error:
Probably you run 2 instances of program or you have synaptic or some another package manager.
You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again. Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.
Alternative & safest solutions:
Solution 01: Wait for few minutes because apt-get update may have been running in background. This happens when you have just started the Linus Mint/Ubuntu. Try to run apt-get update few minutes later, DO NOT DELETE ANYTHING FIRST.
Solution 02:
search for processes.
ps -A | grep apt-get
then see if there any process running as apt-get
kill that process it by using:
sudo kill -9
for example if process id is 7356
sudo kill -9 7356
then run the sudo apt-get update
Note: If you are sure that you have no instances of dpkg or apt running and you still get the message, you can just delete the file:
sudo rm /var/lib/apt/lists/lock
A lock file is just a file with zero size that indicates locking of a resource.
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock

Solution 03:
Only one program can hold the lock. Make sure that you are not running aptitude, synaptic or adept. Close the program and run it again it should work.You may either have synaptic open, or have another terminal window open running apt-get, or have the update manager running.Check it and see if any of those are running,if any of them is running close it and try again.

Try this command in terminal to find what is running
ps -e | grep -e apt -e adept | grep -v grep
Note: If that doesn’t print anything, type the following in terminal to remove the lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock

Now you can install any Packages.

Sources:
http://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process
http://askubuntu.com/questions/346143/e-could-not-get-lock-var-lib-dpkg-lock-open-11-resource-temporarily-unavai
http://askubuntu.com/questions/452638/how-can-i-solve-unable-to-lock-the-administration-directory-var-lib-dpkg

The following two tabs change content below.
  • Bio
  • Latest Posts
My Twitter profileMy Facebook profileMy LinkedIn profileMy Instagram profileMy Pinterest profile

Saidul Hassan

Managing Partner at Up Arrow Consulting
COO at Up Arrow Consulting, MCC manager, & Technical SEO consultant. Certified Google Partners and Microsoft Bing Ads Accredited Professional, Python enthusiast, wannabe SysAdmin. Graduated from School of Management & Business Administration (SOMBA), Khulna University.
My Twitter profileMy Facebook profileMy LinkedIn profileMy Instagram profileMy Pinterest profile

Latest posts by Saidul Hassan (see all)

  • Batch script to create directories & moving fixed number of files to those directories - 30 Apr, 2021
  • How to use PrismJS syntax highlighter on WordPress without plugin - 30 Mar, 2020
  • Download an Entire Website for Offline Viewing - 26 Nov, 2019

Share:

  • Twitter
  • Facebook
  • LinkedIn
  • Pinterest
  • Pocket
  • Email
  • Print

First published on 14 Jun, 2016 · Last updated 14 Jun, 2016 · Tagged With: /var/lib/apt/lists, /var/lib/apt/lists/lock, apt-get update, Could not get lock, Unable to lock directory

Batch script to create directories & moving fixed number of files to those directories

30 Apr, 2021 By Saidul Hassan

How to use PrismJS syntax highlighter on WordPress without plugin

30 Mar, 2020 By Saidul Hassan

Download an Entire Website for Offline Viewing

26 Nov, 2019 By Saidul Hassan

How to color highlight .htaccess files in Xed/Gedit

20 Aug, 2018 By Saidul Hassan

HMA Pro VPN Setup for Multiple Locations without User/Password Every time in Linux CLI

14 May, 2018 By Saidul Hassan

  • ♥ Bangladesh ♥
    Log in · Privacy Policy · Contact
    Copyright © 2011 Saidul Hassan

  • DMCA