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

If you are trying to install some package on Ubuntu and by some means, in middle of the installation, some unexpected things happens causing installation to abort in the middle, in similar situation if you try to install the same package later on, you may see an error like below,

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?

If you see the lock file using “file /var/lib/dpkg/lock” command, its an empty file, but used as a lock to avoid multiple installations simultaneously.

Solution : To remove this error, we need to manually remove this file as,

$ sudo rm -rf /var/lib/dpkg/lock

Now, if you try to install the same or any other package again, you will not see the above error and installation happens successfully.

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )


This above solution will also work for below error,

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

The Another way to fix this error is identify which process is using this lock and kill the process. For example, in our case apt.systemd.daily was busy doing something by acquiring the lock. In this, you either wait for the process to complete, so lock will get released automatically or go on killing the process as,

$ ps -ax | grep lock
   33 ?        I<     0:00 [kblockd]
 2418 ?        S      0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held update
 3939 ?        S      0:00 flock --nonblock /run/mlocate.daily.lock /usr/bin/ionice -c3 /usr/bin/updatedb.mlocate
 4056 pts/2    S+     0:00 grep --color=auto lock
$ sudo kill -9 2418

Here, 2418 is the process ID of the process which had acquired the lock.


Leave a Comment

Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded