Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 161022 - rpmdb fails if run as su root
Summary: rpmdb fails if run as su root
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 4
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2005-06-19 22:41 UTC by Larry Weaver
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-06-21 18:12:12 UTC

Attachments (Terms of Use)
strace output on rpm -qa when executed as "su root" (deleted)
2005-06-21 16:48 UTC, Need Real Name
no flags Details

Description Larry Weaver 2005-06-19 22:41:56 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

Description of problem:
Immediately after installing FC4, I logged in as a user, did an sus to root,
and tried to execute rpm. Any rpm command would immediately fail as follows:
[root@localhost ns7]# rpm -qa
rpmdb: unable to initialize mutex: Function not implemented
error: cannot open Packages index using db3 - Function not implemented (38)
error: cannot open Packages database in /var/lib/rpm

I was able to execute unprivileged rpm commands as a user, and I was able
to use rpm normally when logged in as root, but not under su.

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

How reproducible:

Steps to Reproduce:
1.Log in as normal user to root
3.execute any rpm command

Actual Results:  rpmdb: unable to initialize mutex: Function not implemented
error: cannot open Packages index using db3 - Function not implemented (38)
error: cannot open Packages database in /var/lib/rpm

Expected Results:  In the case of "rpm -qa", all installed RPMs should have been listed.

Additional info:

Comment 1 Jeff Johnson 2005-06-19 22:58:46 UTC
DO you have NPTL enabled in your kernel and glibc? rpm expects shared posix mutexes.

Comment 2 Larry Weaver 2005-06-20 17:25:33 UTC
I have the default FC4 configuration. As noted, rpm works fine under a native
login, either as a user or as root, so the kernel and glibc must have the
necessary features. It only fails when I su to root.

Comment 3 Jeff Johnson 2005-06-20 17:31:45 UTC
Only root can create locks because /var/lib/rpm/__db* are usually RDONLY.

Change the permissions on /var/lib/rpm files temporarily to permit some
user access, and you should see the same problem.

Run an strac on the root command that is failing, and I should be
able to tell more precisely what is fubar. The fix is gonna be with glibc
and/or the kernel I'm almost positive however.

Comment 4 Need Real Name 2005-06-21 16:48:15 UTC
Created attachment 115762 [details]
strace output on rpm -qa when executed as "su root"

Comment 5 Need Real Name 2005-06-21 16:51:39 UTC
I had exactly the same problem.  Attached is the strace output.

How do I know if I am running an NPTL kernel/glibc?  I am using the default FC4

Comment 6 Jeff Johnson 2005-06-21 17:02:22 UTC
The strace is not showing a syscall, so I can't pin down details.

No matter what, the error message displayed is precise. You are trying
to run rpm+db4 which is compiled for an NPTL environment on a non-NPTL

Default FC4 has NPTL enabled. Something else is misconfigured on your system,
like installing "i386" rather than "i686" glibc (i.e. glibc.i386 is compiled w/o NPTL).

Comment 7 Need Real Name 2005-06-21 17:21:09 UTC
I did not have a chance to choose i686/i386 for glibc (or any other packages):
it was picked for me automatically by the installer.  In any case, my glibc
appears to be i686 (the glibc package installed some files under /lib/i686/).

I just discovered the problem.  In my startup files for my shell, I had


because there was some software that required this a long time ago (I have to
check if it still does).  Once I removed this everything works as expected.  My
clue was that I can get things to work when I used "su - root" instead of "su
root", which pointed me to look at the environment.

Comment 8 Jeff Johnson 2005-06-21 17:27:31 UTC

Comment 9 Larry Weaver 2005-06-21 18:12:12 UTC
That was my problem also. I am setting this to Resolved: NOTABUG.

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