[Pkg-sysvinit-devel] Bug#382410: /etc/rc0.d out of order: blame update-rc.d docs?

Alessandro Vesely vesely at tana.it
Thu Aug 10 17:44:33 UTC 2006


Package: sysv-rc
Version: 2.86.ds1-1

I had to read the init.d/rc script to make sure that
Knn* are _not_ called in reversed sort order. In facts,
the docs don't say it. Giving a single NN argument should
be deprecated. More misunderstandings below...

Related bugs: 268713, 288098
The following also applies to version 2.86.ds1-2, AFAICS.


Suggestions:

1) advertise update-rc.d
Add a paragraph in /etc/init.d/README saying something like

   Use the update-rc.d command to create symbolic links
   in the /etc/rc?.d as appropriate. See that man page
   for more details.

2) encourage setting the stop number correctly
In the man page I would replace

   this can be overridden by supplying one or two NN arguments

with

   this should be overridden if there are dependencies. For
   example if daemon B depends on A, then A must be started
   before B and B must be killed before A. You accomplish
   this by supplying two NN arguments. In general, core daemons
   should start early and be killed late, whilst applications
   can start late and be killed early. See EXAMPLES below.

   The first NN argument supplies the start sequence number and
   the second NN argument supplies the kill sequence number.
   Kill scripts are called first, passing a stop argument. Then
   start scripts are called passing a start argument. In either
   case, calls happen in ascending sequence number order.

   Supplying a single NN argument will use the same number for
   both start and kill links. This is supported for backward
   compatibility but is discouraged, as it may lead to inconsistent
   settings. As a rule of thumb, if you increase the start sequence
   number you should also decrease the stop sequence number, and
   vice-versa.

And then put more examples, e.g.

   Insert links at default runlevels when B requires A
      update-rc.d script_for_A defaults 80 20
      update-rc.d script_for_B defaults 90 10

   Insert a link to a service that (presumably) will not be
   needed by any other daemon
      update-rc.d top_level_app defaults 98 02

   Insert links for a script that requires services that
   start/stop at sequence number 20
      update-rc.d script_depends_on_svc20 defaults 21 19


Giving a single argument should be deprecated:

Let two independent daemons A and B configured in that way,
say A starts/stops at sequence number 20 and B at sequence
number 40. Then consider a service C that depends on A and
provides services necessary for B. (E.g. B can be configured
to do authentication using C.) Then C may start at 30, after
A but before B. There is no valid sequence number to stop C.
In facts, the stopping order should be kill-B, kill-C, kill-A,
which is not possible because A is killed before B.

Of course, such deadlocks may happen also letting the default 20,
but then at least it is clear that the problem hasn't been put. I
see no circumstance in which supplying `40' to the configuration
of B yields a benefit. What am I missing?


More misunderstandings:

- I have rc0.d/K21fam and rc3.d/S21fam. They used to be both at 20
   (see bug 280617.) What issue has been solved with that move?

- If anyone is registered there, please edit
   http://wiki.linuxquestions.org/wiki/Update-rc.d
   it says so:

     Yes, you can use the arguments start and stop, followed by NN
     (where NN are the desired runlevels) to specify which runlevels
     the script will start and stop in.






More information about the Pkg-sysvinit-devel mailing list