Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
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.
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.
(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 .
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:
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