[K12OSN] Corrupted RPM DB

Angus Carr acarr at saskforestcentre.ca
Wed Apr 26 17:18:13 UTC 2006


Eric Harrison wrote:
> Angus Carr wrote:
>   
>> Here's an odd one for the list:
>>
>> I have a corrupted RPM DB. I think it's getting in the way of my yum
>> updates.
>>
>> RPM operations fail. All of them.
>>
>> I decided to try to correct the problem, following
>> http://www.rpm.org/hintskinks/repairdb
>> rm  -f /var/lib/rpm/__db*
>> rpm --rebuilddb
>>
>> The rm works, but the rebuilt db does not. It ends up flashing garbage
>> to the terminal.
>>
>> Any clues or suggestions?
>>
>> Angus Carr.
>>
>>     
>
>
> There are a number of other suggestions further down on the link you
> posted (http://www.rpm.org/hintskinks/repairdb).
>
> First and foremost is backups. Do you have good backups? (you should!)
> If so, restore /var/lib/rpm/ to a known good copy.
>
> I have tested the dump & restore trick:
>
>    cd /var/lib/rpm
>    /usr/lib/rpm/rpmdb_verify Packages
>
> If there are any errors, repair by doing
>
>    mv Packages Packages-ORIG
>    /usr/lib/rpm/rpmdb_dump Packages-ORIG | \
>       /usr/lib/rpm/rpmdb_load Packages
>
>
> -Eric
>
>   
Well, therein lies the problem... It's not a production server, really. 
It's my workstation, and then it provides occasional email garden 
service. I don't even keep real data on it...

Is there anything I can do, given that I don't have a backup?

I am trying the package-ORIG thing now. Hopefully it won't hose my 
system (Holds breath while face turns blue).

Cheers! I'll keep you posted.

By the way, is there anything we can do to automate backing up 
/var/lib/rpmdb ?

If a simple failed yum update (or whatever it was kicked this process 
off) is going to stop my system from doing further updates, I regard 
that as a serious issue. If it happened to a teacher/general user/new 
user rather than a more committed user like myself, I could imagine it 
turning them off. Admittedly, we should suggest they use the 
CentOS-based releases rather than the FC release, but that's somewhat 
beside the point.

I don't know enough about /var/lib/rpm and issues that might arise out 
of it to know what sort of backups to suggest. Perhaps a monthly backup 
for CentOS-based releases and a weekly backup for Fedora releases, and 
rotate through a couple of them over time? It could be automated as a 
cron job. I'm not sure about the details like what to check before 
running- should it pause if another process is looking in there? Perhaps 
the cron job could sleep until a lock file is cleared.

Any thoughts?

I don't mind writing a script to do this, and I expect I will anyway, 
but I just want to know if anyone has matching thoughts...

Angus Carr.




More information about the K12OSN mailing list