Ubuntu – How to fix “Could not open lock file” because “Permission denied”?

dpkg

Whenever trying to install any software and update manger,

I get an error stating

Package operation failed
The installation or removal of a software package failed

When I run sudo apt-get update I got this result:

conan51xd@conan51xd-Lenovo-B470:~$ sudo apt-get -f install
[sudo] password for conan51xd: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
conan51xd@conan51xd-Lenovo-B470:~$ apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Best Answer

Run this command:
sudo mv /var/lib/apt/lists{,july12}

sudo apt-get update
Then sudo apt-get upgrade

Related Question