Bug 200670 - rpm database unrecoverble
rpm database unrecoverble
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
3
i686 Linux
medium Severity urgent
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
:
: 200669 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-30 08:40 EDT by Sun Minchao
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-01 08:26:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sun Minchao 2006-07-30 08:40:54 EDT
Description of problem:
rpm database corrupted and unrecoverble

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

How reproducible:


Steps to Reproduce:
1.as root in single user mode: cd /var/lib/rpm
2.rm -f __db*
3.db_verify Packages (failed)
4.rpm --rebuilddb (failed)
  
Actual results:

[/var/lib/rpm] rm -f __db*
[/var/lib/rpm] db_verify Packages
db_verify: page 466: illegal page type or format
db_verify: page 466: illegal page type or format
db_verify: PANIC: Invalid argument
db_verify: Packages: pgin failed for page 466
db_verify: Packages: DB_RUNRECOVERY: Fatal error, run database recovery
db_verify: DB->verify: Packages: DB_RUNRECOVERY: Fatal error, run database
recovery
db_verify: PANIC: fatal region error detected; run recovery
db_verify: dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery
[/var/lib/rpm] mv Packages Packages.orig
[/var/lib/rpm] db_dump Packages.orig | db_load Packages
db_dump: page 466: illegal page type or format
db_dump: PANIC: Invalid argument
db_dump: Packages.orig: pgin failed for page 466
db_dump: DB->stat: DB_RUNRECOVERY: Fatal error, run database recovery
db_dump: PANIC: fatal region error detected; run recovery
db_dump: close: DB_RUNRECOVERY: Fatal error, run database recovery
db_dump: PANIC: fatal region error detected; run recovery
db_dump: dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery
db_load: line 4: unexpected format
[/var/lib/rpm] rpm --rebuilddb
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30978) from dbenv->open: DB_RUNRECOVERY: Fatal error, run
database recovery
error: cannot open Packages index
[/var/lib/rpm]


Expected results:


Additional info:
the damaged /var/lib/rpm/Packages file is to large (39MB) to be attached here.
Comment 1 Sun Minchao 2006-07-30 08:47:19 EDT
*** Bug 200669 has been marked as a duplicate of this bug. ***
Comment 2 Jeff Johnson 2006-07-31 08:01:55 EDT
Can you add a ptr (i.e. a URL) to a tarball of your database?
    cd /var/lib
    tar czvf /tmp/rpmdb-200670.tar.gz ./rpm
Comment 3 Sun Minchao 2006-07-31 08:33:27 EDT
(In reply to comment #2)
> Can you add a ptr (i.e. a URL) to a tarball of your database?
>     cd /var/lib
>     tar czvf /tmp/rpmdb-200670.tar.gz ./rpm
> 

Thanks a lot for your quick reply!
I now put the achieved /var/lib/rpm here:

ftp://minchao.dyndns.org/pub/download/rpmdb-20070727.tar.gz


Comment 4 Jeff Johnson 2006-08-01 08:16:43 EDT
Reproduced the problem:
# /usr/lib/rpm/rpmdb_verify Packages 
rpmdb_verify: page 466: illegal page type or format
rpmdb_verify: PANIC: Invalid argument
rpmdb_verify: Packages: pgin failed for page 466
rpmdb_verify: Packages: DB_RUNRECOVERY: Fatal error, run database recovery
rpmdb_verify: PANIC: fatal region error detected; run recovery
rpmdb_verify: dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery
Comment 5 Jeff Johnson 2006-08-01 08:26:27 EDT
This is the "standard" fix"

# rm -f __db*
# mv Packages Packages-ORIG
# /usr/lib/rpm/rpmdb_dump Packages-ORIG | /usr/lib/rpm/rpmdb_load Packages
rpmdb_dump: page 466: illegal page type or format
rpmdb_dump: PANIC: Invalid argument
rpmdb_dump: Packages-ORIG: pgin failed for page 466
rpmdb_dump: PANIC: fatal region error detected; run recovery
rpmdb_dump: close: DB_RUNRECOVERY: Fatal error, run database recovery
rpmdb_dump: PANIC: fatal region error detected; run recovery

After doing those operations, there is significant data loss:
# ls -al Pack*
-rw-r--r-- 1 root root  7307264 Aug  1 08:25 Packages
-rw-r--r-- 1 rpm  rpm  39190528 Jul 19 14:55 Packages-ORIG

But the above saves what can be saved. I've put what can be saved at
    ftp://wraptastic.org/pub/jbj/Packages-200670.gz
Download, uncompress, and do
    mv /var/lib/rpm/Packages /var/lib/rpm/Packages-SAVE
    mv Packages /var/lib/rpm
    rpm --rebuilddb

Proceed by rinstalling headers that have been lost. The packages
that were installed on your box are in /var/log/rpmpkgs*. Compare
that list with "rpm -qa" output, reinstalling any packages that have been
lost.

Another way to proceed is to do
    rpm -Va --nofiles
installing packages to meet any unsatisfied dependencies.
Comment 6 Sun Minchao 2006-08-01 14:23:58 EDT
I'm now trying to reinstall the missing packages, a very very hard job,
especially because of the broken dependencies, a lesson will never be forgotten...

anyway, thank you very much for the quick help!

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