[Pkg-sysvinit-devel] Bug #826214: Bug #826215: init-d-script and systemd: solution

Christian Seiler christian at iwakd.de
Thu Dec 29 16:35:08 UTC 2016


On 12/29/2016 01:59 PM, Petter Reinholdtsen wrote:
> [Martin Pitt]
>> "service", not invoke-rc.d, but I do agree that it would be better to
>> completely drop that magic. This would be a nice way to gradually teach people
>> about the init system neutral APIs, and also find/fix places which hardcode
>> calling /etc/init.d/.
> 
> Will service respect policy-rc.d?

No, by definition it won't (neither on sysvinit nor on systemd) - just like
/etc/init.d/foo start also does not respect policy-rc.d.

service is a tool for admins, and as such shouldn't be governed by
policy-rc.d. invoke-rc.d is a tool for maintainer scripts and as such
will be governed by policy-rc.d.

invoke-rc.d is basically the following logic (pseudo-shell):

if action is allowed for script by policy-rc.d ; then
  if [ -d /run/systemd/system ] ; then
    systemctl action scriptname.service
  elif ... upstart ... ; then
    ...
  else
    /etc/init.d/scriptname action
  fi
fi

service is basically the following logic (pseudo-shell):

if [ -d /run/systemd/system ] ; then
  systemctl action scriptname.service
elif ... upstart ...
  ...
else
  in_relatively_clean_context /etc/init.d/scriptname action
fi

> I believe I saw some systemd service
> failing to respect policy-rc.d in one of my chroots, and wonder if it
> was a bug in some package or not

In that case it's very likely a bug in the package's maintainer
script.

> For the record, I believe the /etc/init.d/ scripts should keep working
> also in the future, because I believe most of the around 1000 packages
> with init.d scripts in Debian do not need to have their scripts replaced
> and it is an advantage to have one common script across all the kernels
> Debian supports.

I don't think this is in question for now - but there are multiple layers
here:

 - what to do when only an init script is available and the service is
   to be started (e.g. at boot)

     => systemd will call the init script (and that will stay for a
        long time, even systemd upstream is not going to remove
        support for this anytime soon)

 - what to do when /etc/init.d/script action is called on the command
   line (instead of service script action or invoke-rc.d script action)

     => at the moment systemd installs some glue code to redirect this
        to systemctl, but that fails at the moment for init-d-script
        (this is #826214)

> It thus make me happy to see someone have time to work on improving the
> init-d-script approach. :

Pure egoism ;-) I really don't want to maintain boilerplate code in
my packages, so I like the idea behind init-d-script a lot, because it
makes it very easy for me to provide init scripts in additino to
systemd services (that nowadays are often provided by upstream).

Anyway, patches for #826214 and other issues will soon follow.

Regards,
Christian



More information about the Pkg-sysvinit-devel mailing list