You must have seen this (that’s why you’re here after all!)
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?
This often happens if you try to install a package (say, ) while you are installing another. As an example, this may happen when you try to run
$ sudo aptitude install in the terminal while you have Synaptic package manager open (or vice versa) or in another terminal you are installing another package . The easiest solution is just to wait for the other installation(s) to finish and close the package manager if you are done with it. However, if the package manager is crashed in the middle some stuck-up processes may still be using the lock (/var/lib/dpkg/lock).
In that case, use fuser to find out the runaway process(es); and while you’re at it, you may use -k flag which will kill the process that is still using /var/lib/dpkg/lock. Then configure (–configure) all the packages (-a) which are yet unpacked and unconfigured, using dpkg:
$ sudo fuser -vki /var/lib/dpkg/lock; sudo dpkg --configure -a
In the first command (fuser), the -i flag asks for user confirmation, and -v is for verbose mode.
After that, proceed to the usual installation step of the package that you want to install.