The right way and the wrong way to disable init.d services

May 6, 2010

First, a quote from the (Ubuntu) manpage for update-rc.d (pointed out in the comments on a recent entry):

The correct way to disable services is to configure the service as stopped in all runlevels in which it is started by default. In the System V init system this means renaming the service's symbolic links from S to K.

Here is one difference between a developer and a sysadmin: to a developer, something is disabled if it only runs harmless code or only runs code in harmless situations. To a sysadmin, something is only disabled if it doesn't run any code at all.

The wrong way to disable init.d scripts is to leave K* symlinks around for them; it is the developer answer, not the sysadmin answer. The init.d scripts are still running, they are just theoretically only doing harmless things or only running in harmless situations (when the system will soon reboot anyways). In practice, no; there are too many init.d scripts that feel free to have their stop action do things that range from undesirable to dangerous, and any number that blithely assume that any instance of the daemon that they start must have been started by them.

(This is especially the case if stop or restart actions are going to run during package upgrades, instead of just when the system is shutting down. And if you actually use multiple runlevels, your life hurts.)

The right way to disable init.d scripts is to remove all rcN.d symlinks, both start and stop, and keep them removed (one way or another). That way I do not have to trust that the authors of the daemons that we aren't actually running all got it right, because I'm pretty certain that they didn't.

Systems that insist on doing things the developer way instead of the sysadmin way are broken, whether their developers realize this or not.

(I'm aware that I'm not going to persuade anyone important of this, and I'm sure that the Debian people will be happy to tell me that I'm totally wrong and they always get init.d scripts perfect and thus their way is the correct one. Sorry, I'm a sysadmin, I don't believe in systems where everyone has to get everything right all the time.)

(The comments on the recent entry both corrected my original mistaken ideas and caused me to think about all of this.)


Comments on this page:

From 38.100.140.120 at 2010-05-06 09:26:40:

It's not a developer vs sysadmin way. It's lazy/ignorant vs not.

I'm a developer and completely agree with you. Don't run anything from <X> when I disable <X>, forealzies.

- @ncb000gt

Written on 06 May 2010.
« The right way to fix ZFS disk glitches (at least for us)
Oracle's future for Sun's hardware and OS business is now clear »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu May 6 01:18:28 2010
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.