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

From last two days I see the following error on my AWS EC2 host:

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?

How to “E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)” on Ubuntu 16.04 LTS server? It is driving me nuts.

Look like your background apt/apt-get cron/timer job stuck due to some reasons. Here is how to fix
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)” problem easily on an Ubuntu Linux system.

Step 1 - Find what is blocking the apt or apt-get command on Ubuntu Linux

Open the terminal or ssh into your AWS EC2 server and then run:

ps aux | grep -i apt
ps aux | grep -i apt-get

Note down PIDs for apt or apt-get that is blocking access.

Step 2 - Kill those PIDs

Then, make sure you use the kill all those process IDS (PIDs) on Ubuntu:

sudo kill -9 PID

Step 3 - Try updating the box and test it

sudo apt-get update
sudo apt-get upgrade

Step 4 - Still not working?

Try reboot the Ubuntu Linux system or desktop:

sudo reboot

Let us know if this helped.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki