How do I fix a “Could not get lock /var/lib/dpkg/lock” error?

You can delete the lock file with the following command:

sudo rm /var/lib/apt/lists/lock

You may also need to delete the lock file in the cache directory

sudo rm /var/cache/apt/archives/lock

After that, try running apt-get again.

via apt – How do I fix a “Could not get lock /var/lib/dpkg/lock” problem? – Ask Ubuntu.