On Wed, 2003-01-01 at 17:57, Michael Fratoni wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Wednesday 01 January 2003 06:57 pm, Cliff Wells wrote:
> > I seem to have lost my rpm database.  After upgrading a couple of rpms,
> > rpm would fail, telling me to run recover (whatever the hell that is -
> > couldn't find any reference to such a thing in the rpm man page).
> > Anyway, tried rpm --rebuilddb which also failed the first time, but
> > seemed to work the second time I ran it.  However, I then checked with
> > rpm -qa and there was only a single package listed.  I looked in
> > /var/lib and found a directory called rpmrebuilddb.1908.  I moved
> > /var/lib/rpm to a safe place and copied the rpmrebuilddb.1908 directory
> > to /var/lib/rpm.  Ran rpm --rebuilddb again.  Now I have a rpm database
> > with plenty 'o stuff in it, but I'm sure it's out of date.  No problem,
> > I think, I'll just run apt-get upgrade and bring it back into sync
> > (probably with some missing packages that I'll worry about later).
> > Unfortunately apt-get reports a bunch of unmet dependencies and refuses
> > to fix them (even using -f).
> 
> Well, it depends on how daring you want to get.... ;)

Ha.  Doesn't it always? ;)

> The version of RPM included with the 8.0 release is prone to getting hung, 
> and leaving the database in need of repair. 
> http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=73097
> 
> Generally, it is easily repaired with:
> rm -f /var/lib/rpm__db*
> rpm --rebuilddb
> 
> What you can try is:
> Download and install the test release of rpm, which has been working here 
> for about a month without problems. 
> ftp://people.redhat.com/jbj/test-4.1/
> 
> If you look in /var/log/rpmpkgs, you should have a complete list of all 
> the packages instaled on your system as of 4:00 AM today. If you have the 
> install CD's, you have access to most of the packages you have installed. 
> If you've kept the updated packages around as well, you're in excellent 
> shape.

Unfortunately I don't.  I generally use apt-get to install new packages
which means no local copies.  However /var/log/rpmpkgs is interesting
and I can see how I might use that to get somewhere. 

> Then, grab my quick hack of a script to rebuild the database. It's not 
> pretty, but should help. For each package listed in the given file 
> (/var/log/rpmpkgs) it will search the given paths for matching rpms, and 
> run 'rpm -ivh --justdb --force --nodeps $package'.
> http://www.tuxfan.homeip.net:8080/hacks/recover_rpm_db.sh

Hm. Getting a timeout trying to connect, I'll try back in a little bit,
but I can guess the logic of this fairly easily so maybe I can whip up
something equivalent if all else fails.

> Move your existing rpm database out of the way.
> # mv /var/lib/rpm /var/lib/rpm.save
> 
> Initialize a new rpm database:
> # rpm --initdb
> 
> Run the script.
> # ./recover_rpm_db.sh -f /var/log/rpmpkgs -p /mnt/cdrom/Redhat/RPMS 
> /var/spool/up2date
> 
> (assuming a valid filelist in /var/log/rpmpkgs, a mounted Red Hat CD in 
> /mnt/cdrom, and updates in /var/spool/up2date.)
> 
> You'll have to run it once for each CD, and it'll spew warnings about 
> packages not found for every package not on the current CD.
>
> If it works: 
> Thanks for testing, and congratulations!
>
> If it doesn't work:
> Sorry, thanks for testing. Please restore your previous rpm database. ;)

=)

> On the upside, I have tested it, and it does work. It will take some time 
> to complete though. Obviously, if there are packages on your system that 
> you don't have available, they won't be included in the restored 
> database.

I suppose I could use apt-get --download-only to retrieve the packages
prior to running the script.

> Good luck. Hope it helps,

Thanks, I'm not going to get to it today (the system is running fine a
the moment and I'm swamped) but I'll post a followup once I've been
through it.


-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to