Bug 161022

Summary: rpmdb fails if run as su root
Product: [Fedora] Fedora Reporter: Larry Weaver <lweaver>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED NOTABUG QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: cheng, n3npq
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-21 18:12:12 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:
Attachments:
Description Flags
strace output on rpm -qa when executed as "su root" none

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:
Always

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 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
configuration.

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
system.

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

  LD_ASSUME_KERNEL=2.4.1

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
Yep, LD_ASSUME_KERNEL explains -NPTL.

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