Showing posts with label Runlevel. Show all posts
Showing posts with label Runlevel. Show all posts
Pawan Sharma | March 29, 2011 | | 2 Comments so far

Booting in to RUNLEVEL of your choice


One key skill is to understanding how to boot system in to different runlevels. Everyone, who wants to attempt the Red Hat Certified System Administrator exam, should know how to boot into different runlevels during the boot process. This is explicitly described as an RHCSA requirement. In this section I will explain you how to boot system in to different runlevel for troubleshooting and maintenance. In this section you will use GRUB menu to boot in to different runlevels. 

Here are simple steps which explains HOW TO BOOT IN TO RUNLEVEL OF YOUR CHOICE:

  • When you boot the system BIOS looks for the MBR and finds GRUB to edit the directives in GRUB menu, press any key before the following message expires (normally in 5 seconds):
“Press any key to enter menu”

You will see menu similar to figure given below, from where you can modify how GRUB boots into Linux.
GRUB BOOT menu of RHEL 6

  •  If the menu is password protected, you will have to press p before entering the password.
  •  Then press a to access the kernel command line.
  • At the end of kernel command line, type a space followed by the runlevel of your choice. For example 1 or single, 2,3, and 5.
  •  And press b to boot. You will now boot in to the runlevel you specified in above step.

Reboot your system and you can see that now the system boots in its default runlevel, because editing kernel entries from GRUB menu does not make changes in /etc/inittab file which have an entry for default runlevel. To make your changes permanently you have to edit the /etc/inittab file.

The main purpose for booting system into different runlevel is to correct serious problems in the system. And to correct we use the single-user mode or runlevel 1.

At the GRUB menu you can use following commands:

          Command           Description
  •   b                        Boot the current listed Operating System
  •  d                        Delete the current line
  •  e                         Edit the current line
  • o                         Create empty line underneath the current line
  • O                        Create an empty line above the current line
  •  
These options/commands can be used at boot menu to booting in to different runlevel.
Pawan Sharma | March 28, 2011 | | Be the first to comment!

Runlevels in RHEL 6


          In this post I will explain you about different RUNLEVELS in RHEL 6. All Linux services are organized by runlevels. Runlevels can be used to halt or reboot the system, some runlevels can boot Linux with or without networking services. There are six runlevels and each runlevel executes a specified set of scripts. Runlevel and description of each runlevel is given below:




                Runlevel              Description
  • ·         0                              Halt
  • ·         1                              Single-user mode, for maintenance and repairs
  • ·         2                              Multiuser, with some networking services
  • ·         3                              Multiuser, with networking
  • ·         4                              Unused
  • ·         5                              X11 console, Defaults to a GUI desktop with networking
  • ·         6                              Reboot

          All of these runlevels are defined in /etc/inittab file which is first process and which decides the default runlevel and to launch scripts for a particular runlevel. The functionality of each runlevel is given below:

  • ·         Runlevel 0 will halt the system, never sets this runlevel your default runlevel.
  • ·         Runlevel 1, also known as single-user mode, only one user is allowed to connect to Linux system.    This runlevel is used for system maintenance, repairs, backups and restores.
  • ·         Runlevel 2 is a multiuser with some networking. This runlevel is used for configuring the system  performance.
  • ·         Runlevel 3 is a also multiuser environment with all the networking services. This runlevel or console is used by the system administrator or other general users. This is a text based console
  • ·         Runlevel 4 is Unused. One can edit this runlevel to make it customized to use.
  • ·         Runlevel 5 is a X11 console. This runlevel defaults to a GUI login screen. Logins bring the user to a Graphical User Interface desktop with all networking services.
  • ·         Runlevel 6 will reboot the system. Never set the initdefault (default runlevel) to this value. This will enter a continuous reboot cycle.


          Each runlevel have some series of scripts associated with it. All scripts are collectively stored in /etc/rc.d/init.d directory and all runlevels also have their own directory which contains some start and stop scripts. The scripts associated with each runlevel can be found in /etc/rc.d directory:

          rc0.d
          rc1.d
          rc2.d
          rc3.d
          rc4.d
          rc5.d
          rc6.d

          In someone’s Linux system the default runlevel is 5, init process will in /etc/rc.d/rc5.d and run each “kill” and ”start” script. The kill script is a file or symbolic link to the file with a name that begins with “K”. Likewise, start script is a file or symbolic link to the file with a name that begins with “S”.