Bug 890695 - Mock fails with "ERROR: Namespace unshare failed."
Summary: Mock fails with "ERROR: Namespace unshare failed."
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-28 20:11 UTC by Steven Roberts
Modified: 2013-03-23 23:54 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-04 22:43:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
move CLONE_NEWUTS from base flags to extended flags (1.12 KB, patch)
2013-01-31 22:53 UTC, Clark Williams
no flags Details | Diff

Description Steven Roberts 2012-12-28 20:11:17 UTC
Description of problem:
It has been a while since I ran mock to test some fedora package builds.  I think It was August/September.  since then I have updated both the host OS (including kernel) as well as the software on the container (where mock is installed)

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

How reproducible:
always

Steps to Reproduce:
1. install a fedora pakcager dev environment under a openvz VM (aka linux container) 
2. try to run mock
  
Actual results:
DEBUG: Unsharing. Flags: 738328576                                 
DEBUG: unshare(738328576) failed, falling back to unshare(67239936)
DEBUG: Unsharing. Flags: 67239936                                  
ERROR: Namespace unshare failed.                                   

Expected results:
successful mock run

Additional info:
Unfortunately I don't know if it was the kernel update or mock that caused the issue.  I did a bunch of digging and didn't see anything in openvz bugzilla, RH bugzilla, mock and kernel release notes.  Not finding anything on the unshare flags and if I can tune them via a mock config value

Comment 1 Richard Marko 2013-01-17 12:22:07 UTC
Following change is required to run mock in OpenVZ:

sed -i 's/|mockbuild.util.CLONE_NEWUTS//g' /usr/sbin/mock

As it doesn't seem to be critical this flag can probably be moved to extended_unshare_flags.

Comment 2 Steven Roberts 2013-01-17 20:27:49 UTC
thank you very much.  that worked great as a workaround.

Been a while sicne I used actual sed, was before GNU added the -i flag.  was actually one of the big pushes for me to move to perl years ago for my admin editing (perl's -i flag)


FYI, If I move the flag to the extended_unshare_flags, it works as well.  a diff for that change:


--- /tmp/mock   2013-01-17 09:52:07.000000000 -0800
+++ /usr/sbin/mock      2013-01-17 11:47:59.000000000 -0800
@@ -760,8 +760,8 @@
     os.environ["HOME"] = chroot.homedir
 
     # New namespace starting from here
-    base_unshare_flags = mockbuild.util.CLONE_NEWNS|mockbuild.util.CLONE_NEWUTS
-    extended_unshare_flags = base_unshare_flags|mockbuild.util.CLONE_NEWPID|mockbuild.util.CLONE_NEWIPC
+    base_unshare_flags = mockbuild.util.CLONE_NEWNS
+    extended_unshare_flags = base_unshare_flags|mockbuild.util.CLONE_NEWPID|mockbuild.util.CLONE_NEWIPC|mockbuild.util.CLONE_NEWUTS
     try:
         mockbuild.util.unshare(extended_unshare_flags)
     except mockbuild.exception.UnshareFailed, e:

Comment 3 Clark Williams 2013-01-30 15:42:48 UTC
what kernel were you running on that failed with CLONE_NEWUTS?

Comment 4 Richard Marko 2013-01-30 17:03:17 UTC
2.6.32-042stab065.3 (openvz)

Comment 5 Clark Williams 2013-01-30 17:44:31 UTC
Well that's odd. CLONE_NEWUTS was added back in 2006, three years before 2.6.32 was released. Does your kernel not have CONFIG_UTS_NS turned on?

I can move CLONE_NEWUTS to the extended flags but it seems odd that your kernel doesn't have it turned on.

Comment 6 Steven Roberts 2013-01-30 19:19:45 UTC
OpenVZ: 2.6.32-042stab068.8

From reading the docs on CLONE_NEWUTS, it sounds like it is what a container itself would use and since I am already running mock inside of an openvz container would that still be legal to do?

Comment 7 Clark Williams 2013-01-31 22:53:00 UTC
Created attachment 691288 [details]
move CLONE_NEWUTS from base flags to extended flags

I've got this patch in my current tree but I haven't tried it on older kernels yet. Please verify that it fixes your issues and it will go into the next mock release.

Comment 8 Clark Williams 2013-01-31 22:55:10 UTC
(In reply to comment #6)
> OpenVZ: 2.6.32-042stab068.8
> 
> From reading the docs on CLONE_NEWUTS, it sounds like it is what a container
> itself would use and since I am already running mock inside of an openvz
> container would that still be legal to do?

Probably not. I think the patch I just posted will do the trick (It's essentially what Richard did in #c4).

Comment 9 Steven Roberts 2013-02-05 05:30:30 UTC
Yup, that looks the same as what I did in comment #2.

Comment 10 Fedora Update System 2013-02-26 22:16:46 UTC
mock-1.1.29-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/mock-1.1.29-1.fc17

Comment 11 Fedora Update System 2013-02-26 22:17:36 UTC
mock-1.1.29-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.29-1.el6

Comment 12 Fedora Update System 2013-02-26 22:18:06 UTC
mock-1.1.29-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/mock-1.1.29-1.fc18

Comment 13 Fedora Update System 2013-02-27 18:03:47 UTC
Package mock-1.1.29-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.29-1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2013-0476/mock-1.1.29-1.el6
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2013-03-04 22:43:39 UTC
mock-1.1.29-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2013-03-23 23:54:41 UTC
mock-1.1.29-1.fc17 has been pushed to the Fedora 17 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.