What's the insserv way of disabling services

Petter Reinholdtsen pere at hungry.com
Sat Apr 19 09:08:07 UTC 2008


[Michael Biebl]
> It's still a bit clumsy though and hard to handle. If we can do it
> better, we should try to do so.

I agree.  Any ideas how it could be less clumsy?

> Which priority do you choose for K??? The current value of S??
> e.g. S20 -> K20. Imho this doesn't make sense, as insserv would
> reorder it. Could you post the commands (including arguments) how to
> disable a service correctly?

It does not matter what priority one choose, if one make sure insserv
get to renumber it afterwards.  Here is an example from my sid chroot
disabling gpsd in runlevel 3:
minerva:/# ls /etc/rc*/*gpsd*
/etc/rc0.d/K04gpsd  /etc/rc2.d/S23gpsd  /etc/rc4.d/S23gpsd  /etc/rc6.d/K04gpsd
/etc/rc1.d/K04gpsd  /etc/rc3.d/S23gpsd  /etc/rc5.d/S23gpsd
minerva:/# mv /etc/rc3.d/S23gpsd /etc/rc3.d/K23gpsd
minerva:/# update-rc.d gpsd defaults
insserv: Warning, current start runlevel(s) of script `gpsd' (2 4 5 ) overwrites defaults (2 3 4 5 ).
insserv: Warning, current stop runlevel(s) of script `gpsd' (0 1 3 6 ) overwrites defaults (0 1 6 ).
minerva:/# ls /etc/rc*/*gpsd*
/etc/rc0.d/K04gpsd  /etc/rc2.d/S23gpsd  /etc/rc4.d/S23gpsd  /etc/rc6.d/K04gpsd
/etc/rc1.d/K04gpsd  /etc/rc3.d/K04gpsd  /etc/rc5.d/S23gpsd
minerva:/#

> You know, because the S?? -> K?? handling is so clumsy, a lot of sysv
> init scripts started to provide ENABLE= config variables via
> /etc/default/$service, which is an even worse alternative and makes
> everything very inconsistent.

Yes, I know. :)

> Having a clearly specified, well documented, easy way of disabling a
> service with insserv, looks like a better approach to me.

I agree.  Should we try to come up with a specification, and get it
documented in the developer reference?

> That is sysvinit only, really (I don't count file-rc as a boot system).

Well, we should find a way that work for file-rc too, I believe.

> Other systems, like runit, initng, upstart (in non sysv-compat
> mode), don't use the S?? -> K?? mechanisms for disabling jobs
> anyway, so I think this argument is moot.

What about adding a new feature to update-rc.d, say, disable?  

  update-rc.d service disable [runlevels]

When not given a runlevel, it will disable all runlevels.  The command
given above would then be written as

  update-rc.d gpsd disable 3

What do you think?

Happy hacking,
-- 
Petter Reinholdtsen




More information about the initscripts-ng-devel mailing list