I normally use service start/stop or initctl start/stop to start or stop a daemon process but now what I am looking for is to disable a daemon process from starting at startup example mysqld.

Currently what am doing is renaming /etc/init/mysql.conf to /etc/init/mysql.conf.bak but after reading a little about systemd I came to know that it provides enable & disable option for the above task.

So, is there something similar in ubuntu 12.04 with upstart.

  • You say you are using systemd? I use it on my Fedora 17 computer. systemctl [enable|disable|is-enabled] mysqld.service
    – BenjiWiebe
    Nov 2, 2012 at 19:43
  • 1
    @BenjiWiebe: No I am not using systemd. I am using upstart because systemd is not the default in ubuntu 12.04/12.10.
    – RanRag
    Nov 2, 2012 at 19:45
  • 1
    oh i see now... Not sure what i was thinking.
    – BenjiWiebe
    Nov 2, 2012 at 19:51

7 Answers 7


You can disable services by running the following command:

sudo update-rc.d -f <service name> disable

Man page excerpt:

When run with the disable [ S|2|3|4|5 ] options, update-rc.d modifies existing runlevel links for the script /etc/init.d/name by renaming start links to stop links with a sequence number equal to the difference of 100 minus the original sequence number.

  • 2
    I don't have enough reputation to down vote this and doing so without an explanation would be impolite anyway, so then just a comment: The question by @Noob pertains to Ubuntu 12.04 which uses Upstart (/etc/init/*.conf configuration files) for most system daemons (as mentioned by @Noob) while your suggestion only works for daemons started using scripts in /etc/init.d/* (the old SysV style). Edit: For the record, warl0ck has the right answer (thanks!).
    – xolox
    Aug 1, 2013 at 16:47
  • 3
    The question is about a hypothetical or in-general situation using mysql as a particular topical case. OP seemed at least partially aware of this answer, but it may serve posterity well to note that some useful packages don't and won't honor the upstart format (like webmin and many self-built from source packages around the time of comment). That means this method can be a valid partial answer for context, much like warl0ck and Mark's answers do to address the particular point of the hypothetical mysql service installed with a package manager.
    – JustinC
    Oct 2, 2013 at 15:01
  • The -f flag is not needed.
    – dannyman
    Nov 7, 2014 at 0:28
  • This is for init.d, not systemd, which most modern Linux systems use nowadays.
    – SineSwiper
    Mar 7, 2021 at 20:26

The correct way to disable and upstart service, is create a XX.override file,

echo 'manual' > /etc/init/mysqld.override

That way the upstart service will not get started automatically

  • Is this still works with Ubuntu 12.04?
    – RSK
    Feb 1, 2014 at 11:12
  • @RSK yes, why don't you just give it a try?
    – daisy
    Feb 2, 2014 at 2:51
  • 1
    I tried and didn't worked for me. Lemme try again and will update you.
    – RSK
    Feb 7, 2014 at 16:36
  • No, it doesn't work on Ubuntu-14.04.
    – Hi-Angel
    Mar 5, 2015 at 4:13
  • 1
    @RSK yes, why don't you just give it a try? I suppose, because it is very inconvenient to restart the system with "a try" to every advise from this page. Jan 9, 2016 at 15:21

@warl0ck has it right; wanted to add that this information is documented quite well in the Upstart documentation: http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting


With Upstart 1.3, you can make use of override files and the manual stanza to achieve the same result in a simpler manner [27]:

# echo "manual" >> /etc/init/myjob.override

Note that you could achieve the same effect by doing this:

# echo "manual" >> /etc/init/myjob.conf

However, using the override facility means you can leave the original job configuration file untouched.

To revert to the original behaviour, either delete or rename the override file (or remove the manual stanza from your ".conf" file).


There is also a nice piece of software to assist in this. Its called rcconf.

Just download it using:

sudo apt-get install rcconf

and use it with the command


You get a nice (commandline) interface to disable/enable services.

  • This is not included on the system, so install more stuff woudn't be the better answer.
    – m3nda
    Jun 11, 2015 at 13:28
  • but really usefull :D
    – Magico
    Dec 13, 2016 at 18:32

Try navigate to /etc/rc2.d and rename what you wish not to run at startup: change the (initial, capital) "S" into a "K" (e.g., S02mysql to K02mysql). If you change your mind, just reverse it. I think the 2 refers to runlevel, in what case 2 is the default, multiuser runlevel. Probably that's where you have most of the stuff for day-to-day computer use.

Edit: Read James O'Gorman's comment below.

  • 1
    Yes '2' refer to the run-level. You can check your current run-level using who -r or runlevel.
    – RanRag
    Nov 3, 2012 at 6:42
  • That's true, who --runlevel. Nov 4, 2012 at 3:22
  • 1
    While this achieves what you want, it's technically the wrong thing to do. In SysV init terms, 'S' scripts are start scripts and 'K' are kill scripts - i.e. S are run in order at startup and K are run in order at shutdown (or changing to a lower runlevel). Nov 5, 2012 at 21:05
  • @JamesO'Gorman: Interesting, I'm on Debian, are you saying my "K scripts" are run at shutdown? Is there some letter that could be used to disable the script altogether, with no hazard whatsoever? (It is kind of practical to keep them in the same folder, should a new situation arise where you'd want them.) Nov 5, 2012 at 22:31
  • @EmanuelBerg Yes, init will be running 'KXXscript stop' at shutdown. You should either remove the symlink or remove the execute bit from the real init script. I believe Debian uses update-rc.d to manage this. RHEL (and derivatives) use chkconfig. Nov 6, 2012 at 18:49

With Upstart the service configuration lies in files in /etc/init/. For example ssh is controlled using a config file /etc/init/ssh.conf

This file specifies the "events" which will prompt Upstart to start the "job".

To prevent a service from starting automatically, one of several methods can be used:
a) Rename the service.conf file so that it does not end with .conf
b) Comment out the "start on" line from the service.conf file.

In newer versions of upstart (since v1.3 at least) you can also override the start on line using a service.override file, so you could use:
# echo manual > /etc/init/service.override

Lastly you may also add the keyword "manual" to the end of the service's configuration file, eg via:
# echo manual >> /etc/init/service.conf

Note that this does not "stop" the running service, it just prevents it from starting automatically. While set for "manual" startup you control the service using initctl, eg to stop and start the SSH daemon:
# initctl stop ssh
# initctl start ssh

Arguably the best documentation for Upstart is at http://upstart.ubuntu.com/cookbook/

Section 11.44 covers "disabling a service from auto-starting, here: http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting


Well, I must say that the statement

echo "manual" >> /etc/init/myjob.override

is a little misleading because it means append the override file. I tested this on 14.04 with the network-manager and the following didnt work

vim /etc/init/network-manager.override:

However this worked

vim /etc/init/network-manager.override:

So, IMO, the initctl looks for the first uncommented line and executes it. Maybe I am wrong, but those were my test results. Inputs are welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.