rpmdb crashed, how to repair? [FC3]

Jim Cornette fc-cornette at insight.rr.com
Sun Feb 5 01:50:03 UTC 2006


Danny Terweij - Net Tuning | Net wrote:
> Hi there,
> 
> While running a yum update the hdd did get an error and the system was
> remounted in read only mode.
> 
> The error seems gone, but the rpmdb is not fine anymore, i did do
> rpm --rebuilddb
> But now i get weird errors with installing packages, like dupes or already
> installed (but it is not).
> 
> 
> How do i create a new rpmdb with current installed packages?
> 
> Or am i doomed? :)
> 
> Danny
> 
> 

Basically, you have to find the multiple version installed rpms and use 
a option to rpm called --justdb. this option will remove only the 
database entry for the old nonexistent package entry and then you could 
use the -V or --verify option to rpm to ensure the later installed 
version is intact. No output should show on the verify.

Someone on the test list posted this one-line command to allow an output 
to the terminal which will detect multiple entries of packages. The 
kernel and the gpg-pubkey and any other package that allows for multiple 
versions to coexist. If you are running a 64-bit system, the command 
will not work well.

rpm -aq --queryformat "%{NAME}\n" | sort | uniq -c | grep -v -E " *1 "

For packages that are not actually installed but are in the rpm 
database, it might be a tougher issue to deal with. You would need to 
run something like 'rpm -qa |grep missing' as root to detect packages 
which have missing files. Then you can either download the rpms and use 
rpm -Uvh --replacefiles --replacepkgs <package.rpm>
or remove the database entry for the messed up package and do a 'yum 
install <package>' on the shortchanged package. Yum should not know it 
is installed and install over whatever remained of the package.

This other suggestions or you're doomed as you stated above. :-)

Jim

-- 
The person who can smile when something goes wrong has thought of
someone to blame it on.




More information about the fedora-list mailing list