Bug 738052

Summary: mock 1.1.14 rpmdb unlink fails to work
Product: [Fedora] Fedora EPEL Reporter: Florian La Roche <florian.laroche>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: fabrice, fedora, mebrown, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mock-1.1.15-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-02 23:00:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Florian La Roche 2011-09-13 18:16:39 UTC
Description of problem:
seems like becomeUser() is already called before unlinking the rpmdb files:
INFO: Results and/or logs in: /var/lib/mock/dist-fedora-rawhide-build-7357-744/result
Traceback (most recent call last):
  File "/usr/sbin/mock", line 865, in <module>
    main(retParams)
  File "/usr/sbin/mock", line 801, in main
    do_rebuild(config_opts, chroot, args)
  File "<peak.util.decorators.rewrap wrapping __main__.do_rebuild at 0x027A2DE8>", line 3, in do_rebuild
  File "/usr/lib/python2.6/site-packages/mockbuild/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 465, in do_rebuild
    chroot.build(srpm, timeout=config_opts['rpmbuild_timeout'])
  File "<peak.util.decorators.rewrap wrapping mockbuild.backend.build at 0x0278FDE8>", line 3, in build
  File "/usr/lib/python2.6/site-packages/mockbuild/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/site-packages/mockbuild/backend.py", line 554, in build
    os.unlink(tmp)
OSError: [Errno 13] Permission denied: '/var/lib/mock/dist-fedora-rawhide-build-7357-744/root/var/lib/rpm/__db.004'



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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Clark Williams 2011-09-21 16:47:18 UTC
(In reply to comment #0)
> Description of problem:
> seems like becomeUser() is already called before unlinking the rpmdb files:

Florian,

I haven't seen the problem in my testing but that's probably just differences in host/environment. Please try the below and see if it fixes your issue.

diff --git a/py/mockbuild/backend.py b/py/mockbuild/backend.py
index 7186c7d..fffcf0c 100644
--- a/py/mockbuild/backend.py
+++ b/py/mockbuild/backend.py
@@ -535,6 +535,14 @@ class Root(object):
         try:
             self._setupDev()
             self._mountall()
+
+            # remove rpm db files to prevent version mismatch problems
+            # note: moved to do this before the user change below!
+            for tmp in glob.glob(self.makeChrootPath('var/lib/rpm/__db*')):
+                os.unlink(tmp)
+
+
+            # drop privs and become mock user
             self.uidManager.becomeUser(self.chrootuid, self.chrootgid)
             self.state("setup")
 
@@ -549,10 +557,6 @@ class Root(object):
                 gid=self.chrootgid,
                 )
 
-            # remove rpm db files to prevent version mismatch problems
-            for tmp in glob.glob(self.makeChrootPath('var/lib/rpm/__db*')):
-                os.unlink(tmp)
-
             # rebuild srpm/rpm from SPEC file
             specs = glob.glob(self.makeChrootPath(self.builddir, "SPECS", "*.sp
             if len(specs) < 1:

Comment 2 Fedora Update System 2011-09-23 20:55:16 UTC
mock-1.1.15-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.15-1.fc15

Comment 3 Fedora Update System 2011-09-23 20:56:17 UTC
mock-1.1.15-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.15-1.el6

Comment 4 Fedora Update System 2011-09-23 20:57:12 UTC
mock-1.0.22-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.22-1.el5

Comment 5 Fedora Update System 2011-09-23 20:58:03 UTC
mock-1.1.15-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.15-1.fc14

Comment 6 Fedora Update System 2011-09-24 21:59:30 UTC
Package mock-1.1.15-1.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.1.15-1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/mock-1.1.15-1.el6
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2011-10-02 22:59:48 UTC
mock-1.1.15-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2011-10-02 23:08:12 UTC
mock-1.1.15-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Florian La Roche 2011-10-04 13:02:42 UTC
1.1.15 works fine so far, no problems showing up

Thanks,

Florian La Roche

Comment 10 Fedora Update System 2011-10-16 18:27:48 UTC
mock-1.0.22-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.

Comment 11 Fedora Update System 2011-10-16 18:29:35 UTC
mock-1.1.15-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.