Difference between revisions of "Fix corrupted RPM database"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==Fix corrupted RPM database== If rpm / yum command hangs during operations or you see error messages - it means your rpm database corrupted. Below was the error I was gettin...")
 
(No difference)

Latest revision as of 19:09, 14 April 2014

Fix corrupted RPM database

If rpm / yum command hangs during operations or you see error messages - it means your rpm database corrupted. Below was the error I was getting while running an strace on the process to see where/why it was hanging.

stat("/var/lib/rpm/Packages", {st_mode=S_IFREG|0644, st_size=47439872, ...}) = 0
open("/var/lib/rpm/Packages", O_RDONLY) = 4
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
read(4, "\0\0\0\0\1\0\0\0\0\0\0\0a\25\6\0\10\0\0\0\0\20\0\0\0\10\0\0\373%\0\0"..., 512) = 512
close(4) = 0
open("/var/lib/rpm/Packages", O_RDONLY) = 4
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=47439872, ...}) = 0
futex(0x2ad945ad8a74, FUTEX_WAIT, 1, NULL^X

I noticed that it was hanging on the /var/lib/rpm/Packages

Let fix it

/var/lib/rpm/ stores rpm database just delete the same and rebuild rpm database:

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

Once those have been deleted, you will want to rebuild them.

rpm --rebuilddb 

Now if you like me, it appears that is just hanging as it can take a while so I ran strace on the process

strace rpm --rebuilddb