Bug 57112 - rpm core dumps when it encounters a damaged header
rpm core dumps when it encounters a damaged header
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
7.2
i586 Linux
medium Severity high
: ---
: ---
Assigned To: Jeff Johnson
http://lundgren.denver.co.us/~lundgre...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-04 19:07 EST by Andrew B. Lundgren
Modified: 2008-08-01 12:22 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-12-05 15:50:00 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Andrew B. Lundgren 2001-12-04 19:07:08 EST
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-04 19:16:15 EST
Created attachment 39649 [details]
/var/lib/rpm directory
Comment 2 Andrew B. Lundgren 2001-12-04 19:18:34 EST
rpm removed from URL as it is now attached as an attachment to the bug.
Comment 3 Jeff Johnson 2001-12-05 10:48:59 EST
I need the URL, please, as rpm databases are too big for bugzilla
attachments.
Comment 4 Andrew B. Lundgren 2001-12-05 11:59:51 EST
It is now back at the previous URL.
Comment 5 Jeff Johnson 2001-12-05 13:56:37 EST
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 14:23:07 EST
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 15:49:06 EST
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 15:49:54 EST
Created attachment 39748 [details]
program to delete header instance #610
Comment 9 Jeff Johnson 2001-12-05 16:04:02 EST
(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 17:37:19 EST
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.