[Pkg-sysvinit-devel] Bug#826214: SysV init scripts using init-d-script are not properly redirected to systemctl
Martin Pitt
mpitt at debian.org
Fri Jun 3 23:07:37 UTC 2016
Hello Michael,
Michael Biebl [2016-06-03 13:22 +0200]:
> As you can see, the start request is not redirected to systemctl, so the
> systemd integration is broken.
>
> I suspect this happens because init-functions is sourced before $1 is
> shifted, so the systemd lsb init hook get's the wrong parameters.
Correct:
+ set /etc/init.d/apache-htcacheclean start
[...]
+ prog=apache-htcacheclean
+ service=apache-htcacheclean.service
Thus $0 is okay (from the "set" in init-t-script)
+ systemctl -p CanReload show apache-htcacheclean.service
+ [ CanReload=no = CanReload=no ]
+ [ /etc/init.d/apache-htcacheclean = reload ]
This corresponds to [ "${1:-}" = "reload" ], thus this check is
broken. Apparenlty the "set" (first traced line) doesn't assign
"$start" to $1, but to $2, and the script name to $1 as well.
This then finally fails when init-functions.d/40-systemd tries to act
on the action $1:
+ [ x/etc/init.d/apache-htcacheclean = xstart -o x/etc/init.d/apache-htcacheclean = xstop -o x/etc/init.d/apache-htcacheclean = xrestart -o x/etc/init.d/apache-htcacheclean = xreload -o x/etc/init.d/apache-htcacheclean = xforce-reload -o x/etc/init.d/apache-htcacheclean = xstatus ]
I tried to add something like
if [ "$0" = "$1" ]; then shift; fi
above the sourcing of /lib/lsb/init-functions and adjust the
scriptname= assignment; that works when calling it as an init script
then, but the systemd redirection is then broken. Also, this wouldn't
do anything to fix #826215, so changing only init-d-script by itself
wouldn't be a complete solution anyway.
Thanks,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
More information about the Pkg-sysvinit-devel
mailing list