Ricochet was Manish Malik's blog from 2004 to 2008. It's preserved here as an archive. For current writing, visit manishmalik.com.

Ricochet

Recovering after /var/lib/dpkg is lost on Debian

What do you do if you accidently lose /var/lib/dpkg on your Debian installation?

Yes, the sin is grave. Try using apt after this and figure out yourself. ;-)

/var/lib/dpkg/status file is important - as it stores the information about which packages are present on your system. apt would be stranded without this information.

Fortunately, there are ways you can attempt to rebuild the structure.

Note: It is recommended to analyze each of the above scripts to figure what it attempts to do. Systems’ configurations differ - it may or may not suit yours.

Good Luck.