Koji builder creates mock configs on the fly and sends them to mock. These config have all caches disabled because the configs are used only once. And it makes problem in the selinux plugin which expects that the $yum_cache_dir/$buildroot directory exists and it wants to create the "filesystem" file there. Version-Release number of selected component (if applicable): mock-1.0.11-1.fc12.noarch and if I've seen correctly in the sources the same problem should be present also in the 1.1.x version the returned traceback when run manually with a koji prepared config file: [dan@eagle py]$ sudo ./mock.py --config /etc/mock -r koji/dist-f15-build-558-598 init INFO: mock.py version unreleased_version starting... State Changed: init plugins INFO: selinux enabled State Changed: start State Changed: lock buildroot State Changed: clean State Changed: init State Changed: lock buildroot Mock Version: unreleased_version INFO: Mock Version: unreleased_version _selinuxPreInitHook _selinuxPostBuildHook Traceback (most recent call last): File "./mock.py", line 736, in <module> main(retParams) File "./mock.py", line 604, in main chroot.init() File "<peak.util.decorators.rewrap wrapping mock.backend.init at 0x01901668>", line 3, in init File "/opt2/src/mock/py/mock/trace_decorator.py", line 70, in trace result = func(*args, **kw) File "/opt2/src/mock/py/mock/backend.py", line 195, in init self._callHooks('initfailed') File "<peak.util.decorators.rewrap wrapping mock.backend._callHooks at 0x018F70C8>", line 3, in _callHooks File "/opt2/src/mock/py/mock/trace_decorator.py", line 70, in trace result = func(*args, **kw) File "/opt2/src/mock/py/mock/backend.py", line 609, in _callHooks hook() File "<peak.util.decorators.rewrap wrapping selinux._selinuxPostBuildHook at 0x01967758>", line 3, in _selinuxPostBuildHook File "/opt2/src/mock/py/mock/trace_decorator.py", line 70, in trace result = func(*args, **kw) File "/opt2/src/mock/py/mock/plugins/selinux.py", line 69, in _selinuxPostBuildHook os.unlink(self.filesystems) OSError: [Errno 2] No such file or directory: '/var/lib/mock/cache/dist-f15-build-558-598/filesystems'
Does this patch fix the error? diff --git a/py/mock/plugins/selinux.py b/py/mock/plugins/selinux.py index fd4bf2e..2af41a5 100644 --- a/py/mock/plugins/selinux.py +++ b/py/mock/plugins/selinux.py @@ -35,6 +35,7 @@ class SELinux(object): self.rootObj = rootObj self.conf = conf + mock.util.mkdirIfAbsent(conf["cachedir"]) self.filesystems = os.path.join(conf["cachedir"], "filesystems") self.chrootFilesystems = rootObj.makeChrootPath("/proc/filesystems")
(In reply to comment #1) > Does this patch fix the error? > > diff --git a/py/mock/plugins/selinux.py b/py/mock/plugins/selinux.py > index fd4bf2e..2af41a5 100644 > --- a/py/mock/plugins/selinux.py > +++ b/py/mock/plugins/selinux.py > @@ -35,6 +35,7 @@ class SELinux(object): > self.rootObj = rootObj > self.conf = conf > > + mock.util.mkdirIfAbsent(conf["cachedir"]) > self.filesystems = os.path.join(conf["cachedir"], "filesystems") > self.chrootFilesystems = rootObj.makeChrootPath("/proc/filesystems") Thanks, it helps. The only downside I can see now is that it will create empty directories that won't be removed and another mechanism like tmpwatch will be needed. Although mock should be convinced to remove the "cachedir" when it has caching disabled.
Adding Jan to the CC Actually I think we should fix this in a different way. Rather than creating the fake /proc/filesystems file in the cache dir, I think we should create it in a tmpdir. It's just bind-mounted into the chroot and then deleted so there's no reason to save it. So I think we should rework the selinux plugin to ues the tempfile module, create a temp file, use that for the bind-mount, then remove the file when unloaded.
Created attachment 442411 [details] modification to the fake '/proc/filesystems' file generated by the selinux plugin I was thinking that we could change the selinux plugin to use tempfile rather than putting the data file in the cachedir (which might not be there)
Clark, you are right. Creating fake 'filesystems' in tmpdir instead of cachedir seems much more reasonable to me.
New build (mock-1.1.6) that does this and also sets appropriate permissions for the fake /proc/filesystems https://koji.fedoraproject.org/koji/buildinfo?buildID=200570
mock-1.1.6-1.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/mock-1.1.6-1.fc13
mock-1.1.6-1.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/mock-1.1.6-1.fc14
mock-1.0.13-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.13-1.el5
mock-1.0.13-1.fc12 has been submitted as an update for Fedora 12. https://admin.fedoraproject.org/updates/mock-1.0.13-1.fc12
mock-1.1.6-1.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update mock'. You can provide feedback for this update here: https://admin.fedoraproject.org/updates/mock-1.1.6-1.fc13
mock-1.1.6-1.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.1.6-1.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.0.14-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.14-1.el5
mock-1.0.15-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.15-1.el5
mock-1.1.9-1.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc13
mock-1.0.16-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.16-1.el5
mock-1.1.9-1.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/mock-1.1.9-1.el6
mock-1.1.9-1.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/mock-1.1.9-1.fc14
mock-1.1.9-1.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.1.9-1.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.1.10-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc15
mock-1.1.10-1.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc14
mock-1.0.17-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.17-1.el5
mock-1.1.10-1.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc13
mock-1.1.10-1.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6
mock-1.1.10-1.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.1.10-1.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.1.10-1.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.0.17-1.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.1.10-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.