Bug 141015 - rpm --root generates "error: can't create transaction lock" when run as non-root
rpm --root generates "error: can't create transaction lock" when run as non-root
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2004-11-27 23:56 EST by Dimi Paun
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-11-28 17:47:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dimi Paun 2004-11-27 23:56:27 EST
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
[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:

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

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

How reproducible:

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 17:47:16 EST
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 09:31:13 EST

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

Comment 3 ralphw 2005-07-01 21:26:09 EDT
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 -
:- 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
Comment 4 ralphw 2005-07-01 21:29:48 EDT
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

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