Bug 77503

Summary: RPM version 4.0.4 --rebuliddb damaged header/rpmdb corruption?
Product: [Retired] Red Hat Linux Reporter: ethans
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WORKSFORME QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: http://64.40.32.32/rpmdb.tar.gz
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-11-18 20:33:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ethans 2002-11-08 00:12:42 UTC
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
http://64.40.32.32/rpmdb.tar.gz ) 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:
Always

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 14:18:57 UTC
Changing component to rpm.


Comment 2 Jeff Johnson 2002-11-16 14:52:59 UTC
3 headers were damaged. I've removed by doing
rpm --rebuilddb with rpm-4.1.

Your fixed rpm/Packages is at
	ftp://people.redhat.com/jbj/rpmdb-77503-FIX.tar.gz

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 20:26:04 UTC
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 20:33:24 UTC
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
	done
	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 15:00:23 UTC
Presumably you've done a --rebuilddb with rpm-4.1.
Otherwise reopen, and I'll get you sorted out.