7.3. Runlevels

In Linux, runlevels define how the system is started and what services are available in the running system. After booting, the system starts as defined in /etc/inittab in the line initdefault. Usually this is 3 or 5. See Table 7.1, “Available Runlevels”. As an alternative, the runlevel can be specified at boot time (at the boot prompt, for instance). Any parameters that are not directly evaluated by the kernel itself are passed to init.

To change runlevels while the system is running, enter init and the corresponding number as an argument. Only the system administrator is allowed to do this. init 1 (or shutdown now) causes the system to change to single user mode, which is used for system maintenance and administration. After finishing work, the administrator can switch back to the normal runlevel by entering init 3, which starts all the essential programs and allows regular users to log in and work with the system without X. To enable a graphical environment, like GNOME, KDE, or any other window manager, use init 5 instead. init 0 or shutdown -h now causes the system to halt. init 6 or shutdown -r now causes it to shut down with a subsequent reboot.

[Important]Runlevel 2 with a /usr Partition Mounted via NFS

You should not use runlevel 2 if your system mounts the /usr partition via NFS. The /usr directory holds important programs essential for the proper functioning of the system. Because the NFS service is not available in runlevel 2 (local multiuser mode without remote network), the system would be seriously restricted in many aspects.

Table 7.1. Available Runlevels

Runlevel

Description

0

System halt

S

Single user mode; from the boot prompt, only with US keyboard mapping

1

Single user mode

2

Local multiuser mode without remote network (e.g., NFS)

3

Full multiuser mode with network

4

Not used

5

Full multiuser mode with network and X display manager—KDM (default), GDM, or XDM

6

System reboot

Runlevel 5 is the default runlevel in all SUSE LINUX standard installations. Users are prompted for login directly under a graphical interface. If the default runlevel is 3, the X Window System must be configured properly, as described in Chapter 11, The X Window System, before the runlevel can be switched to 5. If this is done, check whether the system works in the desired way by entering init 5. If everything turns out as expected, you can use YaST to set the default runlevel to 5.

[Warning]Modifying /etc/inittab

If /etc/inittab is damaged, the system might not boot properly. Therefore, be extremely careful while editing /etc/inittab and always keep a backup of an intact version. To repair damage, try entering init=/bin/sh after the kernel name at the boot prompt to boot directly into a shell. After that, make your root file system writeable with the command mount -o remount,rw / and replace /etc/inittab with your backup version using cp. To prevent file system errors, change your root file system to read-only before you reboot with mount -o remount,ro /.


SUSE LINUX Administration Guide 9.3