How to fix E: Could not open file /var/lib/dpkg/status - open (13: Permission denied) in APT

APTBEGINNERHIGHUpdated Dec 29, 2025· 224 views

This error occurs when apt or dpkg cannot read the package status file due to insufficient permissions. The fix is typically to run commands with sudo, check file permissions, or clear stale lock files that are blocking access.

Quick fix

Fixes E: Could not open file /var/lib/dpkg/status - open (13: Permission denied)

sudo apt update
sudo apt install package-name
sudo apt-get upgrade
  1. Try running the command with sudo
  2. Check for running package managers
  3. Remove stale lock files
  4. Repair file permissions
apt — error
sudo apt update
sudo apt install package-name
sudo apt-get upgrade
E: Could not open file /var/lib/dpkg/status - open (13: Permission denied)

What this error means

The /var/lib/dpkg/status file is a critical database that stores information about all installed packages on your system. When apt or dpkg cannot open this file, it means your user account lacks the necessary permissions to read it. This error (errno 13) specifically indicates a permission issue. The dpkg package manager requires root/superuser access to read and modify system package databases. This error commonly occurs when users attempt to run apt or apt-get commands without sudo, or when the file permissions have been incorrectly modified.

Typical symptoms

  • apt or apt-get commands fail immediately with permission denied error
  • Cannot run sudo apt update or sudo apt install
  • Software updater fails to run or check for updates
  • Error occurs even when trying to query package information with apt-cache
  • Lock files in /var/lib/dpkg directory prevent package operations

Common causes

  1. Running apt/apt-get commands without sudo (most common)
  2. Incorrect file permissions on /var/lib/dpkg directory or status file
  3. Another apt/package manager process holding a lock on the dpkg database
  4. Stale lock files left by a crashed package manager
  5. Corrupted or missing /var/lib/dpkg/status file

How to fix "E: Could not open file /var/lib/dpkg/status - open (13: Permission denied)"

1Try running the command with sudo

The most common fix is to simply prefix your apt command with sudo:

bash
sudo apt update
sudo apt install package-name
sudo apt-get upgrade

The sudo command grants you temporary root/superuser privileges needed to access the dpkg database. Without it, your regular user account cannot read the protected system files.

2Check for running package managers

Another process might be holding a lock on the dpkg database. Check if any other apt or package manager is running:

bash
sudo lsof /var/lib/dpkg/lock-frontend

If output is shown, wait for that process to complete. You can also check:

bash
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/cache/apt/archives/lock

If you see a process ID, you can wait for it to finish or carefully terminate it with:

bash
sudo kill -9 <PID>
3Remove stale lock files

If no process is using the locks, stale lock files might be blocking access. Remove them:

bash
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock

Then reconfigure the dpkg database:

bash
sudo dpkg --configure -a
sudo apt update
4Repair file permissions

If the issue persists, the dpkg directory permissions may be incorrect. Fix them:

bash
sudo chown root:root /var/lib/dpkg
sudo chmod 755 /var/lib/dpkg
sudo chown root:root /var/lib/dpkg/status
sudo chmod 644 /var/lib/dpkg/status

These commands ensure the dpkg directory and status file are owned by root with the correct permissions.

5Restore the status file from backup

If the status file is corrupted, restore it from the automatic backup:

bash
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
sudo apt update

Alternatively, if that backup doesn't exist, try:

bash
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo apt update
6Fix broken package installations

If a package installation was interrupted, reconfigure broken packages:

bash
sudo dpkg --configure -a
sudo apt --fix-broken install

This attempts to complete any incomplete package configurations and fixes dependencies.

Advanced notes

The /var/lib/dpkg directory is a critical system directory that should always be owned by root with permissions 755. The status file itself should have permissions 644. If you're working inside a Docker container or chroot environment, you might need to reinstall the base system packages if the dpkg database is severely corrupted. On systems with SELinux enabled, the context labels on /var/lib/dpkg files might also need to be restored with sudo restorecon -r /var/lib/dpkg. For fresh installations or container images, you may need to reinstall the base system with sudo apt install --reinstall base-files base-passwd.

Frequently asked questions

What does "E: Could not open file /var/lib/dpkg/status - open (13: Permission den" mean?
The /var/lib/dpkg/status file is a critical database that stores information about all installed packages on your system. When apt or dpkg cannot open this file, it means your user account lacks the necessary permissions to read it. This error (errno 13) specifically indicates a permission issue.
How do I fix "E: Could not open file /var/lib/dpkg/status - open (13: Permission den"?
This error occurs when apt or dpkg cannot read the package status file due to insufficient permissions. The fix is typically to run commands with sudo, check file permissions, or clear stale lock files that are blocking access.
What causes "E: Could not open file /var/lib/dpkg/status - open (13: Permission den"?
Running apt/apt-get commands without sudo (most common) Incorrect file permissions on /var/lib/dpkg directory or status file Another apt/package manager process holding a lock on the dpkg database
Is the "E: Could not open file /var/lib/dpkg/status - open (13: Permission den" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading