Bug 141015

Summary: rpm --root generates "error: can't create transaction lock" when run as non-root
Product: [Fedora] Fedora Reporter: Dimi Paun <dimi>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WONTFIX QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: nobody+pnasrat, ralphw
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-28 22:47:16 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 Dimi Paun 2004-11-28 04:56:27 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
There seems to be a bug in the rpm shipped with FC3.
Namely, when I run it as a regular user, with the 
--root option, I get the the:
    error: can't create transaction lock
But it works just fine as root:

[dimi@dimi ~]$ rpm --root /home/dimi/dev/kogaion/virtualroot --initdb
error: can't create transaction lock
[dimi@dimi ~]$ su
Password:
[root@dimi ~]# rpm --root /home/dimi/dev/kogaion/virtualroot --initdb

I quick google for the problem reveals that a very similar bug
has been fixed not long ago (in RPM version 4.3.1) for the
non-root 'rpm --test' case:
    https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=119783

It looks as if the --root case have been missed by that fixed.


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

How reproducible:
Always

Steps to Reproduce:
1. simply run "rpm --root /tmp/virtualroot --initdb" as non-root
    

Actual Results:  error: can't create transaction lock

Expected Results:  no error result, it should just work.

Additional info:

similar bug: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=119783

Comment 1 Jeff Johnson 2004-11-28 22:47:16 UTC
Running rpm --root as non-root user makes no sense, there
is a chroot(2) call that is root-only.

Comment 2 bogdan dalia 2005-02-23 14:31:13 UTC
hi,

i am using FC3 and I need to do "rpm --initdb" with a non-root user.
i get the following error: can't create transaction lock.
i tried to find a fix on google but i failed to find one.
as i mentioned before i'm using FC3 and i RPM 4.3.2 and i tried this
with RPM 4.3.3 also, the result was the same.

can you please help me...

thx

Comment 3 ralphw 2005-07-02 01:26:09 UTC
Hi, just confirming that this is a problem for me as well, but I found a 
workaround for those who are willing to sacrifice some security...
ralphw@rhessql5:~> rpm --dbpath `pwd`/rpm --initdb
error: can't create transaction lock
[omitted strace rpm --dbpath `pwd`/rpm --initdb 2>&1 |tail -100
that discovered permission denied on /var/lock/rpm/transaction]
ralphw@rhessql5:~> su -
Password:
:- chmod 0666 /var/lock/rpm/transaction
:- ls -l /var/lock/rpm/transaction
-rw-rw-rw-  1 root root 0 Jul  1 20:52 /var/lock/rpm/transaction
:- exit
ralphw@rhessql5:~> rpm --dbpath `pwd`/rpm --initdb
ralphw@rhessql5:~> rpm --dbpath `pwd`/rpm --prefix `pwd` --nodeps -i *.rpm
ralphw@rhessql5:~> 

Comment 4 ralphw 2005-07-02 01:29:48 UTC
Sorry, I forgot to specify that I am on a Red Hat Enterprise Server, uname -a:
Linux rhessql5.funk.com 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 
i686 i386 GNU/Linux