Fix: could not open file /var/lib/dpkg/status

The Status file in Linux stores all the installed package information, including dpkg. Furthermore, there is also an “apt-cache” file for users to approach information more speedily. While installing any dpkg packages in Linux, you can face the error “could not open file var/lib/dpkg/status”.

In this post, we will demonstrate the reason and solutions for the given error.

Let’s start this guide.

Reason: Status File is Missing or Corrupted

The only reason you may get this error is that your status file is missing or corrupted. There are two solutions for this reason, check if the status file is present or not or Recreate the status file. Below is the implementation of these two solutions

Solution 1: Check the Status File

First, check if the status file is available in the directory. Use the “cd” command to change the directory and then “ls” to verify the presence of the file:

$ cd /var/lib/dpkg/
$ ls

You can also check the status file by the graphical method as shown in the below image:

If the status file is present then reboot your system and run the system update and upgrade the packages:

$ sudo apt update
$ sudo apt upgrade

Now, check if the error is resolved or not.

Solution 2: Recreate the Status File

You can recreate the status file in case the “status” file is missing or not resolving the issue. A backup file is available in that directory with a “status-old” file name. To check the backup, go to the “var/lib/dpkg” directory and search for the “status-old” file:

$ cd /var/lib/dpkg/
$ ls

The above shows that the status-old (backup) file is available.

Copy the content of the “status-old” file to the “status” file as follows:

$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status

This command will ask the user for permission.

After that, run the system update command and upgrade the packages, if any:

$ sudo apt update 
$ sudo apt upgrade

After running the above commands, if the still has not resolved the error, then reboot your system once again. The error will be resolved.

That’s all for the write-up.


The reason for this error is that sometimes the status file gets corrupted or deleted. To fix the error could not open the file “var/lib/dpkg/status”, first check the availability of the status file using the “cd var/lib/dpkg” and “ls” commands. If the file is present, run the system update command “sudo apt update”. If the file is missing or not working correctly, recreate the status file by copying it from the status-old file with the help of the “sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status” command. This post has demonstrated the reason and the solutions for the error that could not open the file var/lib/dpkg/status.