LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Service startup at boot: how to disable robustly? (https://www.linuxquestions.org/questions/debian-26/service-startup-at-boot-how-to-disable-robustly-4175457754/)

catkin 04-11-2013 12:06 AM

Service startup at boot: how to disable robustly?
 
How to stop a Debian service starting at boot in a way which will not be undone if the package containing the service is upgraded?

Research shows several ways are commonly used to stop a service starting at boot:
  • update-rc.d -f <service name> remove
    This has the effect of removing all the /etc/rc*.d/[KS]*<service name> symlinks
  • Removing the execute permission on /etc/init.d/<service name>
  • Changing the S in /etc/rc*.d/S*<service name> symlink names to K
  • Modifying /etc/default/<service name> to configure the service not to start.
    Not all (few?) services support such a configuration option.
  • Perhaps only on upstart systems where it may be the only way ... Modifying /etc/init/<service name>.conf file to configure the service not to start.
This issue of persistence during package upgrade is not mentioned in the LQ WIKI page on update-rc.d and I could not find anything about it in the Debian FAQ
where a search found only three references to update-rc.d.

cynwulf 04-11-2013 02:47 AM

I tend to do

Code:

# update-rc.d daemon_foo disable
But have a look at

Code:

$ man sysv-rc-conf
I'm pretty sure that all of those methods you've listed will be overwritten by package upgrades.

catkin 04-13-2013 03:50 AM

Thanks caravel :)

AIUI the effect of update-rc.d <service name> disable is to change the S in /etc/rc*.d/S*<service name> symlink names to K.

Thanks for the heads up on sysv-rc-conf. AIUI it's a character-based menu tool for manipulating the /etc/rc*.d/[KS]* symlinks.

Nice to learn of different approaches but not solved yet ...

catkin 04-13-2013 04:11 AM

Ah, found it! From Securing Debian Manual section "3.6.1 Disabling daemon services"
Quote:

... the files under /etc/init.d are configuration files and should not get overwritten due to package upgrades if you have made local changes to them
Based on that, any disabling technique that leaves at least one /etc/rc*.d/[KS]* symlink which is different from the symlinks in the upgrade package should be fine. These techniques should do:
  • update-rc.d -f <service name> disable
  • sysv-rc-conf <service name> followed by interactively changing the default symlinks
  • for s in /etc/rc*.d/S*<service name>; do mv $s ${s/.d\/S/.d\/K}; done


All times are GMT -5. The time now is 08:45 PM.