rpmdb crashed, how to repair? [FC3]

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


akonstam at trinity.edu wrote:
> You subject does not seem to have any relationship to what you say in
> your posting.
> But incase you do what to repair the rpm database you do it by:
> rm  /var/lib/rpm/__db*
> rpm --rebuilddb

The original poster referred to trying the above steps. I don't see any 
references regarding the 'rm /var/lib/rpm/__db*' before running a 
rebuild on the database. I don't recall removing the entries helping out 
much before. The continuation was mainly referring to detecting which 
rpms were not cleaned up after install and left entries in the database.
Out of curiosity myself, I'll see what happens when the 
/var/lib/rpm/__db* files are removed and the rpmdb is rebuilt with 'rpm 
--rebuilddb'

https://www.redhat.com/archives/fedora-list/2006-February/msg00602.html

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





> 
> On Sun, Feb 05, 2006 at 05:19:14PM -0500, Jim Cornette wrote:
>> Gene Heskett wrote:
>>
>>>> I should learn scripting instead of using ready-made scripts. Some day
>>>> maybe.
>>>>
>>>> Jim
>>> ;-)  I hear that, Jim.  Me, at 71 I tend to furget, so I write scripts 
>>> that don't forget.  Yup, been there, done that. Several times...  And a 
>>> month later I may have forgotten the scripts name, and where I stashed 
>>> it.  I've heard that called CRS.
>>>
>> Gene,
>> I was able to get a script that will show you the version information 
>> and also it has the ability to not show rpms which it is normally 
>> allowed to show more than one instance. Steve Grub and Villa Herva had 
>> the most to do with this script. I did a bit of removal for the 
>> mismatched portion and added user feedback echoed test to terminal. I 
>> attached this as a text file, but it is actually a script.
>>
>> A problem with the script that Ville described was the possibility that 
>> fookernel and kernelfoo packages would also be excluded as being 
>> alright. I checked and this is true. Ville suggested something like
>> egrep "^ +[0123456789]+ +($dups)$"
>> be added to the script to prevent the possibility from happening.
>>
>> Jim
>>
>> -- 
>> The person who can smile when something goes wrong has thought of
>> someone to blame it on.
> 
>> #!/bin/sh
>>
>> # Add any package here that is OK to have duplicates
>> dups="gpg-pubkey|kernel"
>> echo "Starting search for multiple rpms versions."
>> echo 
>>
>> # Test 1. Look for multiple versions of the same package
>> # We use # as a separator so that we can remove it later. # is not in any
>> # package name that I know of and that's the basis of using it.
>> list=`rpm -qa --queryformat "%{NAME}#%{ARCH}\n" | sort | uniq -c |  tr '#' ' ' \
>> | egrep -vw "$dups" | awk '$1 > 1 { print $2 } '`
>>
>> if [ x"$list" != "x" ] ; then
>>         echo "Duplicates were found:"
>>         echo $list | xargs rpm -q
>>         exit 1
>> else echo "No Duplicates found"
>> fi
>>
>> 	echo
>>   	echo "Ending Search for Multiple RPMS."
>> 	exit 0
>> fi
>>
>> exit 0
> 

-- 
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