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 1362461 - 'systemctl status' returns 0 for failed services
Summary: 'systemctl status' returns 0 for failed services
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.3
Hardware: All
OS: Unspecified
high
medium
Target Milestone: beta
: ---
Assignee: systemd-maint
QA Contact: Frantisek Sumsal
Lucie Vařáková
URL:
Whiteboard:
Depends On:
Blocks: 1362179
TreeView+ depends on / blocked
 
Reported: 2016-08-02 09:11 UTC by Stanislav Zidek
Modified: 2016-11-04 00:55 UTC (History)
4 users (show)

Fixed In Version: systemd-219-25.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 00:55:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2216 0 normal SHIPPED_LIVE systemd bug fix and enhancement update 2016-11-03 13:24:51 UTC

Description Stanislav Zidek 2016-08-02 09:11:49 UTC
Description of problem:
When I unsuccessfully start a service and then query for status, I start to get zero exit code in RHEL-7.3.

Version-Release number of selected component (if applicable):
systemd-219-24.el7

How reproducible:
always

Steps to Reproduce:
1. echo 'AuthenticationMethods bogusoption' >>/etc/ssh/sshd_config
2. systemctl restart sshd
3. systemctl status sshd
4. echo $?

Actual results:
...
# echo $?
0

Expected results:
...
# echo $?
3
(or something else non-zero)

Additional info:
* I set priority to high, because I can imagine this might break e.g. some monitoring scripts etc.
* Old version I was comparing to is systemd-219-19.el7

Comment 3 Lukáš Nykrýn 2016-08-02 13:52:25 UTC
This got broken with https://github.com/lnykryn/systemd-rhel/commit/41bb37959c96b8fddc13b37384b3453393517f4f

Upstream has the same problem:
https://github.com/systemd/systemd/issues/3864

Comment 5 Lukáš Nykrýn 2016-08-03 08:22:24 UTC
Lathough this bug sounds scary, the im pact is quite limited, this is only a problem for services, that have Restart=on-failure and big RestartSec. Those services are not in failed state, because systemd is trying to start them again.

Anyway, I have send a patch to upstream to consider such services as PROGRAM_NOT_RUNNING. https://github.com/systemd/systemd/pull/3874

Comment 6 Lukáš Nykrýn 2016-08-03 11:48:42 UTC
The second version of the patch still waits to be merged in upstream, but setting an optimistic devel_ack for that patch.

Comment 7 Lukáš Nykrýn 2016-08-04 08:38:29 UTC
pushed to staging ->
https://github.com/lnykryn/systemd-rhel/commit/94fec84897ab40bf2bc92f0d395a93ecac1b45be
-> post

Comment 9 Frantisek Sumsal 2016-08-16 11:53:56 UTC
Verified on RHEL 7.3 Beta with systemd-219-26.el7.

Old package:
# echo 'AuthenticationMethods garbage' >> /etc/ssh/sshd_config
# systemctl restart sshd
Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
# systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2016-08-16 07:50:09 EDT; 5s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 1297 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=255)
 Main PID: 907 (code=exited, status=0/SUCCESS)

Aug 16 07:50:09 qeos-178 systemd[1]: sshd.service: control process ex...5
Aug 16 07:50:09 qeos-178 systemd[1]: Failed to start OpenSSH server d....
Aug 16 07:50:09 qeos-178 systemd[1]: Unit sshd.service entered failed....
Aug 16 07:50:09 qeos-178 systemd[1]: sshd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
# echo $?
0

New package:
# echo 'AuthenticationMethods garbage' >> /etc/ssh/sshd_config
# systemctl restart sshd
Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
# systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2016-08-16 07:46:20 EDT; 10s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 4121 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=255)
 Main PID: 3829 (code=exited, status=0/SUCCESS)

Aug 16 07:46:20 qeos-176 systemd[1]: sshd.service: control process ex...5
Aug 16 07:46:20 qeos-176 systemd[1]: Failed to start OpenSSH server d....
Aug 16 07:46:20 qeos-176 systemd[1]: Unit sshd.service entered failed....
Aug 16 07:46:20 qeos-176 systemd[1]: sshd.service failed.
Aug 16 07:46:20 qeos-176 sshd[4121]: Unknown authentication method "g...t
Aug 16 07:46:20 qeos-176 sshd[4121]: /etc/ssh/sshd_config line 154: i....
Hint: Some lines were ellipsized, use -l to show in full.
# echo $?
3

Comment 11 errata-xmlrpc 2016-11-04 00:55:30 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, 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://rhn.redhat.com/errata/RHBA-2016-2216.html


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