Missing /var/lib/dpkg/status

Asked by Nicolas Fremaux on 2007-08-24

Some time ago, some program (I believe it was wesnoth) froze Ubuntu completely, and I had to reboot "manually". On reboot, after a fsck, a lot of apps had lost their configuration. I managed to fix most of the problems, but I have a nasty one with the package manager.

Opening the package manager through the GUI results in the following error message:

>>Could not initialize the package information
>>A unresolvable problem occurred while initializing the package information.
>>Please report this bug against the 'update-manager' package and include the following error message:
>>'E:Could not open file /var/lib/dpkg/status - open (2 No such file or directory), E:The package lists or status file could not be parsed or opened.'

And indeed, I have no /var/lib/dpkg/status file. Using a variety of dpkg and apt-get commands always result in the same kind of error message. So far I have tried:

>>dpkg --configure -a
>>apt-get check
>>apt-get -f install

Is there a way to rebuild or create the status file? Will I have to re-install all my packages?

Thanks for your help!


Question information

English Edit question
Ubuntu synaptic Edit question
No assignee Edit question
Solved by:
Mathias Uebelacker
Last query:
Last reply:

Hello Nicolas,

please check your /var/lib/dpkg directory. There should be a status-old file. If so please rename the file to status and try to start your package manager.


Nicolas Fremaux (nicofremaux) said : #2

Unfortunately, there's no status-old file... Here's the contents of the /var/lib/dpkg directory:

nfremaux@nfremaux-laptop:/var/lib/dpkg$ ll
total 2588
drwxr-xr-x 2 root root 4096 2007-06-03 15:40 alternatives
-rw-r--r-- 1 root root 4243456 2007-06-18 23:50 available
-rw-r--r-- 1 root root 8 2006-10-25 15:26 cmethopt
-rw-r--r-- 1 root root 2552 2007-05-05 00:16 diversions
-rw-r--r-- 1 root root 2491 2007-05-05 00:16 diversions-old
drwxr-xr-x 2 root root 167936 2007-06-18 23:50 info
-rw-r----- 1 root root 0 2007-08-24 10:35 lock
drwxr-xr-x 5 root root 4096 2006-10-25 15:28 methods
drwxr-xr-x 2 root root 4096 2006-10-03 20:40 parts
-rw-r--r-- 1 root root 30 2006-10-25 15:37 statoverride
-rw-r--r-- 1 root root 0 2006-10-25 15:26 statoverride-old
drwxr-xr-x 2 root root 4096 2007-06-18 23:50 updates



Nicolas Fremaux (nicofremaux) said : #3

I noticed that creating a blank status file (e.g. "touch status") allows apt-get check to run without errors. I'm sure it's a sound thing to do however. Any comments?


Nicolas Fremaux (nicofremaux) said : #4

Correction: I meant "I'm *not* sure it's a sound thing to do however."

Hello Nikolas,

here are a nice script which rebuild a debian package database[1] and the script for copy and paste[2]


[1] http://linuxmafia.com/faq/Debian/package-database-rebuild.html
[2] http://www.debian.org/doc/manuals/reference/examples/debian-package-database-rebuild

Nicolas Fremaux (nicofremaux) said : #6

Thanks Mathias Uebelacker, that solved my question.

Nicolas Fremaux (nicofremaux) said : #7

More details...

I tried to run the script, but it stopped because it found existing directories in /var (since my system was not completely destroyed). I was a bit reluctant to remove the existing /var directories or to comment out that part of the script, so I explored http://qref.sourceforge.net/Debian/reference/ch-package.en.html#s-recover-status (quoted in the first reference of your message). It mentions that status backups can be found in /var/backups (I'm a bit ashamed I didn't look there first...). And indeed I found a valid status file there, and dpkg now seems to be running correctly!

Thanks a lot Mathias!!!