May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories

May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  

Rebuild corrupt RPM database

Sometimes RPM databases become corrupt. You will no longer be able to install/upgrade/remove programs using YUM or RPM command. Even RPM quey simply gets hung.This is the case when you need to repair RPM databases. 

To repair do the following:

 

cp -rp /var/lib/rpm{,`data +%F`.bk}

This command is to take a backup of  ‘ /var/lib/rpm‘ directory

rm -f /var/lib/rpm/__db*

This command clears the RPM database. Then enter the following command,

rpm -vv –rebuilddb

This command rebuild database in in verbose mode so that you see the process. Now your RPM database is perfect.
You can just check following command to confirm this.

rpm -qa

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>