Bug 46025 - RPM database corrupted
Summary: RPM database corrupted
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 6.2
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL: http://home.world-online.no/~andrej/r...
Depends On:
TreeView+ depends on / blocked
Reported: 2001-06-26 12:08 UTC by André Johansen
Modified: 2007-04-18 16:33 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-06-27 19:37:05 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description André Johansen 2001-06-26 12:08:16 UTC
System is a fully updated 6.2, with RPM databases in db3-format.
I installed the recently released XFree86-updates using kpackage, and
it crashed during installation (SIGABRT, think it was in FileClose or
something similar -- unfortunately, I did not keep the call-stack as
I didn't know the seriousness of the problem then).
After that, the RPM Packages database was broken, and queries does not
work anymore.

[root@zeus rpm]# rpm -q rpm
[root@zeus rpm]# rpm -qa|wc -l
memory alloc (612582029 bytes) returned NULL.
(the system has some 300-400 packages installed, IIRC).
[root@zeus rpm]# db3_verify Packages
db_verify: First overflow page 6 has a prev_pgno
db_verify: Overflow item incomplete on page 6
db_verify: First overflow page 1082 has a prev_pgno
db_verify: Overflow item incomplete on page 1082
db_verify: First overflow page 616 has a prev_pgno
db_verify: Overflow item incomplete on page 616
db_verify: Overflow item incomplete on page 2495
db_verify: First overflow page 689 has a prev_pgno
db_verify: Overflow item incomplete on page 689
db_verify: First overflow page 210 has a prev_pgno
db_verify: Overflow item incomplete on page 210
db_verify: DB->verify: Packages: DB_VERIFY_BAD: Database verification failed
(the other database-files are fine)

I'll try the current RawHide 4.0.3-version (as noted in other reports),
and report back on success/failure.

Comment 1 André Johansen 2001-06-26 12:32:34 UTC
I'm unable to installed the RawHide-version due to dependencies
(bzip2-libs, and the RawHide version required GNU libc v2.2).

Comment 2 Jeff Johnson 2001-06-26 17:05:34 UTC
You can repair damage in a db3 based rpm database using tools
found in the db3-utils package. For example,
	cd /var/lib/rpm
	for i in [A-Z]* ; do
	    echo $i --
	    db3_verify $i
should exhibit the same failure modes. Then you can repair the
damage by doing (assuming Packages is damaged)
	cd /var/lib/rpm
	mv Package Packages-SAVE
	db3_dump Packages-SAVE | db3_load Packages
and verifying as above.

Comment 3 André Johansen 2001-06-27 09:27:57 UTC
That did unfortunately not work; the database was repaired, but rpm still

[root@zeus rpm]# mv Packages Packages.corrupted
[root@zeus rpm]# db3_dump Packages.corrupted | db3_load Packages
[root@zeus rpm]# l
total 22784
-rw-r--r--    1 root     root      2637824 Jun 26 14:27 Basenames
-rw-r--r--    1 root     root        12288 Apr 27 09:23 Conflictname
-rw-r--r--    1 root     root        12288 Jun 26 14:27 Group
-rw-r--r--    1 root     root        24576 Jun 26 14:27 Name
-rw-r--r--    1 root     root     10407936 Jun 27 11:24 Packages
-rw-r--r--    1 root     root     10485760 Jun 26 14:27 Packages.corrupted
-rw-r--r--    1 root     root        90112 Jun 26 14:27 Providename
-rw-r--r--    1 root     root        94208 Jun 26 14:27 Requirename
-rw-r--r--    1 root     root        12288 Jun 26 11:13 Triggername
[root@zeus rpm]# db3_verify Packages
[root@zeus rpm]# rpm -qa|wc -l
memory alloc (612582029 bytes) returned NULL.
[root@zeus rpm]# db3_verify Packages
[root@zeus rpm]# rpm --rebuilddb
memory alloc (612582029 bytes) returned NULL.
[root@zeus rpm]# 

Now I have a non-corrupt database, but the contents are still broken.

(This has only happened on one machine, which is very stable; it currently
has an uptime of more than 300 days, which was the last powercut here.)

Comment 4 Jeff Johnson 2001-06-27 18:21:55 UTC
OK, please attach a pointer (i.e. URL) to a tarball of your database
	cd /var/lib
	tar czvf /tmp/rpmdb-46025.tar.gz
and I'll get you a fix.

Comment 5 André Johansen 2001-06-27 19:35:03 UTC
Thanks -- I've placed a link to the tarball in the URL field.
The Package database is the unrepaired db3-file.

Comment 6 André Johansen 2001-06-27 19:37:01 UTC
BTW, I've also tried rebuilding the database on a 2GB machine; rpm did not
run out of memory there, but it still crashed.

Comment 7 Jeff Johnson 2001-06-30 18:51:21 UTC
Fixed in rpm-4.0.3-0.55. Meanwhile, your rpm/Packages file and my
rebuilddb log are at
Do the following
	cd /var/lib/rpm
	mv Packages Packages-SAVE
	cd ..
	tar xzvf rpmdb3-46025-FIX.tar.gz
	rpm --rebuilddb -vv

Comment 8 André Johansen 2001-06-30 19:14:10 UTC
Thanks, it works!

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