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).
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.
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?
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?
Thanks. https://github.com/systemd/systemd/issues/733
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.
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.
Is there any reason /usr/sbin/mock can't live as /usr/libexec/mock/mock instead?
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.
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.
Is your user in the "mock" group? % groups … mock
Yes. I even logged out and back in to make sure.
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
Happens to me here - I upgraded from f22 which was unaffected.
Notes for myself. When moving the file, we can get rid of consolehelper too: http://fedoraproject.org/wiki/Features/UsermodeMigration
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.
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
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.