E: Could not get lock /var/lib/dpkg/lock

I got the following error after aborting my installation on terminal by  “accidentally pressing CTRL+C” with my lazy fingers.

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?

Here’s the solution how to fix it , btw i’m using Ubuntu 11.04 here.

1. Check “another process using it”

ps aux | egrep -i 'apt|ftp|kpack|dpkg' | less

2. kill it

kill -9 ($pid of apt, ftp, kpack, dpkg)

3.Remove the locks

sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock

4.Update the file database

sudo updatedb

5. Reconfig dpkg from broken installation.
sudo dpkg --configure -a

Reference:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: