Thursday, August 18, 2011

Easy Understanding - Ubuntu Run Levels

Well Guys...As stated...I have been working to make a complete document on Ubuntu HA-NLB cluster setup and publish my work on Internet...Please expect some delay in that due to some conflict with the HA-NLB software(Ultramonkey) and Ubuntu.

Recently I thought of giving you the details of how to control and change the run-levels in Ubuntu. Please read the below article.

Linux run levels
are numbered 0 through 6. Run levels stop at six for practical and historical reasons, but it is entirely possible to have more if desired.

The following table summarizes the User Linux run levels:

* 0 System Halt
* 1 Single user
* 2 Full multi-user mode (Default)
* 3-5 Same as 2
* 6 System Reboot

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.http://www.blogger.com/post-create.g?blogID=7413783897596092588

(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.Note, run level 3 is for CLI and run level 5 is for GUI(Gueei)

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.

Run Levels Location
/etc/rc0.d Run level 0
/etc/rc1.d Run level 1
/etc/rc2.d Run level 2
/etc/rc3.d Run level 3
/etc/rc4.d Run level 4
/etc/rc5.d Run level 5
/etc/rc6.d Run level 6

Change run levels in Debian and Ubuntu Linux

Before we change run levels it might help to find out which run level is current. Use the ‘runlevel’ command to tell you two things: The last run level, and the current run level. Here is the command and the output shown together due to the sparsity of the output:

[root@localhost~:]# runlevel
N 2

The ‘N’ stands for none, meaning there has been no run level change since powering up.The primary command used to change run levels is ‘telinit’.

[root@localhost~:]# telinit 3
[root@localhost~:]# runlevel
N 3

telinit takes one argument on the command line. As always, see the man page for full details. Normally the argument will be one of: 0,1,2,3,4,5,6, or the letter ‘S’. As you may have guessed, the numbers correspond to the run level you wish to move to. Using the ‘S’, for single-user, is the same as the number 1, but don’t do it; the ‘S’ runlevel is intended for use by the UserLinux (Debian)system.

Things does not stop here. We keep on looking for the file where we can change the default run-level..do we??. So here it is::
[root@localhost~:]# nano /etc/init/rc-sysinit.conf


Now reboot the system and the new default run level is 3.

Cheers :)

No comments:

Post a Comment