On Mon, Feb 23, 2009 at 8:59 AM, Bill Campbell centos@celestial.com wrote:
On Mon, Feb 23, 2009, Bart Schaefer wrote:
Over the weekend my workstation (still on CentOS 3) started showing SMART errors, so we shut it down and moved everything onto a new drive. On reboot, the RPM database reports as corrupted and "rpm --rebuilddb" segmentation faults.
Is there any reasonable way to recover from this, short of a complete reinstall? The machine is otherwise up though it's quite likely some files have been lost.
You may be able to get things going again with the bdb recover script, /usr/lib/rpm/rpmdb_recover. I think this should be a berkeley DB recovery routine that is specific to the version being used by rpm. I have recovered the OpenPKG rpm database using this technique using the standard bdb db_recover program.
If I am not mistaken, the appropriate command would be:
/usr/lib/rpm/rpmdb_recover -h /var/lib/rpm
You can first verity the database by:
cd /var/lib/rpm /usr/lib/rpm/rpmdb_verify Packages
If the recover command does not work, then try something like:
Check the contents of /var/log/rpmpkgs (and .1 .2 etc). Get all packages listed there into a single directory. cd to that directory and issue the command:
rpm -ivh --noscripts --notriggers --justdb *.rpm
to restore your /var/lib/rpm/Packages file
Akemi