Hide Forgot
$ rpm -q mock mock-1.2.15-1.el7.noarch I was trying to build an updated glib for centos7, which needed an updated gtk-doc, and got a strange error in the chain (rpmdistro-gitoverlay) that /bin/python couldn't be resolved. I tracked this down to --new-chroot causing /bin to be earlier in $PATH: <walters> if i add an echo in %build I get: PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/builddir/.local/bin:/builddir/bin yet mock --shell echo $PATH has /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin as i'd expect $ mock --new-chroot -r epel-7-x86_64 /mnt/Nomad/gtk-doc-1.19-3.el7.src.rpm ... Requires: /bin/perl /bin/python /bin/sh /usr/bin/pkg-config perl(Cwd) ... $ mock --old-chroot -r epel-7-x86_64 /mnt/Nomad/gtk-doc-1.19-3.el7.src.rpm ... Requires: /bin/sh /usr/bin/perl /usr/bin/pkg-config /usr/bin/python perl(Cwd) perl(Getopt::Long) perl(bytes) perl(strict) ...
I am really mystified at what is munging the path that way...tentatively thinking it's something involving systemd-nspawn running through PAM in the new root? Really...we should just kill /bin and /sbin from $PATH.
Created attachment 1130420 [details] 0001-backend-Ensure-our-environment-is-set-for-rpmbuild-a.patch Anyways, this patch fixes it for me.
This comes from default config. See /etc/mock/site-defaults.cfg config_opts['environment']['PATH'] = '/usr/bin:/bin:/usr/sbin:/sbin' > Really...we should just kill /bin and /sbin from $PATH. Not possible because EL5 and EL6 still have it. > /bin/python couldn't be resolved. This is not because of $PATH because /bin/ is in $PATH after /usr/bin. I suspect that this is because some package either 1) requires /bin/python or 2) have in some script #!/bin/python so rpmbuild take it as automatic requires which is equivalent of 1) And epel7 (and fedoras) no longer provides /bin/* automatic provides generated from filelist (I recall some discussion about it on devel mailing list). To sum it up. This is likely packaging issue. If you really need to alter env, then you can use config to change it.
(In reply to Miroslav Suchý from comment #3) > This comes from default config. See /etc/mock/site-defaults.cfg > config_opts['environment']['PATH'] = '/usr/bin:/bin:/usr/sbin:/sbin' I did not change the mock config between the two runs. > > Really...we should just kill /bin and /sbin from $PATH. > > Not possible because EL5 and EL6 still have it. Sure, though we could conditionalize on distribution major likely. > > /bin/python couldn't be resolved. > > This is not because of $PATH because /bin/ is in $PATH after /usr/bin. Did you even read my patch? It *is* because of $PATH, I added an "echo PATH=$PATH" in gtk-doc's %build and saw it was wrong. Again, I think what's happening here is that for non-nspawn, we inherit the environment from doChroot(). But nspawn cleans the environment, so we need to inject it into our command. > 2) have in some script #!/bin/python so rpmbuild take it as automatic > requires which is equivalent of 1) Yes, and that happens because it's found first in $PATH when using nspawn. > To sum it up. This is likely packaging issue. No, this is using unmodified CentOS 7 packages. Just try it!
Ah, you are right. I tried to alter it and it is indeed not passed to nspawn container. However I do not think your approach is correct as it just fix rebuilds. If you use e.g. --shell then you do not have those variables defined. I think correct way is to alter util._prepare_nspawn_command() to get environment and pass it to systemd-nspawn as --set-env=KEY=VALUE.
It's definitely something in the PAM stack which is breaking $PATH: ``` $ sudo systemd-nspawn -D /var/lib/mock/epel-7-x86_64/root Spawning container root on /var/lib/mock/epel-7-x86_64/root. Press ^] three times within 1s to kill container. -bash-4.2# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -bash-4.2# su -l mockbuild Last login: Fri Feb 26 10:10:27 EST 2016 on console [mockbuild@root ~]$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/builddir/.local/bin:/builddir/bin [mockbuild@root ~]$ ```
Which means using --set-env for nspawn won't work, we need to do it after su. I'm not sure I have the stomach this morning to read the PAM code and figure out what's doing it, but even if we fixed PAM, we'd still need to support older distros...so we need to call `env` after `su` inside _prepare_nspawn_command(), agreed?
Fixed in commit: * 057c51d (HEAD -> devel, origin/devel) tell nspawn which variables it should set [RHBZ#1311796] I modified: config_opts['environment']['PATH'] = '/usr/bin:/usr/sbin' and put in my spec: %build echo PATH is: $PATH and run: $ mock -r epel-7-x86_64 --new-chroot /home/msuchy/rpmbuild/SRPMS/copr-ping-1-1.fc23.src.rpm .... Provádění(%build): /bin/sh -e /var/tmp/rpm-tmp.7kbQOk PATH is: /usr/bin:/usr/sbin Can you test if it pass your tests, please?
Ah, I see you changed more code to avoid shell strings. That is definitely better. I had a patch in progress for similar changes like -u mockbuild instead of su. Works for me.
I take that back, there's some other regression: With devel tip @ 057c51d6a0e47377a45f811ec7c0c013c4c31e00: $ mock -r fedora-23-i386 packaging/ostree-2016.2.9.g5345573-3.el7.src.rpm ... INFO: Installed packages: Start: build phase for ostree-2016.2.9.g5345573-3.el7.src.rpm Start: build setup for ostree-2016.2.9.g5345573-3.el7.src.rpm ERROR: Exception(packaging/ostree-2016.2.9.g5345573-3.el7.src.rpm) Config(fedora-23-i386) 0 minutes 56 seconds INFO: Results and/or logs in: /var/lib/mock/fedora-23-i386/result ERROR: Expected to find single rebuilt srpm, found 0. WARNING: unable to delete selinux filesystems (/tmp/mock-selinux-plugin.3xSybj): [Errno 1] Operation not permitted: '/tmp/mock-selinux-plugin.3xSybj' With the previous devel @ a9a957dbe23aa0c9ac1245897bf94ed70b78c951 it works.
(In reply to Colin Walters from comment #10) > WARNING: unable to delete selinux filesystems > (/tmp/mock-selinux-plugin.3xSybj): [Errno 1] Operation not permitted: > '/tmp/mock-selinux-plugin.3xSybj' > > With the previous devel @ a9a957dbe23aa0c9ac1245897bf94ed70b78c951 it works. That is bug 1312820
mock-1.2.16-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-66229b4649
mock-1.2.16-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3405d4e45b
mock-1.2.16-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a9958aa8eb
mock-1.2.16-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-bbb4bfc16f
mock-1.2.16-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-25ff2f1000
mock-1.2.16-1.fc22 has been pushed to the Fedora 22 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-66229b4649
mock-1.2.16-1.fc23 has been pushed to the Fedora 23 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-a9958aa8eb
mock-1.2.16-1.el6 has been pushed to the Fedora EPEL 6 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-EPEL-2016-25ff2f1000
mock-1.2.16-1.el7 has been pushed to the Fedora EPEL 7 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-EPEL-2016-3405d4e45b
mock-1.2.16-1.fc24 has been pushed to the Fedora 24 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-bbb4bfc16f
mock-1.2.17-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-bbb4bfc16f
mock-1.2.17-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-66229b4649
mock-1.2.17-1.fc24 has been pushed to the Fedora 24 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-bbb4bfc16f
mock-1.2.17-1.fc22 has been pushed to the Fedora 22 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-66229b4649
mock-1.2.17-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-23c93722c3
mock-1.2.17-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-d4770f601d
mock-1.2.17-1.el6 has been pushed to the Fedora EPEL 6 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-EPEL-2016-d4770f601d
mock-1.2.17-1.el7 has been pushed to the Fedora EPEL 7 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-EPEL-2016-23c93722c3
mock-1.2.17-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.2.17-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.2.17-1.fc23 has been pushed to the Fedora 23 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-a9958aa8eb
mock-1.2.17-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.2.17-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.2.17-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
*** Bug 1299494 has been marked as a duplicate of this bug. ***