• Contact Us
  • copyright
  • About Us
  • Privacy Policy
  • Devops
  • Linux
Globedrill

Could not open lock file /var/lib/dpkg/lock – open (13: Permission denied)

Linux/15 May, 16/2803/0
Linux
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?

FIX :

I got the above error on my Ubuntu server while trying to remove a package. In the error, you can see it is asking ‘are you root?’.

Error shows that the user that is running the command doesn’t have permission to make any changes on the server. The user need superuser privilege to execute the command on the Ubuntu server.

You tried to run a command on Debian / Ubuntu server without superuser privilege.
 

steve@steve-PC12 ~ $ apt-get remove apache2

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?

 

To fix the error you must either switch as ‘root’ user or run the command with sudo.

Example :

Try “sudo apt-get remove apache2” to remove the package. (Add sudo in front)
 

steve@steve-PC12 ~ $ sudo apt-get remove apache2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
apache2

 

Check whether the user exists in sudoers file, if you’re still getting the same error. grep the username in /etc/sudoers file
 

grep username /etc/sudoers

 
You wont see any errors if you switch to root user and run the command.
 

Leave a Reply Cancel reply

.

About Us

Globedrill.com is a website that publishes articles related to Linux and Devops. Globedrill was started on April 2016.

Contact Us

Email : globedrill.c@gmail.com

Globedrill

Copyright © 2016 Globedrill. All Rights Reserved. The content in this website is copyrighted to Globedrill.com and may not be republished either online or offline.

  • About Us
  • Privacy Policy
  • Contact Us
  • copyright