After running the command to install ruby sudo apt-get install curl git-core

I am getting an error-

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? Please tell me the solution for it..

  • Easy way would be Logout or reboot , it should work fine. Please don't use Synaptic , Update manager simultaneously to update or install packages.Check if update manger is running , if so then close it and try again. Possible Duplicate askubuntu.com/questions/15433/…
    – atenz
    Jun 12, 2012 at 7:46

1 Answer 1


Performing Step 5 of the Package Manager Troubleshooting Procedure is almost always sufficient to solve this problem, as well as many other package management problems. (Or as tijybba commented, rebooting often works.)

Open a Terminal window (Ctrl+Alt+T an run these commands:

sudo fuser -vvv /var/lib/dpkg/lock
cat /etc/lsb-release
uname -a
sudo rm /var/lib/apt/lists/lock 
sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo rm /var/cache/apt/*.bin
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
LANG=C;sudo apt-get clean
LANG=C;sudo apt-get autoclean
LANG=C;sudo apt-get --purge autoremove
LANG=C;sudo apt-get update -o APT::Cache-Limit=25165824
sudo dpkg --configure -a
sudo dpkg --clear-avail
LANG=C;sudo apt-get -f install
LANG=C;sudo apt-get --fix-missing install
LANG=C;sudo apt-get update -o APT::Cache-Limit=25165824 && sudo apt-get dist-upgrade

Written by Contributors to the Ubuntu documentation wiki.

If that doesn't work, please add all the text from the Terminal to your question (by editing your question). This will provide valuable information for working further on your problem. But it will probably work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.