Bug 80482

Summary: rpm-4.2-0.38 fails to open databases.
Product: [Retired] Red Hat Raw Hide Reporter: Ralph Loader <suckfish>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WORKSFORME QA Contact: Mike McLean <mikem>
Severity: high Docs Contact:
Priority: high    
Version: 1.0CC: corporal_pisang, reuben-redhatbugzilla, umar
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-28 00:34:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralph Loader 2002-12-27 01:50:57 UTC
Description of problem:

After upgrading to rpm-4.2-0.38, all rpm operations performed as root failed.


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

rpm-4.2-0.38

How reproducible:

Everytime.

Steps to Reproduce:

As root, do "rpm -q rpm".

Actual results:

[root@suckfish root]# rpm -q rpm
rpmdb: Berkeley DB library configured to support only DB_PRIVATE environments
error: db4 error(22) from dbenv->open: Invalid argument
error: cannot open Packages index using db3 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm
package rpm is not installed

Expected results:

rpm package & version should be displayed (rpm is installed!).

Additional Info:

Doing "rpm -q rpm" as non-root worked OK.  "rpm --rebuilddb" gave similar
"cannot open Packages" error.

Comment 1 Ralph Loader 2002-12-27 02:14:48 UTC
PS.  Downgrading (unpacking rpm by hand!) to rpm-4.2-0.25.1 seems to fix the
problem.


Comment 2 Jeff Johnson 2002-12-27 14:22:41 UTC
Yup. rpm is transiting to using nptl, and so behavior
is gonna depend on which kernel is booted, which glibc
is installed, and whether you are running as root or
non-root.

Hmmm, the behavior should have fallen back automagically.

What glibc and kernel were you running?

Comment 3 Ralph Loader 2002-12-27 17:46:01 UTC
I'm running kernel rpm 2.4.20-2.2 for i686 and glibc-2.3.1-21.

[root@suckfish root]# rpm -q kernel
kernel-2.4.20-2.2
[root@suckfish root]# uname -a
Linux suckfish 2.4.20-2.2 #1 Fri Dec 20 13:02:59 EST 2002 i686 i686 i386 GNU/Linux
[root@suckfish root]# rpm -q glibc
glibc-2.3.1-21
[root@suckfish root]#

Comment 4 Jeff Johnson 2002-12-27 19:54:21 UTC
Hmmm, this is working for me with
    kernel-smp-2.4.20-2.2 (i686, it may matter)
    glibc-2.3.1-21
    rpm-4.2-0.40 (don't remember a difference from -0.38)

So what happens if you do (as root)
    rm -f /var/lib/rpm/__db*
    rpm -qa

Comment 5 Sammy 2002-12-27 22:22:58 UTC
I had the same problem with the same kernel and glibc for rpm-4.2-0.36 and -0.38. 
Do we need to install a package which is not listed in requirements? 

Comment 6 Ralph Loader 2002-12-27 23:31:24 UTC
Still the same problem:

[root@suckfish rpms]# rm -f /var/lib/rpm/__db.00*
[root@suckfish rpms]# rpm -qa
rpmdb: Berkeley DB library configured to support only DB_PRIVATE environments
error: db4 error(22) from dbenv->open: Invalid argument
error: cannot open Packages index using db3 - Invalid argument (22)
error: cannot open Packages database in /var/lib/rpm
no packages

Comment 7 Jeff Johnson 2002-12-27 23:39:48 UTC
Hmmm, something is fishy here, but rpm's use of
nptl is very, very new.

Try adding the following line to /etc/rpm/macros:
    %__dbi_cdb create client private cdb mpool mp_mmapsize=16Mb mp_size=1Mb]

This is the default config from /usr/lib/rpm/macros with
the keyword "private" added.

Comment 8 Jeff Johnson 2002-12-27 23:49:34 UTC
Apologies, there's a typo from cut 'n paste
    %__dbi_cdb create private cdb mpool mp_mmapsize=16Mb mp_size=1Mb

Comment 9 Ralph Loader 2002-12-28 00:27:24 UTC
That's cured it!  Thanks.

[root@suckfish root]# cat /etc/rpm/macros
%__dbi_cdb create private cdb mpool mp_mmapsize=16Mb mp_size=1Mb
[root@suckfish root]# rpm -q rpm
rpm-4.2-0.38


Comment 10 Jeff Johnson 2002-12-28 00:34:26 UTC
Good, at least something "works" :-(

You probably want to pay close attention to kernel/glibc/rpm
updates from Raw Hide, as all this is changing quite fast,
transiting to NPTL and /dev/futex.

Comment 11 Reuben Farrelly 2002-12-28 01:42:22 UTC
Worked here too after the fix suggested by Jeff above.  I'm running latest 
glibc and rpm from rawhide but also 2.5 series kernels..

Comment 12 Need Real Name 2003-01-03 11:05:07 UTC
I had same problem - exact same symptomps. It began when installing RawHide just
before Xmas, including new rpm and glibc packages. I thought that installing a
full Phoebe might cure it. Phoebe install went flawlessly, but rpm still did not
work for root.

Note that I had no "/etc/rpm/macros" file, just macros.prelink, macros.solve and
macros.specspo

FWIW, there were no "/var/lib/rpm/__db.001" file.

Anyway, creating a "/etc/rpm/macros" file with the single line show in the
comments cured everything. In terms of the "WORKSFORME" status, at least here is
a message that it required the fix to work for me.

Comment 13 Corporal Pisang 2003-02-19 04:05:23 UTC
glibc-2.3.1-46
rpm-4.2-0.68
db4-4.0.14-20
kernel 2.5.62

the one line addition in macros made my rpm works.

before the one liner:

after deleting __db*

#rpm --rebuilddb
rpmdb: write: 0xbfffd510, 8192: Invalid argument
error: db4 error(22) from dbenv->open: Invalid argument
error: cannot open Packages index

#rpm --rebuilddb
rpmdb: unable to join the environment
error: db4 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index

after the line addition, rpm works again.

#rpm -Uvh kudzu* pciut*
warning: kudzu-0.99.96-1.i386.rpm: V3 DSA signature: NOKEY, key ID 897da07a
Preparing...                ########################################### [100%]
   1:pciutils-devel         ########################################### [ 25%]
   2:kudzu                  ########################################### [ 50%]
   3:kudzu-devel            ########################################### [ 75%]
   4:pciutils               ########################################### [100%]

thanks.