logo
Linux User
OpenSource Apache Embedded C Linux MySQL No deposit no GamStop bonuses Perl PHP Samba

Module Release June 2003: Runlevels

This month's offering concentrates on the basics of booting a Linux system.

LPI 102 Objective 1.106.2 asks you to:

Manage the runlevel of the system … includes booting to single user mode, shutdown or rebooting the system … alert[ing] users before switching runlevel … properly terminate processes … setting the default runlevel

Linux systems typically run in one of several runlevels—modes providing different features and levels of functionality, mainly services.

Systems normally provide 7 levels, numbered from 0 to 6, but only three levels (0 = halt, 6 = reboot, 1 = single-user) have mandated characteristics. Unfortunately, there is no real consensus among distributors about how to organise the other four user-defined levels (2–5) or what services to include in them. Moreover, many systems allow system administrators to swap services between runlevels and start and stop individual services at will.

In addition to outlining some of the broad patterns of runlevel usage between distributions, the module gives particular attention to the mandatory levels. The single-user mode, its usefulness, potential security risks and controlling access via the sulogin command are explained. Simple and detailed methods of system shutdown and restart are outlined.

Without direct human intervention, systems start in the default runlevel. The module explains how this is defined by the initdefault line in /etc/inittab. This file provides the configuration which governs bootup and points to the scripts which start the relevant individual services in each runlevel. The module then goes on to point out how to override the default, interactively. The runlevel command tells you the current runlevel that you are operating in. On Linux the init and telinit commands behave identically and are used to switch runlevels interactively.