When installing a new application in Ubuntu, you may sometimes get the “Could not get lock /var/lib/dpkg/lock”. Specifically, you may get the following:
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?
When this happens, wait a few minutes to check if this has not been set by the an automatic update job. However, more often than not, you will end up doing the following:
sudo lsof /var/lib/dpkg/lock
I get the process ID and kill that ID by doing a
sudo kill -9 process_id