Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1450516

Summary: Login shell with systemd-nspawn
Product: [Fedora] Fedora EPEL Reporter: Orion Poplawski <orion>
Component: mockAssignee: Miroslav Suchý <msuchy>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: epel7CC: dominik, jdisnard, jlebon, mebrown, msimacek, msuchy, praiskup, williams
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: mock-1.4.2-1.fc26 mock-1.4.2-1.fc25 mock-1.4.2-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-25 16:19:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Orion Poplawski 2017-05-12 21:05:43 UTC
Description of problem:

I have a custom build environment that has relied on installing an /etc/profile.d file to configure the environment for the build:

# Load compiler
config_opts['files']['/etc/profile.d/zz-nwra.sh'] = """
export MODULEPATH=/opt/modulefiles/Core:$MODULEPATH
module load intel
"""

However, with the new systemd-nspawn chroot (which I otherwise like and think is a good idea, so I'd like to use it) this fails because we no longer get a login shell.  It is possible to get one back?  Perhaps by still running:

bash --login -c 'rpmbuild...'

Not sure why this was dropped with nspawn.

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

Comment 1 Orion Poplawski 2017-05-12 21:15:42 UTC
FWIW, dropping bash --login came with:

commit e6017d3ef9f4590c533c63241b2cf28974315b66
Author: Miroslav Suchý <msuchy>
Date:   Mon Oct 6 10:46:35 2014 +0200

    run systemd-nspawn container as specific user [RHBZ# 1132762]

Comment 2 Miroslav Suchý 2017-05-15 14:21:25 UTC
Patch from Orion merged as 
* 826c9d6 (HEAD -> devel, origin/devel) Use bash --login with systemd-nspawn as well (rhbz #1450516)

Comment 3 Fedora Update System 2017-06-19 07:12:51 UTC
mock-1.4.2-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-21b345dd60

Comment 4 Fedora Update System 2017-06-19 07:13:50 UTC
mock-1.4.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-3d88d9f8b5

Comment 5 Fedora Update System 2017-06-19 07:14:45 UTC
mock-1.4.2-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-65be829503

Comment 6 Fedora Update System 2017-06-19 14:52:58 UTC
mock-1.4.2-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-2017-65be829503

Comment 7 Fedora Update System 2017-06-19 15:52:30 UTC
mock-1.4.2-1.fc25 has been pushed to the Fedora 25 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-2017-21b345dd60

Comment 8 Fedora Update System 2017-06-19 19:24:41 UTC
mock-1.4.2-1.fc26 has been pushed to the Fedora 26 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-2017-3d88d9f8b5

Comment 9 Fedora Update System 2017-06-25 16:19:52 UTC
mock-1.4.2-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2017-07-04 01:51:49 UTC
mock-1.4.2-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-07-06 05:19:24 UTC
mock-1.4.2-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.

Comment 12 Jonathan Lebon 2017-07-10 17:28:36 UTC
This seems to have caused a regression in the way the spec file is passed:

https://ci.centos.org/view/Atomic/job/fahc-rdgo/5563/consoleFull

Excerpt:

# /usr/bin/systemd-nspawn -q -M b3832f72993346d9b18be4eb6313d2c0 -D /var/lib/mock/fedora-26-x86_64-mockchain-22882/root --private-network --setenv=LANG=en_GB.UTF-8 --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOSTNAME=mock --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=HOME=/builddir --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PS1=<mock-chroot> \s-\v\$  -u mockbuild bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps --define __spec_check_template exit 0;  /builddir/build/SPECS/rpm-ostree.spec

...

16:40:00 error: failed to stat //exit: No such file or directory
16:40:00 Building target platforms: x86_64
16:40:00 Building for target x86_64
16:40:00 bash: /builddir/build/SPECS/rpm-ostree.spec: Permission denied

It looks like it needs another level of quoting to be passed correctly.

Comment 13 Jonathan Lebon 2017-07-10 17:45:40 UTC
Posted potential untested fix here: https://github.com/rpm-software-management/mock/pull/91