Geoffrey wrote:
A colleague of mine has apparently trashed his rpm database. Red Hat EL 4. He was in the midst of a relatively major update, when up2sdate

You should be asking this on the Nahant list. I'm going to assume you mean Tikanga (I have a nahant clone, but yum is the preferred tool there).

With reasonable luck up2date will work here as well as yum.

crashed (he waits too long to update, but that's another story). Now when he does 'rpm -qa|wc -l' it returns 47, and we all know that's not accurate.

We've tried:

rpm --rebuilddb
rpmdb --rebuilddb

No joy.  At first we received this error:

'RPM error.  The message was:
Could not determine what version of Red Hat Linux you are running.
If you get this error, try running
    rpm --rebuilddb'

Seems to me time for a Crude Hack.
1. Backup the /var/lib/rpm directory. Even better, everything. Best, clone the system and (get colleague to) work on that.
2. Obtain a list of files:
  find / -xdev -type f | egrep -v ^/(usr|var)/local' >/tmp/files
Note, adjust the find command to include all relevant mount points

Copy the file list to a known good system, freshly-installed is Good. Preferably,. one that's a good fit for the broken system.

On Good System:
cat /tmp/files \
  | xargs rpm -qf --qf '%{name}\n' \
  | sort -u \
  | tee /tmp/rpms

Copy /tmp/rpms to bad system.

Now is when things get tricky. One hopes that all dependencies were resolved on the colleagues system, and on the second system. With any kind of luck this will work.
rpm --initdb
cat /tmp/rpms | xargs yum install

I was going to say to use "rpm --install --nodeps --justdb" but then you have to match the package name to the file containing it, and you have to have the files (or at least a list of them) local _and_ worry about getting the correct version Using yum or up2date may result in all files getting replaced, but you will have the latest versions available. Watch out for configuration files!! The rpm command is benign.


I have, of course, not tested any of this. If you don't take a good backup, it will most likely make things worse;-) OTOH, if you take a backup, you won't need it.

A tb disk in a USB2 enclosure is cheaper than a few hours' time, I suggest you get one if you don't have one now, and boot a CD to copy the system. Then maybe use the new disk and keep the old one as a reminder.






--

Cheers
John

-- spambait
[EMAIL PROTECTED]  [EMAIL PROTECTED]
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to