Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:


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 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.

share|improve this question

marked as duplicate by Eliah Kagan, Rinzwind, Radu Rădeanu, muru, Eric Carvalho Aug 21 '14 at 10:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

write the command you use to install (as you write it in terminal) – nux Feb 19 '14 at 13:39
up vote 5 down vote accepted

You forgot the sudo for the second command. sudo apt-get update && sudo apt-get upgrade will work.

share|improve this answer
Thanks! Now I feel terribly stupid for missing that! – welshpudding Feb 19 '14 at 14:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.