Bug 113710 - unable to rpm -qa after run /usr/lib/rpm/rpmdb_verify Packages OK
unable to rpm -qa after run /usr/lib/rpm/rpmdb_verify Packages OK
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
: 113712 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-16 13:45 EST by helen wang
Modified: 2007-04-18 13:01 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-16 19:34:55 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)

  None (edit)
Description helen wang 2004-01-16 13:45:45 EST
I am having rpm problem in RH9 after running up2date, either user or 
root can not query rpm packages
error message: 
#rpm -qa
rpmdb: /var/lib/rpm/Packages: unsupported hash version: 8
error: cannot open Packages index using db3 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm
no packages

after follow the instructions descripted in 
http://www.rpm.org/hintskinks/repairdb/

I have done as root:
#cd /var/lib/rpm
rm -f /var/lib/rpm/__db*
rpm -vv --rebuilddb

I got message:
# rpm -vv --rebuilddb
D: rebuilding database /var/lib/rpm into /var/lib/rpmrebuilddb.15334
D: creating directory /var/lib/rpmrebuilddb.15334
D: opening old database with dbapi 3
D: opening  db environment /var/lib/rpm/Packages create:cdb:mpool
D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
rpmdb: /var/lib/rpm/Packages: unsupported hash version: 8
D: closed   db index       /var/lib/rpm/Packages
D: closed   db environment /var/lib/rpm/Packages
error: cannot open Packages index
D: removing directory /var/lib/rpmrebuilddb.15334

so I did
#cd /var/lib/rpm
# rm -f __db.00*
# /usr/lib/rpm/rpmdb_verify Packages

no error message at this time
then I did 
#rpm -qa
I got:
rpmdb: /var/lib/rpm/Packages: unsupported hash version: 8
error: cannot open Packages index using db3 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm
no packages


what shall I do to fix it now? 

Thanks a lot!!

Helen
Comment 1 Jeff Johnson 2004-01-16 14:20:49 EST
Hmm, you've somehow managed to mix db-4.0.14 tools with
db-4.1.25 on disk format.

You can convert Packages from db-4.1.25 to db-4.0.14
by using db_dump (from db4-utils-4.1.25) piped into
db_load (from db4-utils-4.0.14). Here's how (adding explict
versions for clarify).
    cd /var/lib/rpm
    mv Packages Packages-ORIG
    db_dump-4.1.25 Packages-ORIG | db_dump-4.0.14 Packages

You'll have to figure which db_dump and db_load to use. The
file /usr/lib/rpm/rpmdb_load appears to be from db-4.0.14,
and /usr/bin/db_dump may very well be the version from 4.1.25,
verify by doing
    rpm -rf /usr/bin/db_dump
to see which version of db4-utils is installed.

Once Packages is converted, rpm --rebuilddb -vv will convert the
other indices.
Comment 2 Jeff Johnson 2004-01-16 14:21:36 EST
*** Bug 113712 has been marked as a duplicate of this bug. ***
Comment 3 helen wang 2004-01-16 17:08:33 EST
while using rpm-rf /usr/bin/db_dump, it gave message: rpm: arguments to --root (-r) must begin with a /
also in /usr/lib/rpm, no "db_dump" instead it has rpmdb_dump
compare these two files, the result is:

light# ls -al /usr/bin/db_dump
-r-xr-xr-x    1 root     root        10008 Feb  5  2003 /usr/bin/db_dump*
light# ls -al /usr/lib/rpm/rpmdb_dump
-rwxr-xr-x    1 rpm      rpm         11156 Feb 27  2003 /usr/lib/rpm/rpmdb_dump*

shall I use rpmdb_dump for version 4.1 and db_dump for version 4.0?

Comment 4 helen wang 2004-01-16 17:27:11 EST
By the way, the command you give me "db_dump-4.1.25 Packages-ORIG | db_dump-4.0.14 Packages"
should it be " db_dump Packages-ORIG |rpmdb_load Packages"?? if the version  is used correctly.
Thanks
Comment 5 helen wang 2004-01-16 17:34:14 EST

Thanks Jeff, I fixed it!!

Here si the command I am using:
/usr/lib/rpm/rpmdb_dump Packages-ORIG | /usr/bin/db_load Packages
and then 
rpm --rebuilddb -vv

now it is working fine. Thank you again!!
Comment 6 Jeff Johnson 2004-01-16 19:34:55 EST
Yes, db_load.

There's script /usr/lib/rpm/rrpmdb_loadcvt that does what you have
done if you need reference in future.

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