Bug 101406 - rpm database corrupt, rpm does not report installed packages
Summary: rpm database corrupt, rpm does not report installed packages
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 9
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-31 18:46 UTC by Mate Wierdl
Modified: 2007-04-18 16:56 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-19 18:42:57 UTC
Embargoed:


Attachments (Terms of Use)

Description Mate Wierdl 2003-07-31 18:46:13 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
Presently, I am getting

# rpm -q kernel rpm
package kernel is not installed
package rpm is not installed

or more generally:

# rpm -qa|wc -l
    101

which should be compared with

# ls /usr/share/doc/|wc -l
    436

This happened after I did 

# rpm -Fvh *
Preparing...                rpmdb: read: 0x40445380, 4096: Input/output error)
error: db4 error(5) from dbcursor->c_get: Input/output error
rpmdb: read: 0x4046a6a0, 4096: Input/output error)
error: db4 error(5) from dbcursor->c_get: Input/output error
rpmdb: read: 0x405427c8, 4096: Input/output error)
error: db4 error(5) from dbcursor->c_get: Input/output error
rpmdb: read: 0x4048d8b0, 4096: Input/output error)
error: db4 error(5) from dbcursor->c_get: Input/output error
########################################### [100%]
Preparing...                ########################################### [100%]
   1:openssh                ########################################### [ 17%]
   2:kernel                 ########################################### [ 33%]
   3:openssh-askpass        ########################################### [ 50%]
   4:openssh-askpass-gnome  ########################################### [ 67%]
   5:openssh-clients        ########################################### [ 83%]
   6:openssh-server         ########################################### [100%]

# rpm --rebuilddb
rpmdb: read: 0x404d8f78, 4096: Input/output error
error: db4 error(5) from dbcursor->c_get: Input/output error
error: db4 error(16) from dbenv->remove: Device or resource busy

So now on the rpm-list Jeff recommended to do this

cd /var/lib
tar czvf /tmp/rpmdb-tar.gz rpm

(No IO errors here)

mv rpm rpm-FUBAR
tar xzvf /tmp/rpmdb-tar.gz
rm -f /var/lib/rpm/__db*
rpm --rebuilddb -vv

But I am still getting

# rpm -q kernel rpm
package kernel is not installed
package rpm is not installed

The output of `rpm --rebuilddb -vv' (with error redirected to the 
same file) is at 

http://www.csi.hu/mw/rpm.rebuilddb.out



Version-Release number of selected component (if applicable):
RPM version 4.2

How reproducible:
Always

Steps to Reproduce:
1. It is reproducable on _my_ system (only?).
2.
3.
    

Actual Results:  # rpm -q kernel rpm
package kernel is not installed
package rpm is not installed

Expected Results:  report that the kernel and rpm packages are installed

Additional info:

Comment 1 Jeff Johnson 2003-07-31 19:00:35 UTC
Ah, there you are. ;-)

Hmmm, I don't see any EIO Input/output errors in the --rebuilddb
log, so the "quick fix" to avoid a few bad blocks may be sufficient.
Be forewarned though, you may be looking at incipient hardware failure,
check /var/log/* files for other messages.

However, there appears to be significant data loss, glibc and kernel
are not in the rebuilddb output, and 101 packages is probably too small.

If you are lucky, then there should be a list of the packages installed
in /var/log/rpmpkgs*. Compare the best looking (i.e. largest, most recent)
rpmpkgs log with the output of
    rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm' | sort
to see what was lost. If you can attach a "diff -u" I can suggest the
least painful of several alternatives to recreating an rpmdb.

Comment 2 Jeremy Katz 2005-04-19 18:42:57 UTC
Closing due to inactivity.  If this issue still occurs with current releases,
please reopen and set the release in which you've encountered the problem.


Note You need to log in before you can comment on or make changes to this bug.