[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg database repair



On Fri, Apr 05, 2002 at 08:09:32AM -0800, Terry Hancock wrote:
> 
> Hi,
> 
> Apt-get and dpkg work so well I hardly ever have to
> think about how they work. Unfortunately, this means
> I'm pretty clueless when something does go wrong.
> 
> I have two computers which apparently have damaged
> dpkg systems -- the status or package databases seem
> to be corrupted or destroyed.
> 
> For example, attempting to run apt-get update results
> in this error message (after checking for packages
> data from the Debian site):
> 
> Reading Package Lists... Error!
> 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.
> 
> (looks like I've made a blunder somewhere along the line!)

Ouch. That file is *important* - as you've just found out.

Can you remember what the last (successfull) dpkg (or apt-get) commands
were? Since it has happend on *two* of your machines, I would suspect a
bug in dpkg. 

Could you make backups of /var/lib/dpkg/* and /var/backups/dpkg.* asap?
They may be of value for the dpkg maintainer.  You may want to contact
him, as he would know better what to look for. 

> The other machine constantly sends email to the administrative
> email address complaining that various packages aren't being
> found in a database of some kind (I forget what the exact
> message is). 
> 
> It seems like there ought to be a way to have dpkg do
> a consistency check/repair of some kind (I though of 
> reinstalling dpkg, but then do I need dpkg to install
> dpkg?).  I'm sure there must be some facility for doing
> this, but I haven't found anything by just doing searches.

Re-installing dpkg wouldn't (necessarily) help, as the
/var/lib/dpkg/status is a status of currently installed packages. At
worst, you'll end upd with an empty one. YMMV.

> Is there a standard way to fix a corrupt dpkg system?

Backups. Backups. Backups. Preferably ankle-deep.

> The only thing I can think of at this point is to 
> manually backup all the user data areas and reinstall
> the whole system, but that's pretty painful, so I'd
> really like to try something less destructive.

dpkg *should* keep backups in /var/backups/dpkg.status*.

You may succeed by copying /var/backups/dpkg.status.0 to
/var/lib/dpkg/status. Beware though: This may result in dpkg's idea of
what is installed becoming out-of-sync with reality. If you have
installed/removed anything since the backup was made, expect to have to
re-install/re-remove it to sync things up.

Hope this helps
-- 
Karl E. Jørgensen
karl@jorgensen.com
www.karl.jorgensen.com
==== Today's fortune:
lp1 on fire
	-- One of the more obfuscated kernel messages

Attachment: pgp7jv6FFTkCX.pgp
Description: PGP signature


Reply to: