Bug 1110675

Summary: Running in chroot, ignoring request -- exit code 0
Product: Red Hat Enterprise Linux 7 Reporter: Jan Pazdziora <jpazdziora>
Component: systemdAssignee: Michal Sekletar <msekleta>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: danilo.aghemo, jpazdziora, lnykryn, msekleta, shigorin, systemd-maint-list
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-02 18:53:00 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 Jan Pazdziora 2014-06-18 08:52:45 UTC
Description of problem:

Related to bug 1080532 comment 7, we find that systemctl exit code is 0 when it also says Running in chroot, ignoring request, in anaconda / kickstart.

Looking at LSB section 20.2, the exit code in such situation probably should be

4	program or service status is unknown

not

0	program is running or service is OK

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

systemd-208-11.el7.x86_64

How reproducible:

Assume deterministic.

Steps to Reproduce:
1. In kickstart, run /bin/systemctl is-active chronyd.service
2. Check the exit status.

Actual results:

Message Running in chroot, ignoring request.
Exit status 0.

Expected results:

Message Running in chroot, ignoring request.
Exit status 4.

Additional info:

Comment 1 Michal Sekletar 2014-06-23 11:41:32 UTC
Seems reasonable. However I revisited the initial idea to return status code 4. systemctl shouldn't play any games here and just simply tell user sorry can't do what you have asked for, log sensible error message and return EXIT_FAILURE. I submitted following [0] patch upstream. Will be back-ported to rhel-7.1 if applied upstream.

[0] http://lists.freedesktop.org/archives/systemd-devel/2014-June/020411.html

Comment 2 Lennart Poettering 2014-06-23 14:37:49 UTC
Hmm, I am pretty sure I don't think this should be changed.

The idea is that inside of chroots the various systmctl start/stop/restart invocations become NOPs, so that package tools don't trip up on failing postinst scripts when installing packages like that. 

It is intended by design that these operations hence return success when running in a chroot(), and your suggested change would be diametrically against that.

Comment 3 Jan Pazdziora 2014-06-23 15:28:14 UTC
(In reply to Lennart Poettering from comment #2)
> 
> The idea is that inside of chroots the various systmctl start/stop/restart
> invocations become NOPs, so that package tools don't trip up on failing
> postinst scripts when installing packages like that. 

So in effect systemctl misguides the package tools and their postinst scripts about the state of the system, instead of giving them a chance to act accordingly when systemctl did not provide the information (or did not run the action) it was asked for.

Reopening for reconsideration.

Comment 4 Michal Sekletar 2014-07-02 18:53:00 UTC
(In reply to Jan Pazdziora from comment #3)
> (In reply to Lennart Poettering from comment #2)
> > 
> > The idea is that inside of chroots the various systmctl start/stop/restart
> > invocations become NOPs, so that package tools don't trip up on failing
> > postinst scripts when installing packages like that. 
> 
> So in effect systemctl misguides the package tools and their postinst
> scripts about the state of the system, instead of giving them a chance to
> act accordingly when systemctl did not provide the information (or did not
> run the action) it was asked for.
> 
> Reopening for reconsideration.

Sorry we will not change the current behaviour, because we think it'd bring more ill than good. If you decide to reopen *please* do send an email to either tech-list or even better fedora-devel, so packagers can express their opinion, because I think that discussed change would hurt them most.

Comment 5 Michael Shigorin 2014-12-01 13:07:43 UTC
Side note: in short, misguiding is considered "less ill".
I wonder if some kind of WHITE_IS_WHITE env var would get things straight.