Starting and Stopping the System

The job of booting and rebooting a machine falls to a special program called init. Init is responsible for finishing the boot process once the kernel is done loading, launching the services necessary to run the computer. Init is also responsible for stopping services when needed and for shutting down or rebooting the computer when instructed.

For decades, the software handling these duties was called SysVinit, or System V init. Modern Linux distributions have begun switching to a replacement called Upstart (a less common replacement, init-ng, we will not discuss). The traditional model, facilitated by SysVinit, divides potential system states into multiple runlevels, each with a distinct purpose. Runlevel 3, for example, indicates a standard booted system; runlevel 6 indicates a reboot. When entering a runlevel N, SysVinit runs all of the commands in the directory /etc/rcN.d. In this manner, the scripts in /etc/rc3.d handle a system’s booting while those in /etc/rc6.d handle a reboot. Various commands (see accompanying table) allow a system administrator to force the system into a given runlevel. The file /etc/inittab specifies what runlevel is entered on boot, as well as configuration for the system’s tty’s.

Upstart replaces this functionality with a more general mechanism for the stopping, starting, and monitoring of services. Upstart operates asynchronously and is a much more powerful system than SysVinit. Thankfully, however, it is backward compatible ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.