How to fix E: Could not open file /var/lib/dpkg/status - open (13: Permission denied) in APT
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- Try running the command with sudo
- Check for running package managers
- Remove stale lock files
- Repair file permissions
sudo apt updatesudo apt install package-namesudo apt-get upgradeE: 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
- 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
- Stale lock files left by a crashed package manager
- Corrupted or missing /var/lib/dpkg/status file
How to fix "E: Could not open file /var/lib/dpkg/status - open (13: Permission denied)"
The most common fix is to simply prefix your apt command with sudo:
sudo apt update
sudo apt install package-name
sudo apt-get upgradeThe 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.
Another process might be holding a lock on the dpkg database. Check if any other apt or package manager is running:
sudo lsof /var/lib/dpkg/lock-frontendIf output is shown, wait for that process to complete. You can also check:
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/cache/apt/archives/lockIf you see a process ID, you can wait for it to finish or carefully terminate it with:
sudo kill -9 <PID>If no process is using the locks, stale lock files might be blocking access. Remove them:
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lockThen reconfigure the dpkg database:
sudo dpkg --configure -a
sudo apt updateIf the issue persists, the dpkg directory permissions may be incorrect. Fix them:
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/statusThese commands ensure the dpkg directory and status file are owned by root with the correct permissions.
If the status file is corrupted, restore it from the automatic backup:
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
sudo apt updateAlternatively, if that backup doesn't exist, try:
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo apt updateIf a package installation was interrupted, reconfigure broken packages:
sudo dpkg --configure -a
sudo apt --fix-broken installThis 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.