I was trying to remove package with autoremove command & i got this 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?"

how to resolve this?

  • Did you run sudo apt-get autoremove or did you not include the sudo part?
    – Thomas Ward
    Jan 6, 2016 at 3:54
  • i have run 'sudo apt-get autoremove' Jan 6, 2016 at 4:00

2 Answers 2


Try using "gksu nautilus" command in terminal and it will give you root access to whichever folder or file you need to move, delete, change. To change permissions right click the folder after you use gksu nautilus,

use "sudo -i" and enter in your root password, then use gksu nautilus.


The message E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) means one of two things:

  1. If you are not running your command with sudo you don't have access to that file. You should have posted the complete command and its output, and formatted it with the {} button.


  1. Some other package manager has the file locked. Find out which one with:

sudo /usr/bin/lsof /var/lib/dpkg/lock

Not the answer you're looking for? Browse other questions tagged .