Unix Tools
unix tutorials, unix security, unix help

 

What Are Linux Runlevels?

By: Vinu Thomas

Linux systems today generally use eight runlevels.

Runlevels define what services or processes should be running on the system.

The init process can run the system in one of eight runlevels. The system runs only one of the eight runlevels at a time.

The main runlevels are from 0 – 6. Here's what each runlevel is for:

Runlevel 0: Halt System - To shutdown the system
Runlevel 1: Single user mode
Runlevel 2: Basic multi user mode without NFS
Runlevel 3: Full multi user mode (text based)
Runlevel 4: unused
Runlevel 5: Multi user mode with Graphical User Interface
Runlevel 6: Reboot System

Runlevels 1 and 2 are generally used for debugging purposed only, and are not used during normal operations. Most desktop linux distributions boot into runlevel 5, which starts up the Graphical Login Prompt. This allows the user to use the system with X-Windows server enabled. Most servers boot into runlevel 3, which starts the text based login prompt.

Linux runlevels can be changed on the fly using the init tool. If you want to switch from text based operations to the Graphical Interface, you just have to type in 'telinit 5' in the root prompt. This will bring up the Graphical Interface in your system.

Each runlevel can be configured by the system administrator. The "/etc/inittab" file has information on which runlevel to start the system at and lists the processes to be run at each runlevel.

Each runlevel has its own directory structure where you can define the order in which the services start. These directories are located in the /etc/rc.d/ directory, under which you have rc1.d, rc2.d, rc3.d…. rc6.d directories where the number from 0 through 6 that corresponds to the runlevel.

Inside each directory are symbolic links that point to master initscripts found in /etc/init.d or /etc/rc.d/init.d.

You can also change the runlevel at boot time. If your system uses LILO as the boot manager, you can append the runlevel to the boot command :

LILO: linux 3 or
LILO: linux 5

If your system uses GRUB, you can change the boot runlevel by pressing the `e' key to edit the boot configuration. append the runlevel to the end of the boot command as shown:

kernel /vmlinuz ro root=/dev/hda1 5

About The Author...

Vinu Thomas is a consultant on Web design and Internet Technologies. His website is www.vinuthomas.com. You can read more articles on Linux @ www.vinuthomas.com/sections-listarticles-6.html
Provided By: Computers and Technology

More about Linux Runlevels here on LinuxWorld:

OSweekly says: Runlevels control services started by the initialization process. The number of runlevels and services started on those runlevels varies with Linux distributions. Information about the runlevels of a particular distribution is listed in file /etc/inittab. Read the rest here...

RedHat.com says: The idea behind operating different services at different runlevels essentially revolves around the fact that different systems can be used in a different ways. Some services cannot be used until the system is in a particular state, or mode, such as ready for more than one user or has networking available.