RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1940078 - systemd considers a starting service of Type=oneshot being cancelled as Failing
Summary: systemd considers a starting service of Type=oneshot being cancelled as Failing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-17 14:48 UTC by Renaud Métrich
Modified: 2021-11-10 09:56 UTC (History)
3 users (show)

Fixed In Version: systemd-239-48.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:56:28 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github systemd-rhel rhel-8 pull 164 0 None open man: document differences in clean exit status for Type=oneshot 2021-04-01 07:16:20 UTC
Github systemd systemd pull 19054 0 None closed man: document differences in clean exit status for Type=oneshot 2021-03-23 09:29:31 UTC
Red Hat Product Errata RHBA-2021:4469 0 None None None 2021-11-09 19:56:56 UTC

Description Renaud Métrich 2021-03-17 14:48:17 UTC
Description of problem:

A customer uses a one-shot service to isolate to a given target.
Due to the service not being "wanted by" the given target, systemd cancels the service while it's starting, which then reports a failure, as shown in the example below:

/etc/systemd/system/foo.service:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl isolate multi-user.target
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

# systemctl start foo
Job for foo.service canceled.

Journal:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Mar 17 15:38:56 vm-rhel8 systemd[1]: Starting foo.service...
Mar 17 15:38:56 vm-rhel8 systemd[1]: foo.service: Main process exited, code=killed, status=15/TERM
Mar 17 15:38:56 vm-rhel8 systemd[1]: foo.service: Failed with result 'signal'.
Mar 17 15:38:56 vm-rhel8 systemd[1]: Stopped foo.service.
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


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

systemd-239-41.el8_3.1.x86_64

How reproducible:

Always, see above.

Additional info:

I think that because the service startup is cancelled, the service shouldn't enter Failed state.

Comment 1 Renaud Métrich 2021-03-17 14:59:56 UTC
For some reason, adding the following stanza helps:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
SuccessExitStatus=SIGTERM
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This looks weird to me since SIGTERM is already a normal exit condition, unless the code handling the Starting state is different and has a bug here.

Comment 2 David Tardon 2021-03-19 08:07:52 UTC
(In reply to Renaud Métrich from comment #1)
> For some reason, adding the following stanza helps:
> -------- 8< ---------------- 8< ---------------- 8< ---------------- 8<
> --------
> SuccessExitStatus=SIGTERM
> -------- 8< ---------------- 8< ---------------- 8< ---------------- 8<
> --------
> 
> This looks weird to me since SIGTERM is already a normal exit condition,
> unless the code handling the Starting state is different and has a bug here.

SIGTERM is not a normal exit condition for oneshot services since https://github.com/systemd/systemd/commit/1f0958f640b87175cd547c1e69084cfe54a22e9d .

Comment 3 Renaud Métrich 2021-03-19 08:28:10 UTC
Sounds legit indeed, hence the manpage needs to be updated.
Current systemd.service(5) manpage on RHEL8.3:

       SuccessExitStatus=
           Takes a list of exit status definitions that, when returned by the main service process, will be
           considered successful termination, in addition to the normal successful exit code 0 and the signals
           SIGHUP, SIGINT, SIGTERM, and SIGPIPE. Exit status definitions can either be numeric exit codes or
           termination signal names, separated by spaces. For example:

Comment 5 Lukáš Nykrýn 2021-06-22 12:31:04 UTC
fix merged to github master branch -> https://github.com/redhat-plumbers/systemd-rhel8/pull/164

Comment 11 errata-xmlrpc 2021-11-09 19:56:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4469


Note You need to log in before you can comment on or make changes to this bug.