Upstart

Upstart is a replacement for the traditional sysvinit package, and runs as process #1. Through upstart, we are able to have an event-driven process, whilst at the same time retaining compatibility for the original sysvinit behaviour.

This page documents how to do a few common operations with the new system.

You may want to look at UbuntuBootupHowto, or the Upstart Cookbook for more examples and details of how the Init system is structured in Ubuntu and how to make use of it.

Where are initscripts installed?

This has not changed; they are installed in /etc/init.d. See /etc/init.d/README.

However, most important system jobs are no longer shipped as initscripts, but as upstart jobs. These are installed in /etc/init.

How are initscripts started and stopped?

This has not changed; symlinks are made from the initscript in the /etc/init.d directory to the /etc/rc?.d directories. See /etc/init.d/README and /etc/rc?.d/README.

What order are initscripts started and stopped in?

If a service has not been converted to upstart, this has not changed; the symlinks are named SNNname or KNNname, where NN is a number from 00 to 99. The K scripts are run first in numerical order, followed by the S scripts in numerical order.

However, services which have been converted to upstart will define their start criteria in the file, like this:

  • start on runlevel [2345] stop on runlevel [!2345]

This means the service will be started when the system reaches runlevel 2, 3, 4, or 5. It should be noted that it will be started in parallel with every other service that starts on those runlevels, and anything else still starting. The [!2345] in the stop on means it will be stopped whenever a runlevel that is *not* 2, 3, 4, or 5 is reached.

How do I find the current/previous runlevel?

This has not changed; use the "runlevel" command. See runlevel(8).

How do I change the runlevel?

This has not changed, use the "telinit" command or just invoke "init" directly. See telinit(8).

How do I change the default runlevel?

You should edit /etc/init/rc-sysinit.conf instead and change the following line:

    env DEFAULT_RUNLEVEL=2

How do I change the behaviour of Control-Alt-Delete?

Edit the /etc/init/control-alt-delete.conf file. The line beginning "exec" is what upstart will run when this key combination is pressed.

To not do anything when Control-Alt-Delete is pressed, you can simply delete this file.

Note that this only affects the behaviour of Control-Alt-Delete when at a text console. In a desktop environment, this key combination is handled by the desktop itself and must be reconfigured there.

How do I enter single-user mode?

This hasn't changed. Choose the "(recovery mode)" option from GRUB; add "-s", "S" or "single" to the kernel command-line; or from a running machine, run "telinit 1" or "shutdown now".

How do I reduce the number of gettys?

Also see "How do I change which runlevels gettys are run in?"

In /etc/init there is a file named ttyN.conf for each getty that will be started, where N is numbered 1 to 6. Remove any that you do not want.

This will not take immediate effect, however you can run "stop ttyN" to stop one that is running.

If your system has Upstart 0.6.7 or later, (first included in Ubuntu 11.04). you will be able to disable the automatic start of these without removing them by running

  • echo manual >> /etc/init/ttyN.conf

UpstartHowto (last edited 2013-01-28 00:15:28 by 108-161-123-122)