Using Amazon Linux AMI (2017.03.1) on a p2.xlarge instance, and attempting to sudo apt install {somepackage}, I get the following error:
Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
I have already tried
sudo rm /var/lib/apt/lists/lock
and
sudo rm /var/cache/apt/archives/lock
Solution:
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
sudo apt install {somepackage}
sudo lsof /var/lib/dpkg/lock
ps cax | grep PID #PID is the Process id e.g 1111
sudo kill -9 PID
sudo ps cax | grep PID
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend #optional
sudo dpkg --configure -a
Reference From
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With