[CentOS] Upgrade 3.4 --> 3.7 went awry: rpmdb hosed

Fri Jul 7 11:40:57 UTC 2006
Dag Wieers <dag at wieers.com>

On Thu, 6 Jul 2006, Bart Schaefer wrote:

> I installed CentOS 3.4 from a CD image I'd burned a while ago, and
> then attempted to update with yum to 3.7.  All the packages installed
> OK, but at the very end of final cleanup I got an error message from
> db4 saying to "RUN RECOVERY".
> I did "rpm --rebuilddb" which may have been the wrong thing -- it
> issued an error about "pages missing".  I then ran it again, and it
> came back with no errors, but after rebooting (for the kernel update)
> "rpm -qa" lists only a dozen packages or so, of which "rpm" is not
> one, and "yum check-update" chokes, showing Null for $releasever and
> the empty string for $basearch.

Never, ever do "rpm --rebuilddb" with the __db.* files in place. First 
remove the __db* files then see if that fixes your problem.

If you have to run "rpm --rebuilddb", make sure you remove the __db.* 
files first otherwise this will most likely corrupt your database 
(especially when the __db* files are the cause of your problems).

If you happen to have cache-corruption again, always make a copy of 
/var/lib/rpm, because rpm in that case thinks it has fixed the problem 
while it made it worse and does not leave a directory behind.

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]