Error:
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?
So, I've seen this error crop up a few times and get it as a result of using the following commands:
sudo apt-get update && apt-get upgrade
I'm acting as root and have ensured that none of the update managers are running. First I tried to check what was locking it using:
sudo lsof /var/lib/dpkg/lock
with output of:
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/gareth/.gvfs
Output information may be incomplete.
Just in case I have tried to remove the lock using:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
...to no avail. Interestingly, if I am actually root and use:
sudo -s
apt-get update && apt-get upgrade
...the update works. So I can update and upgrade my packages as long as I am literally root which is somewhat frustrating. It also implies it more to do with permissions than something else locking the directory perhaps?
Thanks in advance with any assistance on this.