Solved - Could not get lock /var/lib/dpkg/lock

From time to time you might receive the following error when trying to install something:

Could not get lock /var/lib/dpkg/lock

To fix this you can run the following command:

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

Should this not solve the issue you can run these commands:

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