Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied). Error while trying to use apt package manager in ubuntu

Error

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Solution

dpkg is the package manager for debian systems. When you try to use apt(Advanced Packaging Tool) for tasks like "apt install xxx" or "apt upgrade xxx" or "apt update xxx" etc. ("xxx" here stands for the package name). I have observed the above error in two scenarios.

1) Another package operation using apt is in progress, may be from a different terminal. In this case you have to wait for the already executing package operation to complete and then then re-execute the apt command. Else if you want to kill the running process of dpkg, prior to executing the present command, you may do so with following
$> sudo killall dpkg
$> sudo rm /var/lib/dpkg/lock

2) You need root privileges. This question is asked along with the error itself. Check the same. For executing the command as root you can prefix the command with sudo as
$> sudo apt install xxx
Then enter system password to execute the command as root.  

Footnote
Another way to always execute the commands at a particular terminal window as root is to type
$> sudo -s
and enter the password. The terminal prompt will change from $ to # . Now you can type all other commands without prefixing them with sudo. They will be executed with root privileges.

Comments

  1. Casinos & Bonus Sites like Lucky Club Casino Site
    Lucky Club is an online gambling site that is available in Malaysia, Curacao, Malaysia, and Singapore. The site is a part of the Lucky luckyclub Club site and

    ReplyDelete

Post a Comment

Popular from this site

How to set static IP address for Raspberry pi in headless setup?

Exception: Please shut down the controller which is running on port 6653: Mininet

Send and Capture icmp packets with type&code using hping