Debian: Need help with corrupted dpkg database

der.hans plug-discuss@lists.PLUG.phoenix.az.us
Wed, 18 Apr 2001 02:12:34 -0700 (MST)


Am 17. Apr, 2001 schwäzte Bob George so:

> Well, I'm stuck good and hard. Had an unfortunate encounter with a power
> cord, and after a painful run-through with fsck, "apt-get upgrade" or
> anything similar ends with an ugly "dpkg: parse error, in file
> `/var/lib/dkpg/available' near line 2" I noticed a number of problems with
> files that seem related when going though the fsck process, so I suspect the
> database is corrupted. I've run through the manual pages for dpkg and
> others, but nothings jumping out at me. Can anyone give a quick hint as to
> where to start rebuilding a corrupt database?

I don't know of a way to rebuild a corrupt database. I suppose with a lot
of work you could query another box to find out what packages the files
you have left belong to and count that as your db, but I don't know of
anything that would do such a thing.

> Also, I'd like to be able to reproduce this box. It's VERY standard, and my
> only customizations consist of a handful of scripts. Is there a way to
> extract what packages are installed, then automatically re-create a similar
> config on a new (clone) box?

JLF has mentioned how to do this before. I believe these snippets from the
dpkg man page are appropriate:

       To make a local copy of the package selection states:
            dpkg --get-selections >myselections

       You  might  transfer  this  file  to another computer, and
       install it there with:
            dpkg --set-selections <myselections
       Note that this will not actually install  or  remove  any­
       thing,  but just set tghe selection state on the requested
       packages.  You will need some other application  to  actu­
       ally download and install the requested packages.

BTW, anyone know what a SELECTION STATE of deinstall means?

ciao,

der.hans
-- 
# der.hans@LuftHans.com home.pages.de/~lufthans/ www.YourCompanyHere.net ;-)
#  C'est la Net - der.hans