Bug 46025 - RPM database corrupted
RPM database corrupted
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
6.2
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
http://home.world-online.no/~andrej/r...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-26 08:08 EDT by André Johansen
Modified: 2007-04-18 12:33 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description André Johansen 2001-06-26 08:08:16 EDT
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
rpm-4.0.2-6x
[root@zeus rpm]# rpm -qa|wc -l
memory alloc (612582029 bytes) returned NULL.
    106
(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 08:32:34 EDT
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 13:05:34 EDT
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
	done
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 05:27:57 EDT
That did unfortunately not work; the database was repaired, but rpm still
crashes:

[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.
    106
[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 14:21:55 EDT
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 15:35:03 EDT
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 15:37:01 EDT
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 14:51:21 EDT
Fixed in rpm-4.0.3-0.55. Meanwhile, your rpm/Packages file and my
rebuilddb log are at
	ftp://people.redhat.com/jbj/rpmdb3-46025-FIX.tar.gz
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 15:14:10 EDT
Thanks, it works!


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