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.)

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, Add Comment.
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.