How do I stop services from starting on boot on Ubuntu?

44

19

I have lots of servers installed (Apache, MySQL, etc.), but I don't want them all to start at boot time (they drain power, and I'm on batteries most of the time). How do I configure this?

Helder S Ribeiro

Posted 2009-09-03T18:26:59.943

Reputation: 5 997

Answers

55

In the console, you could write:

sudo update-rc.d -f apache2 remove
sudo update-rc.d -f mysql remove
...

For additional information read Ubuntu Bootup How to.

Kirill V. Lyadvinsky

Posted 2009-09-03T18:26:59.943

Reputation: 5 028

11

Things have changed quite a bit in Ubuntu now. I think from version 11 onwards. MySQL is handled by Upstart while Apache still uses traditional SysV init scripts

For MySQL, you can use the new override feature in Upstart to modify the starting behaviour:

sudo echo "manual" >> /etc/init/mysql.override

For more info, see the section "Disabling a Job from Automatically Starting" in the Upstart Cookbook.

As Apache still uses the traditional SysV init scripts you can use

sudo update-rc.d -f apache2 remove

to remove the links from /etc/rcX.d or, alternatively use

sudo update-rc.d apache2 disable

which "disables" the script by changing it from a start script to a stop script. This is reversible by

sudo update-rc.d apache2 enable


Most of this information I got from here: https://askubuntu.com/a/40077/24678

Wavesailor

Posted 2009-09-03T18:26:59.943

Reputation: 218

I get "bash: /etc/init/mysql.override: Permission denied" when run "sudo echo "manual" >> /etc/init/mysql.override" in Ubuntu 14.04. – Hung Tran – 2015-03-24T02:48:10.993

1@HungTran - As superuser, try creating the file /etc/init/mysql.override with an editor - with contents containing the word manual – Wavesailor – 2015-04-08T13:55:56.647

5

This link is a bit out dated version wise, but does it match an option in your version?

Configure startup services

This requires administrative privileges (see Chapter 2, Administrative Tasks).

  1. Run Services Settings: SystemAdministrationServices.
  2. Enter your password.
  3. Select the services you want running, then click OK when done.

codeLes

Posted 2009-09-03T18:26:59.943

Reputation: 1 772

4

You can use Boot-Up Manager for start and stop boot-up scripts, without the necessity to handle thru complex links and permissions.

apt-get install bum

enter image description here

zatamine

Posted 2009-09-03T18:26:59.943

Reputation: 141

3

Another way to accomplish this is to 'disable' the sym link - not delete it.

sudo update-rc.d mysql disable 2

This will rename the sym link to start with 'K' and the service won't start-up on boot. You can then re-enable it at any time if you do decide you want it to start-up on boot.

Sridhar

Posted 2009-09-03T18:26:59.943

Reputation: 131

2

On Ubuntu 16:

 sudo systemctl disable mysql

update-rc.d method wasn't working for me.

Upstart has been deprecated in Ubuntu 15.

Parag

Posted 2009-09-03T18:26:59.943

Reputation: 131