Bug 725942

Summary: rcapache2 graceful not working with systemd
Product: [openSUSE] openSUSE 12.1 Reporter: Christoph Obexer <cobexer>
Component: Release NotesAssignee: Ruediger Oertel <ro>
Status: RESOLVED FIXED QA Contact: Stephan Kulow <coolo>
Severity: Critical    
Priority: P5 - None CC: fcrozat, ke, per, ro, werner
Version: Beta 1Flags: coolo: SHIP_STOPPER+
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patch to not redirect non-standard command to systemd

Description Christoph Obexer 2011-10-22 08:27:46 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

systemd makes custom operations of init scripts impossible to use:
------------------------------
christoph-game:~ # rcapache2 
Usage: /usr/sbin/rcapache2 <command> <server flags>

where <command> is one of:
        start              - start httpd
        startssl           - start httpd with -DSSL
        stop               - stop httpd (sending SIGTERM to parent)
        try-restart        - stop httpd and if this succeeds (i.e. if
                             it was running before), start it again.

        status             - check whether httpd is running

        restart            - stop httpd if running; start httpd
        restart-graceful   - stop httpd gracefully if running; start httpd
        reload|graceful    - do a graceful restart by sending a SIGUSR1, or 
                             start if not running
        stop-graceful      - stop httpd (sending SIGWINCH to parent)

        configtest         - do a configuration syntax test
        extreme-configtest - try to run httpd as nobody (detects more errors 
                             by actually loading the configuration, but cannot 
                             read SSL certificates)
        probe              - probe for the necessity of a reload, give 
                             out the argument which is required for a reload.
                             (by comparing conf files with pidfile timestamp)

        full-server-status - dump a full status screen; requires lynx or w3m 
                             and mod_status enabled
        server-status      - dump a short status screen; requires lynx or w3m
                             and mod_status enabled

        help               - this screen

optional server flags are passed through to httpd.
------------------------------------------------------
most of them fail as systemd does not know them, i suppose <server flags> would not reach the apache init script either but haven't tested that.

Reproducible: Always

Steps to Reproduce:
1. run rcapache2 graceful
2.
3.
Actual Results:  
Unknown operation graceful

Expected Results:  
christoph-game:~ # /tmp/fu-systemd/apache2 graceful
Reload httpd2 (graceful restart)               done

making a symlink in /tmp as per my above sample does provide access to functionality unknown by systemd.
systemd must pass any unknown operations down to the original init script + any unknown parameters
Comment 1 Frederic Crozat 2011-10-24 08:20:26 UTC
Unfortunately, systemctl only supports "standard" parameters (see http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities )

you can bypass this by using :
cd /etc/init.d/
./rcapache2 <your_command>
Comment 2 Christoph Obexer 2011-10-25 18:27:23 UTC
still a few points:
 * the help output tells me something that is not true
   (in the example /usr/sbin/rcapache2 does _not_ accept the arguments given)
 * not sure i understand systemd right but:
    systemd would work without the /etc/init.d things entirely right?
    so the hack that makes it work with all the legacy things that like
    scripts to start/stop services in /etc/init.d/* does not pass parameters
    it (the _hack_) does not understand?
    the hack currently checks $0, add checks for the command too and all will be fine,
    and the help command of every service should also include a note about what systemd hacked into the invocation of the init script so that people that try to figure out why something does not work have a chance to succeed.
Comment 3 Frederic Crozat 2011-10-26 07:52:17 UTC
rc* scripts are SUSE specific and are just symlink to initscripts..

redirection of initscripts (either called by /etc/init.d/* or rc*) through systemd is needed so service are properly managed by systemd.

I'm not sure to understand what you are suggesting.
Comment 4 Christoph Obexer 2011-10-26 16:15:17 UTC
> rc* scripts are SUSE specific and are just symlink to initscripts..
yes i know

> redirection of initscripts (either called by /etc/init.d/* or rc*) through
> systemd is needed so service are properly managed by systemd.
hmm i player around a little and i see your problem now if the command restarts apache then systemd thinks its dead,...

> I'm not sure to understand what you are suggesting.
every command unknown to systemd should be passed to the init script in the same way
"cd /etc/init.d; ./apache2 configtest" is handled; at least for 12.1.
probably with a big fat warning that what the user is trying to do might cause problems
and probably with a link to a wiki article or other documentation describing the problems.

the problems with virtualbox and vmware(IIRC) are two examples of why this is important. given we know these problems exist ignoring them now is bad for openSuSE as a whole

HTH
Comment 5 Frederic Crozat 2011-10-26 16:27:11 UTC
I need to document this to release notes, indeed.
Comment 6 Karl Eichwalder 2011-10-27 06:44:46 UTC
One of you, please to provide a draft for the release notes.
Comment 7 Per Jessen 2011-10-27 07:47:07 UTC
I could be misreading this, but does this mean that the expected sysvinit compatibility doesn't exist after all? 
(http://lists.opensuse.org/archive/opensuse-factory/2010-11/msg00552.html)
Comment 8 Frederic Crozat 2011-10-27 07:59:14 UTC
check comment 1
Comment 9 Stephan Kulow 2011-10-27 08:00:36 UTC
Can't we change the redirection, so it's only called for standard arguments?
Comment 10 Frederic Crozat 2011-10-27 08:12:34 UTC
I guess we could.. patch welcome from bash experts. File to patch : /etc/rc.status (in aaa_base).

Standard commands :
start
stop
reload
restart
try-restart
force-reload
status

carefull with status, because it might not output the same as sysv.

I really hope "non standard" commands will not restart services, otherwise, it will create issue with systemd.
Comment 11 Frederic Crozat 2011-10-27 13:21:17 UTC
Created attachment 459150 [details]
patch to not redirect non-standard command to systemd

please test this patch, it should not redirect non standard commands, when used through rc*
Comment 12 Frederic Crozat 2011-10-27 13:21:48 UTC
adding werner, since he is aaa_base maintainer
Comment 13 Dr. Werner Fink 2011-10-27 13:31:05 UTC
> maintainer aaa_base
bugowner of Base:System/aaa_base -- ro@suse.com
Comment 14 Frederic Crozat 2011-10-27 14:54:27 UTC
*** Bug 721980 has been marked as a duplicate of this bug. ***
Comment 15 Karl Eichwalder 2011-10-27 14:56:02 UTC
Here is my propsal; please review:

<title>systemd: Supplying Service Start-up Parameters</title>
<para>
<command>systemctl</command> only supports "standard" parameters (see
<ulink
url="http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities"/>).
</para>
<para>
You can bypass this limitation by calling the start-up script directly, for
example:
</para>
<screen>
cd /etc/init.d
./apache2 &lt;your_parameters>
</screen>
Comment 16 Frederic Crozat 2011-10-27 15:03:36 UTC
sounds good; although it might be less needed if we apply the patch to aaa_base. But it is still a good idea to document this "new" behaviour.
Comment 17 Stephan Kulow 2011-10-27 17:42:21 UTC
Rudi, please review the patch
Comment 18 Ruediger Oertel 2011-10-27 22:17:42 UTC
request 89594 for factory
patch looks fine for me.
Comment 19 Karl Eichwalder 2011-10-28 06:39:51 UTC
This is now in the RN (if you do not need it or want it differently, please re-open):

  <sect3 id="sec.121.systemd-ctl">
   <title>systemd: Supplying Service Start-up Parameters</title>
   <para>
    <command>systemctl</command> only supports "standard" parameters
    (see <ulink
    url="http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities"/>).
   </para>
   <para>
    You can bypass this new behavior by calling the start-up script
    directly, for example:
   </para>
   <screen>cd /etc/init.d
./apache2 &lt;your_parameters>
</screen>
  </sect3>
Comment 20 Frederic Crozat 2011-11-02 16:25:46 UTC
Karl, could you add to the releases notes :

you can bypass this new behavior by calling the startup script directly, for example :
cd /etc/init.d
./apache2

or by enabling environment variable SYSTEMD_NO_WRAP :
SYSTEMD_NO_WRAP=1 /etc/init.d/apache2