11.2. Runlevels

In Linux, runlevels define how the system is started. After booting, the system starts as defined in /etc/inittab in the line initdefault. Usually this is 3 or 5 (see Table 11.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 his 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 to work with the system. 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 made available by runlevel 2 (local multiuser mode without remote network), the system would be seriously restricted in many aspects.

Table 11.1. Available Runlevels

0System halt
SSingle user mode; from the boot prompt, only with US keyboard
1Single user mode
2Local multiuser mode without remote network (e.g., NFS)
3Full multiuser mode with network
4Not used
5Full multiuser mode with network and X display manager — KDM (default), GDM, or XDM
6System reboot

Runlevel 5 is the default runlevel in all SUSE LINUX standard installations. Users are prompted for login directly under a graphical interface. However, if the default runlevel is 3 and you want to change it to 5, you first need to configure the X Window System in the required way (see Chapter 12. The X Window System). After doing so, 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, replace /etc/inittab with your backup version using cp.