Bug 15382 - systemctl reload-or-try-restart reports failure for inactive service
Summary: systemctl reload-or-try-restart reports failure for inactive service
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Colin Guthrie
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-27 21:35 CET by David Walser
Modified: 2018-04-25 13:43 CEST (History)
1 user (show)

See Also:
Source RPM: systemd-217-8.mga5.src.rpm
CVE:
Status comment:


Attachments

Description David Walser 2015-02-27 21:35:33 CET
The filetrigger for packages that need to reload httpd runs systemctl reload-or-try-restart httpd.service, which looking at the man page should be the right thing to do.  We want it to reload the service if it's running, or do nothing if it's not.  The systemctl man page says:
       reload-or-try-restart PATTERN...
           Reload one or more units if they support it. If not, restart them
           instead. This does nothing if the units are not running. Note that,
           for compatibility with SysV init scripts, force-reload is
           equivalent to this command.

Yet, when these filetriggers run while httpd.service isn't running (or if you just run that systemctl command), it says:
Job for httpd.service failed. See "systemctl status httpd.service" and "journalctl -xe" for details.

and systemctl status shows:
Unit httpd.service cannot be reloaded because it is inactive.


It should not be printing that "failed" message.  As the man page states, in this case, it should literally do nothing.  Running reload-or-try-restart on an inactive service should not fail, should not be considered a failure, and should not print a failure message.

The fact that it does could make someone accidentally hyperventilate as they watch their urpmi --auto-select run :o)  It should save such a failure message for cases in which httpd.service *is* running, and the httpd -k graceful command that will then be run when it does reload the service exits with a non-zero exit status.  This would generally indicate some kind of actual failure which would need to be attended to.

Reproducible: 

Steps to Reproduce:
Samuel Verschelde 2015-06-02 20:31:11 CEST

Whiteboard: (none) => MGA5TOO

Comment 1 Colin Guthrie 2015-07-23 17:02:37 CEST
Yup, the message is a bit different now I think, but the principle is the same:

[root@jimmy ~]# systemctl reload-or-try-restart httpd
Job for httpd.service invalid.


But:
[root@jimmy ~]# systemctl try-restart httpd
[root@jimmy ~]# 

For now I've opened:

https://github.com/systemd/systemd/issues/688

See Also: (none) => https://github.com/systemd/systemd/issues/688

Comment 2 David Walser 2016-08-09 23:34:31 CEST
Upstream fix:
https://github.com/systemd/systemd/commit/3282591dc30b2934a895c7403d2f0b0690260947

Version: Cauldron => 5
Whiteboard: MGA5TOO => (none)

Comment 3 Marja Van Waes 2018-04-25 13:43:18 CEST
I understand this issue isn't valid for Mageia 6 & cauldron since at least August last year.

We regret if this issue didn't get fixed in Mga5

Closing as OLD, because Mageia 5 has officially reached its End of Life on December 31st, 2017 https://blog.mageia.org/en/2017/11/07/mageia-5-eol-postponed/
It only continued to get important security updates since then, but non-security bugs have no chance of still getting fixed.

Status: NEW => RESOLVED
Resolution: (none) => OLD
CC: (none) => marja11


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