Bug 436270 - mock-0.9.7 does not allow usage as user
mock-0.9.7 does not allow usage as user
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
7
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-06 04:39 EST by manuel wolfshant
Modified: 2013-01-09 20:48 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-06 13:28:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description manuel wolfshant 2008-03-06 04:39:48 EST
Description of problem:


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

How reproducible:
always

Steps to Reproduce:
1. try to use mock to build any src.rpm, for instance

 mock /tmp/extremetuxracer-0.4-0.fc8.src.rpm

Actual results:

ERROR: [Errno 1] Operation not permitted
Traceback (most recent call last):
  File "/usr/sbin/mock", line 630, in <module>
    main(retParams)
  File "/usr/sbin/mock", line 412, in main
    uidManager._becomeUser(unprivUid, unprivGid)
  File "<peak.util.decorators.rewrap wrapping mock.uid._becomeUser at
0x008F3500>", line 3, in _becomeUser
    def _becomeUser(self, uid, gid): return __decorated(self, uid, gid)
  File "/usr/lib/python2.5/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.5/site-packages/mock/uid.py", line 65, in _becomeUser
    self._elevatePrivs()
  File "<peak.util.decorators.rewrap wrapping mock.uid._elevatePrivs at
0x008F0F50>", line 3, in _elevatePrivs
    def _elevatePrivs(self): return __decorated(self)
  File "/usr/lib/python2.5/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.5/site-packages/mock/uid.py", line 60, in _elevatePrivs
    setresuid(0, 0, 0)
  File "/usr/lib/python2.5/site-packages/mock/uid.py", line 91, in setresuid
    raise OSError(_errno.value, os.strerror(_errno.value))
OSError: [Errno 1] Operation not permitted

Expected results:
INFO: mock.py version 0.9.7 starting...
State Changed: init plugins
State Changed: start
INFO: Start(/tmp/extremetuxracer-0.4-0.fc8.src.rpm)  Config(fedora-development-i386)
State Changed: lock buildroot
State Changed: clean
State Changed: init
[....]


Additional info:
I am using a fully updated FC-7 ( I can provide a rpm -qa if needed) on an x86_64.
I can only use mock if I switch to root. If I try running it via sudo I get:
[wolfy@wolfy tmp]$ sudo  mock -r fedora-devel-i386
/tmp/extremetuxracer-0.4-0.fc8.src.rpm
INFO: mock.py version 0.9.7 starting...
State Changed: init plugins
State Changed: start
INFO: Start(/tmp/extremetuxracer-0.4-0.fc8.src.rpm)  Config(fedora-development-i386)
State Changed: lock buildroot
State Changed: clean
State Changed: init
ERROR: Could not create dir /var/lib/mock//fedora-development-i386/result.
Error: [Errno 13] Permission denied: '/var/lib/mock//fedora-development-i386/result'
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/mock/util.py", line 61, in mkdirIfAbsent
    os.makedirs(dirName)
  File "/usr/lib64/python2.5/os.py", line 166, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied:
'/var/lib/mock//fedora-development-i386/result'
ERROR: Exception(/tmp/extremetuxracer-0.4-0.fc8.src.rpm)
Config(fedora-development-i386) 0 minutes 0 seconds
INFO: Results and/or logs in: /var/lib/mock//fedora-development-i386/result
ERROR: Could not create dir /var/lib/mock//fedora-development-i386/result.
Error: [Errno 13] Permission denied: '/var/lib/mock//fedora-development-i386/result'

2. I've also tried adding myself to the wheel group and uncommenting the
relevant lines in pam.d/mock but there was no difference at all.

[wolfy@wolfy tmp]$ rpm -qi mock
Name        : mock                         Relocations: (not relocatable)
Version     : 0.9.7                             Vendor: Fedora Project
Release     : 1.fc7                         Build Date: Sat 02 Feb 2008 02:14:01
AM EET
Install Date: Wed 05 Mar 2008 07:13:54 PM EET      Build Host:
ppc3.fedora.redhat.com
Group       : Development/Tools             Source RPM: mock-0.9.7-1.fc7.src.rpm
Size        : 351270                           License: GPLv2+
Signature   : DSA/SHA1, Thu 28 Feb 2008 07:15:48 PM EET, Key ID b44269d04f2a6fd2

[wolfy@wolfy tmp]$ rpm -qV mock
SM5....T c /etc/mock/fedora-4-i386-epel.cfg
SM5....T c /etc/mock/fedora-4-ppc-epel.cfg
SM5....T c /etc/mock/fedora-4-x86_64-epel.cfg
S.5..U.T c /etc/mock/fedora-7-i386.cfg
S.5..U.T c /etc/mock/fedora-7-x86_64.cfg
S.5....T c /etc/mock/fedora-8-i386.cfg
S.5....T c /etc/mock/fedora-8-x86_64.cfg
S.5..U.T c /etc/mock/fedora-devel-i386.cfg
S.5..U.T c /etc/mock/fedora-devel-x86_64.cfg

[wolfy@wolfy tmp]$  /etc/init.d/ConsoleKit status
console-kit-daemon (pid 2294) is running...

[wolfy@wolfy tmp]$ id wolfy
uid=500(wolfy) gid=500(wolfy) groups=500(wolfy),10(wheel)
context=user_u:system_r:unconfined_t

[wolfy@wolfy tmp]$ sudo tail -2 /etc/sudoers
wolfy   ALL=(ALL) NOPASSWD: ALL

[wolfy@wolfy tmp]$ ll /usr/sbin/mock
-rwxr-xr-x 1 root root 26449 2008-02-02 02:13 /usr/sbin/mock
[wolfy@wolfy tmp]$ ll /usr/bin/mock
lrwxrwxrwx 1 root root 13 2008-03-05 19:13 /usr/bin/mock -> consolehelper

[wolfy@wolfy tmp]$ cat /etc/pam.d/mock
#%PAM-1.0
auth            sufficient      pam_rootok.so
auth            sufficient      pam_succeed_if.so user ingroup mock use_uid quiet
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth           required        pam_wheel.so use_uid
auth            include         system-auth
account         sufficient      pam_succeed_if.so user ingroup mock use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         optional        pam_xauth.so

[wolfy@wolfy tmp]$ cat /etc/security/console.apps/mock
USER=root
PROGRAM=/usr/sbin/mock
SESSION=false
FALLBACK=false
Comment 1 manuel wolfshant 2008-03-06 08:45:34 EST
Note: the first attempts were performed while being in the group "mock" and the
results were absolutely identical.  "id wolfy" above was run a bit later, after
switching to group "wheel". See also 
https://www.redhat.com/archives/fedora-devel-list/2008-March/msg00194.html
Comment 2 Michael E Brown 2008-03-06 11:36:55 EST
Interesting. Works ok on my F7 box.

You probably have a path problem. Try running /usr/bin/mock explicitly. Do you
have /usr/sbin on your path earlier than /usr/bin/?
Comment 3 manuel wolfshant 2008-03-06 13:28:18 EST
Thank Michael, that seemed to be the problem. replacing the order of /usr/sbin
and user/bin fixed the problem.

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