Bug 161022 - rpmdb fails if run as su root
rpmdb fails if run as su root
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2005-06-19 18:41 EDT by Larry Weaver
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-06-21 14:12:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
strace output on rpm -qa when executed as "su root" (62.13 KB, text/plain)
2005-06-21 12:48 EDT, Need Real Name
no flags Details

  None (edit)
Description Larry Weaver 2005-06-19 18:41:56 EDT
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
2.su 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 18:58:46 EDT
DO you have NPTL enabled in your kernel and glibc? rpm expects shared posix mutexes.
Comment 2 Larry Weaver 2005-06-20 13:25:33 EDT
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 13:31:45 EDT
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 12:48:15 EDT
Created attachment 115762 [details]
strace output on rpm -qa when executed as "su root"
Comment 5 Need Real Name 2005-06-21 12:51:39 EDT
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 13:02:22 EDT
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 13:21:09 EDT
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 13:27:31 EDT
Comment 9 Larry Weaver 2005-06-21 14:12:12 EDT
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.