Latest mock rpm from epel failing in 7.3 environment

Latest response

I just sunk some time into this and in the hope that it may help someone else with the issue I thought I would document it here.

The current version of mock from epel at time of writing is:

mock-1.4.2-1.el7.noarch.rpm 

There is a problem when building RPMs with this version of mock as it references an invalid option when creating a container from the chroot using systemd-nspawn. The error is as follows:

DEBUG util.py:450:  /usr/bin/systemd-nspawn: invalid option -- 'a'
DEBUG util.py:588:  Child return code was: 1
DEBUG util.py:197:  kill orphans

It appears that the -a option was added in systemd 229 with the following note from the release notes:

systemd-nspawn gained a new --as-pid2 switch that invokes any
          specified command line as PID 2 rather than PID 1 in the
          container. In this mode PID 1 is a minimal stub init process that
          implements the special POSIX and Linux semantics of PID 1 regarding
          signal and child process management. Note that this stub init process
          is implemented in nspawn itself and requires no support from the
          container image. This new logic is useful to support running
          arbitrary commands in the container, as normal processes are
          generally not prepared to run as PID 1.

The issue is that the systemd shipped in 7.3 is 219 and it doesn't look like this feature/capability has been backported.

Is anyone else using mock to build RPMs in 7.x? Has anyone else come up with this issue?

Responses

Thanks for the heads up. I did a test run and got an error with the systemd-nspawn command. In my case it was not using the 'a' option. I am now investigating why it failed.

Looking at the mock github repo there is already a fix in place

if (distro_label != 'centos') and (distro_label != 'rhel'):
    # EL7 does not support it (yet). See BZ 1417387
    nspawn_argv += ['-a']


There is also a Bugzilla requesting the backport of the '-a' feature (referenced above)
https://bugzilla.redhat.com/show_bug.cgi?id=1417387


Here I am hoping that they are going to rebase systemd again for 7.4.. but the beta doesn't look promising.

Following this up. The mock RPM actually ships with the above mentioned code (checking for centos / rhel).

The root cause in this instance was the build server in question was Oracle Linux 7. I have updated the original post to remove the 'RHEL' reference.. and the entire thread probably doesn't add much value on a Red Hat message board.

Looks like i'll have to go raise a bug to the mock project.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.