I got this error when trying to use
We get this message if you forget to use sudo when executing an apt command. It is also a sign that something else is installing or removing software and has locked the apt database while performing action. The programs that can do this are:
The Software Center
The Update Manager
The apt link installer (I think this now goes through SC)
The apt-get or aptitude command line utilities.
You can force the lock off by removing the file, but it’s recommended to first close the program holding the lock safely. Else you could cause corruption or interrupt an installation (bad). You can also kill the process by using following:
ps aux | grep apt
kill -9 processnumber
These will kill the process and remove the lock. If still not working, you can delete the lock using following command:
sudo fuser -cuk /var/lib/dpkg/lock sudo rm -f /var/lib/dpkg/lock
And the same command can be used for the apt cache lock:
sudo rm /var/lib/apt/lists/lock sudo fuser -cuk /var/cache/apt/archives/lock sudo rm -f /var/cache/apt/archives/lock
In this way, you can get out of this.