Bug 57112 - rpm core dumps when it encounters a damaged header
Summary: rpm core dumps when it encounters a damaged header
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 7.2
Hardware: i586
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL: http://lundgren.denver.co.us/~lundgre...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-12-05 00:07 UTC by Andrew B. Lundgren
Modified: 2008-08-01 16:22 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-12-05 20:50:00 UTC
Embargoed:


Attachments (Terms of Use)
/var/lib/rpm directory (5.24 MB, application/octet-stream)
2001-12-05 00:16 UTC, Andrew B. Lundgren
no flags Details
program to delete header instance #610 (1.47 KB, patch)
2001-12-05 20:49 UTC, Jeff Johnson
no flags Details | Diff

Description Andrew B. Lundgren 2001-12-05 00:07:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.61 [en] (OS/2; U)

Description of problem:
My rpmdb has become corrupted.  (I don't know how.)  When I try to run any rpm commands it errors out and core dumps.  The following is an 
example command:
# rpmdb --rebuilddb
error: rpmdb: damaged header instance #427 retrieved, skipping.
Segmentation fault

A tar of my /var/lib/rpm directory is in the URL above.







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


How reproducible:
Always

Steps to Reproduce:
1.run any rpm command against my rpmdb
2.
3.
	

Additional info:

Comment 1 Andrew B. Lundgren 2001-12-05 00:16:15 UTC
Created attachment 39649 [details]
/var/lib/rpm directory

Comment 2 Andrew B. Lundgren 2001-12-05 00:18:34 UTC
rpm removed from URL as it is now attached as an attachment to the bug.

Comment 3 Jeff Johnson 2001-12-05 15:48:59 UTC
I need the URL, please, as rpm databases are too big for bugzilla
attachments.

Comment 4 Andrew B. Lundgren 2001-12-05 16:59:51 UTC
It is now back at the previous URL.

Comment 5 Jeff Johnson 2001-12-05 18:56:37 UTC
Install rpm-4.0.3, using rpm2cpio if necessary, from
	ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x
Assuming all 6 packages (don't forget popt) are downloaded
into /var/tmp/, do as root
	mkdir /var/tmp/xx
	cd /var/tmp/xxx
	for i in ../{rpm,popt}-*i386.rpm
	do
	    rpm2cpio $i | cpio -dim
	done
	find . -type d -exec chmod 755 {} \;
	tar cf - * | (cd /; tar xvf -)
Then a rp[m --rebuilddb should fix your problem.

Comment 6 Andrew B. Lundgren 2001-12-05 19:23:07 UTC
I am not positive I got the correct rpms.  I had no problems with the
directions.

The following are the rpms I used:

69457 Dec  3 11:39 ../popt-1.6.3-7x.i386.rpm
2119120 Dec  5 12:05 ../rpm-4_0_3-7x_i386.rpm
77134 Dec  5 12:05 ../rpm-build-4_0_3-7x_i386.rpm
4875855 Dec  5 12:05 ../rpm-devel-4_0_3-7x_i386.rpm
99311 Dec  5 12:05 ../rpm-perl-4_0_3-7x_i386.rpm
46651 Dec  5 12:05 ../rpm-python-4_0_3-7x_i386.rpm


The rpm --rebuilddb still segs.

rpm --rebuilddb
error: rpmdb: damaged header instance #427 retrieved, skipping.
Segmentation fault

The following is the version:

rpm --version
RPM version 4.0.3

The following is the sum:

sum /bin/rpm
41880  1545

cksum  /bin/rpm
2992084340 1582024 /bin/rpm


Comment 7 Jeff Johnson 2001-12-05 20:49:06 UTC
OK, here's the next steps (you need db3-utils)
	cd /var/lib/rpm
	db_verify Packages
	mv Packages Packages-ORIG
	db_dump Packages-ORIG | db_load Packages

Compile and run the attached program
	cc -o t57112 t57112.c -ldb-3.2

Try the rpm --rebuilddb again.

Comment 8 Jeff Johnson 2001-12-05 20:49:54 UTC
Created attachment 39748 [details]
program to delete header instance #610

Comment 9 Jeff Johnson 2001-12-05 21:04:02 UTC
(Damn, my comments were lost. Presumably you have them in e-mail,
otherwise reopen and I'll type Yet Again.)

Comment 10 Andrew B. Lundgren 2001-12-05 22:37:19 UTC
I was unable to run the db_util commands because of a version mismatch between
my dbutils and the ones required by the Package (unexpected...)

I figured that since I had the rpms directory tarred up I might as well give
your executable a shot.

I built it and ran it.  Following that I ran the rpm --rebuild and the problem
seems to be corrected.

Thanks for the help!


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