Bug 1246810 - Running 'mock' complains that I'm running /usr/sbin/mock
Summary: Running 'mock' complains that I'm running /usr/sbin/mock
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1270972 1271209 1271211
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-26 02:55 UTC by Ben Boeckel
Modified: 2016-10-22 04:01 UTC (History)
10 users (show)

Fixed In Version: mock-1.3.2-1.fc25
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-22 04:01:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ben Boeckel 2015-07-26 02:55:47 UTC
When running `mock`, I get this error:

% mock

ERROR: [Errno 1] Operation not permitted

ERROR: The most common cause for this error is trying to run /usr/sbin/mock as an unprivileged user.
ERROR: Check your path to make sure that /usr/bin/ is listed before /usr/sbin, or manually run /usr/bin/mock to see if that fixes this problem.

However, when starting with `systemd --user`, /usr/sbin is before /usr/bin (not sure really where it comes from).

Comment 1 Zbigniew Jędrzejewski-Szmek 2015-07-27 12:47:52 UTC
How are you running mock? If you are running it inside systemd service, than indeed $PATH will be set to have /sbin before /bin. You probably should refer to the one you want by full path: /bin/mock.

Comment 2 Ben Boeckel 2015-07-27 12:56:43 UTC
I'm running it from the shell from within tmux. The tmux server was started using a user-level service though. Should `systemd --user` switch around the order of things in `$PATH` to match typical user environments?

Comment 3 Zbigniew Jędrzejewski-Szmek 2015-07-27 13:07:45 UTC
Yes, that explains stuff. In hindsight, using a different $PATH for user services seems like a good idea, but there's also the issue of backwards compatiblity: current setting has been like for a long while in systemd and is also documented. This would require some upstream discussion. Could you file a bug at https://github.com/systemd/systemd/issues/ and describe your use case?

Comment 4 Ben Boeckel 2015-07-27 13:20:34 UTC
Thanks. https://github.com/systemd/systemd/issues/733

Comment 5 Miroslav Suchý 2015-07-27 13:53:53 UTC
Ok. Closing for now. I am afraid that there is nothing to do on Mock side. As mock either require to be run as user or have /usr/bin/ before /usr/sbin in $PATH.
Otherwise it will print error, which apparently does.

If you come to some conclusion with $PATH handling, that would require mock intervention, then feel free to reopen this report.

Comment 6 Ben Boeckel 2015-08-02 04:33:40 UTC
Lennart says that shadowing /usr/bin/mock with /usr/sbin/mock should be fixed:

> Having two binaries by the same name in bin and sbin sounds really sick, and should be fixed. I am not sure we want to support such a thing in the built-in defaults. Generally we give the more privileged, more basic tools precedence over the less privileged, more additional tools. This means "/sbin" gets precedence over "/bin" and "/usr/bin", if all of these exist.

Bug is here: https://github.com/systemd/systemd/issues/733

I've done a work-around for now with the user.conf setting, but this is going to surprise anyone moving over to a systemd --user session.

Comment 7 Ben Boeckel 2015-09-19 14:47:31 UTC
Is there any reason /usr/sbin/mock can't live as /usr/libexec/mock/mock instead?

Comment 8 Miroslav Suchý 2015-10-12 19:02:17 UTC
Hmm. Moving /usr/sbin/mock to /usr/libexec/mock/mock sounds good to me.
However we will need to assign correct file selinux context for this file first.

Comment 9 Erik Johnson 2015-11-04 17:56:57 UTC
I don't think this has anything to do with systemd, I get the same error even when running mock using the full path:

[builder@rpmbuild ~]$ /usr/bin/mock --root=epel-7-x86_64 --resultdir=/home/builder/mock --define "dist .el7"  /tmp/tmpGnTW29/SRPMS/python-msgpack-0.4.6-1.el5.src.rpm
INFO: mock.py version 1.2.13 starting (python version = 3.4.3)...
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
INFO: Start(/tmp/tmpGnTW29/SRPMS/python-msgpack-0.4.6-1.el5.src.rpm)  Config(epel-7-x86_64)
Start: clean chroot
Finish: clean chroot
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Mock Version: 1.2.13
INFO: Mock Version: 1.2.13
ERROR: Exception(/tmp/tmpGnTW29/SRPMS/python-msgpack-0.4.6-1.el5.src.rpm) Config(epel-7-x86_64) 0 minutes 0 seconds
INFO: Results and/or logs in: /home/builder/mock
INFO: Cleaning up build root ('cleanup_on_failure=True')
Start: clean chroot
Finish: clean chroot

ERROR: [Errno 1] Operation not permitted

ERROR: The most common cause for this error is trying to run /usr/sbin/mock as an unprivileged user.
ERROR: Check your path to make sure that /usr/bin/ is listed before /usr/sbin, or manually run /usr/bin/mock to see if that fixes this problem.

Comment 10 Ben Boeckel 2015-11-04 18:09:44 UTC
Is your user in the "mock" group?

% groups
… mock

Comment 11 Erik Johnson 2015-11-04 18:15:47 UTC
Yes. I even logged out and back in to make sure.

Comment 12 Jan Kurik 2016-02-24 13:28:26 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 13 Julian Sikorski 2016-07-11 20:36:47 UTC
Happens to me here - I upgraded from f22 which was unaffected.

Comment 14 Miroslav Suchý 2016-09-15 12:00:22 UTC
Notes for myself. When moving the file, we can get rid of consolehelper too:
http://fedoraproject.org/wiki/Features/UsermodeMigration

Comment 15 Miroslav Suchý 2016-09-27 14:20:58 UTC
Addressed by commit:
  * 1537582 move /usr/sbin/mock to /usr/libexec/mock/mock [RHBZ#1246810]

I did not done the usermode migration as part of this change as pkexec is not quite ready.

Comment 16 Fedora Update System 2016-10-19 08:29:57 UTC
mock-1.3.2-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-07f2f5e2c9

Comment 17 Fedora Update System 2016-10-22 04:01:21 UTC
mock-1.3.2-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


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