Linux RunLevels

by
Share this Article: Facebook1Google+0Twitter0LinkedIn0Reddit0StumbleUpon0

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.

 

There are times in which you may want to operate the system at a lower mode, such as fixing disk corruption problems in runlevel 1 so no other users can possibly be on the system or leaving a server in runlevel 3 without an X session running. In these cases, running services that depend upon a higher system mode to function does not make sense because they will not work correctly anyway. By already having each service assigned to start when its particular runlevel is reached, you ensure an orderly start up process and can quickly change the mode of the machine without worrying about which services to manually start or stop.

Runlevels Descriptions:

0 – halt
1 – Single user mode
2 – Multiuser, without NFS (The same as 3, if you do not have networking)
3 – Full multiuser mode (terminal mode)
4 – unused
5 – X11 (X mode)
6 – reboot

Init  level  0 : Runlevel 0 is reserved for the “shutdown” phase. Entering init 0 from the shell prompt will shutdown the system and usually power off the machine.

init level 1 : Runlevel 1 is usually for very basic commands. This is the equivalent to “safe mode” used by Windows. This level is usually only used to asses repairs or maintenance to the system. This is a single-user mode and does not allow other users to login to the machine.
init level 2 : Runlevel 2 is used to start most of the machines services. However, it does not start the network file sharing service (SMB, NFS). This will allows multiple users to login to the machine.
init level3 : Runlevel 3 is commonly used by servers. This loads all services except the X windows system. This means the system will boot to the equivalent of DOS. No GUIs (KDE, Gnome) will start. This level allows multiple users to login to the machine.
init level 4 : Runlevel 4 is usually a “custom” level. By default it will start a few more services than level 3. This level is usually only used under special circumstances.
init level 5 : Runlevel 5 is everything! This will start any GUIs, extra services for printing, and 3rd party services. Full multi-users support also. This runlevel is generally used on by workstations.
init level 6 : Runlevel 6 is reserved for “reboot” only. Be carefully when running this command. Once you have entered init 6, there is no stopping it!


Special Run Levels For  Debian distro  or  Debian based

Run level 0 is the system halt condition. Nearly all modern X86 computers will power off automatically when run level 0 is reached. Older X86 computers, and various different architectures will remain powered on and display a message referring to the halt condition.

 

Run Level 1 is known as ‘single user’ mode. A more apt description would be ‘rescue’, or ‘trouble-shooting’ mode. In run level 1, no daemons (services) are started. Hopefully single user mode will allow you to fix whatever made the transition to rescue mode necessary.

(You can boot into single user mode typically by using your boot loader, lilo or grub, to add the word ‘single’ to the end of the kernel command line).

 

Run levels 2 through 5 are full multi-user mode and are the same in a default User Linux (Debian) system. It is a common practice in other Linux distributions to use run level 3 for a text console login and run level 5 for a graphical login.

 

Run level 6 is used to signal system reboot. This is just like run level 0 except a reboot is issued at the end of the sequence instead of a power off.

In the interests of completeness, there is also a runlevel ‘S’ that the system uses on it’s way to another runlevel. Read the man page for the init command , for more information, but you can safely skip this for all practical purposes.

 


Links :

 

 

  • http://www.redhat.com
  • http://www.help2go.com
  • http://www.skullbox.net
  • http://www.wikipidia.com
  • www.debianhelp.com

 

For questions please refer to our Q/A forum at : http://ask.unixmen.com/


Share this Article: Facebook1Google+0Twitter0LinkedIn0Reddit0StumbleUpon0