Bug 77503 - RPM version 4.0.4 --rebuliddb damaged header/rpmdb corruption?
RPM version 4.0.4 --rebuliddb damaged header/rpmdb corruption?
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Depends On:
  Show dependency treegraph
Reported: 2002-11-07 19:12 EST by ethans
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-11-18 15:33:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description ethans 2002-11-07 19:12:42 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.79 [en] (X11; U; Linux 2.4.18-4smp i686; Nav)

Description of problem:
after running up2date -u and it crashing/timeing out, rpmdb is unable to
function, it seems anything related to rpm results in a Segmentation Fault.  I
believe my rpm database from /var/lib/rpm (provided at ) needs rebuilding.  Or maybe I need to
reinstall :/  

Is there a way to reconstruct an rpm database?

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

How reproducible:

Steps to Reproduce:
# up2date -u
error: rpmdb: damaged header instance #204 retrieved, skipping.
Segmentation fault

# rpm --version
RPM version 4.0.4

# rm -f /var/lib/rpm/__db.00*
# rpm --rebuilddb    
error: rpmdb: damaged header instance #204 retrieved, skipping.
*** dbiUpdateRecord: uh is NULL
Segmentation fault


Additional info:
Comment 1 Tim Powers 2002-11-08 09:18:57 EST
Changing component to rpm.
Comment 2 Jeff Johnson 2002-11-16 09:52:59 EST
3 headers were damaged. I've removed by doing
rpm --rebuilddb with rpm-4.1.

Your fixed rpm/Packages is at

Download and install by doing
	cd /var/lib
	mv rpm/Packages rpm/Packages-ORIG
	tar xzvf rpmdb-77503-FIX.tar.gz
	rpm --rebuilddb -vv
Comment 3 ethans 2002-11-18 15:26:04 EST
I only had RPM version 4.0.4, so I tried rpm --rebuilddb -vv (after overwriting
/var/lib/rpm/Packages with the fixed version) and got the following error:

# rpm --rebuilddb -vv
D: rebuilding database /var/lib/rpm into /var/lib/rpmrebuilddb.9466
D: creating directory /var/lib/rpmrebuilddb.9466
D: opening old database with dbapi 3
D: opening  db environment /var/lib/rpm/Packages create:mpool
D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
rpmdb: /var/lib/rpm/Packages: unsupported hash version: 8
D: closed   db index       /var/lib/rpm/Packages
D: closed   db environment /var/lib/rpm/Packages
D: removed  db environment /var/lib/rpm/Packages
D: opening db file        /var/lib/rpm/packages.rpm mode 0x0
D: closed  db file        /var/lib/rpm/packages.rpm
error: cannot open Packages index
D: removing directory /var/lib/rpmrebuilddb.9466

Should I try to upgrade rpm to rpm 4.1?  If so, what is the best way to do that
while my rpm database is corrupt?

Comment 4 Jeff Johnson 2002-11-18 15:33:24 EST
Sorry, I forgot that I was running db-4.1.24.

All that's needed is a rpm --rebuilddb with rpm-4.1,
latest packages at ftp://people.redhat.com/jbj/test-4.1.

You can install manually by downloading into /var/tmp,
and doing
	mkdir -p /var/tmp/xxx
	cd /var/tmp/xxx
	for i in ../*.rpm; do
	    rpm2cpio $i | cpio -dim
	find . -type d -exec chmod 0755 {} \;
	tar cf - . | (cd /; tar xvf -)
	rpm --rebuilddb -vv
Reinstall rpm-4.0.4 using --force after you're done
Comment 5 Jeff Johnson 2002-11-22 10:00:23 EST
Presumably you've done a --rebuilddb with rpm-4.1.
Otherwise reopen, and I'll get you sorted out.

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