How to handle 'Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)' error?

October 05, 2022 No comments linux bash root permission denied error

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

To get rid of Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) error you need to make sure you are a root or have root rights in your operation system.

You need to use sudo to run a command with root privileges, for example:

sudo apt-get update

Also when you try to run two commands in one line, for example:

apt-get update && apt-get install curl

and you are getting the following 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?

Try to call these commands separately with sudo:

sudo apt-get update
sudo apt-get install curl
{{ message }}

{{ 'Comments are closed.' | trans }}