• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

System Initialization

Linux – System Initialization

Boot process:

Boot process consists the set of processes from power on the PC to login prompt comes.

When a computer boots up, the BIOS is the first program that is run. After it is loaded, the BIOS begins to test the system through the power on Self Test (POST) and then starts loading peripheral devices. The BIOS then looks for the boot device and passes control to it. The boot device contains the Master boot record (MBR), Which starts to boot the system via the boot loader. From here, the Grand unified boot loader (GRUB) looks to boot into the kernel that is labeled as the default. Finally, the kernel calls the init process, which boots up the rest of the system.

The GRUB has become the default boot loader for Red Hat, ebonite, and many; other versions of linux as well

When GRUB loads, you are given a list of kernels and additional operating systems from which you can choose to boot.

By default, there is a configurable 5-second timeout value that choose the default kernel if you don’t make a selection and the timeout there should is reached/ After GRUB loads the kernel, it passes control over to the kernel, which it run begins to initialize and configure the computer’s hardware.

During the boot process, everything is logged to the /var/ log/ dmesg file. You can also use the dmesg cmd to query information about the boot process after the system has booted.

When the system’s drivers are in place, the kernel executers the /sbin / init program.

In RHEL 6, the boot process has been replaced by a new utility called upstart instead of the traditional system in it style scripts. This utility decreases the time that it takes the system to boot and is already currently being used on other versions of lixun such as ubuntu.

The init program is the first process created by the kernel. It is responsible for the rest of the boot process and setting up the environment for the user.

First, it consults the /etc/init tab file, which defines how the rest of the boot process will go. The /etc/init tab file lists the default run level to boot into and the system initialization script (letc/rc.d/rc.sysinit).

Let’s look at the /etc/init tab file to see what the init process goes through
#cat/etc/init tab

You can see that the default run level is set to 5, although six different run levels are listed. The /etc/init tab file also defines how to handle power failures and virtual terminals. After the init process is done consulting the /etc/init tab file, the /etc/rc.d/rc.sys init script is run,  which handles setting the system clock, networking, setting up the user environment & more.

In Red Hat Linux, the default run level is 5. This default run level is passed to the /etc/rc.d /rc script, which calls all the programs in the /etc/rc.d/rc#.d directory.

The last thing that you should see is the login prompt. If you have a desktop manager installed such as Gnome, you should see a GUI login screen where you can login to the system; otherwise, you see a text mode login.

Working with Grub: The GRUB boot loader is broken down into different stages. The code contained on the MBR is considered GRUB stage 1 . It loads GRUB stage 1.5, which tries to identify the file system type (optional), or it can call GRUB stage 2 directly. Stage 2 is what calls the kernel and loads it into memory. In stage 1, GRUB needs to search the MBR looking for an active partitions from which to boot the kernel. GRUB has its own format for looking through hard disks.

The syntax of this format is

(xdn[, m])            where xd is the drive

  • n is the number of the disk
  • m denotes the partition number.
  • The syntax is very useful when troubleshooting issues with GRUB because you need to know how GRUB searches for disk drives when trying to find the primary partition. When the primary partition found, GRUB loads the kernel, which is where you move on the stage 2. Stage 2 is the place where you will tend to spend the most time troubleshooting boot issues with the system. As stage 2 is starts, it presents you with a list of kernel’s that you can boot from, along with a listing of options that you can use to modify the parameters passed to the kernel during bootup.
Learn more about Linux Interview Questions in this blog post. Interested in mastering  Linux ?
 Check out this blog post to learn more  Linux Tutorials

Grub Boot options:

e    —->         Edit the cmds before booting

a    —->           Modify (or) append the kernel arguments before booting

c       —->        open the GRUB cmd line.

  • You can use ‘a’ option to modify any parameters you want to pass to the kernel. This includes changing the run level that the system will boot into.
  • After choosing the ‘a’ option, you can pass a mode as a parameter to enter into the mode. Here are the different modes that you can booty into:

Single – User Mode ——> perform maintenance tasks (or) forget the root password.

Run level 2 (or) 3——> Load only partial services during the boot process

Emergency Mode ——> used to perform tasks on an unbootable system.

Rescue Mode ——>  used to fix boot issues (or) reinstall GRUB.


The Config file:

GRUB has only a single config file, /boot/ grub/grub.conf. Two other files actually have soft links to this main config file as well:

/boot/grub/menu.lst and /etc/grub.conf. When GRUB starts, it reads its configuration from the main config file

# cat /boot/grub/grub.conf

Using the C option to enter the GRUB cmd line, you can make changes to the config file, reinstall GRUB, or repair a broken config file.

The GRUB Command Line:

How to repair a broken MB

You need to make use of the rescue environment, which can be found by booting from the RHEL installation DVD. When you are in the rescue environment, you can repair your broken MBR.

Step1:   Load up the GRUB cmd line to find the disk and partition  that contain the grub conf file using the find cmd.

Grub> find           /grub/grub.cong

(hd ʘ, ʘ)

àyou could also run:


(hd ʘ, ʘ)

Step 2: Install GRUB on the drive is returned:

Grub> setup        ((hd ʘ)

——> Now that your MBR is fixed, you should be able to boot the system once again.

  • Runlevels:

——> when the system boots up, it queries for the default run level, which is defined in the /etc/init tab file. When the default run level is located, the system boots into that particular runlevel.

——> There are six run level in total which are shown in the /etc/init tab file. Each runlevel also has a directory called /etc/rc.d/rc#.d, where  # is the runlevel (from 0 to 6).

àLet’s look at the different runlevels:

0   ——>          halt

1   ——>          single user mode

2   ——>          multiuser with partial services

3   ——>          Full multiuser with networking (text mode)

4   ——>          not used

5   ——>          Full multiuser graphical mode (GUI desktop login)

6   ——>          Reboot

Inclined to build a profession as Linux Developer? Then here is the blog post on Linux Training Online.

——> The easiest runlevels to understand are 0 and 6. These two runlevels are called by the same cmd with different input. In runlevel 0, essentially the system is off. In runlevel 6, the system is restatrting. Runlevel 1 is used to enter single-user mode, which you would enter if there are issues with the system and you’d like to perform maintenance. You can also resetr the root user’s passowerd in this runlevel. The remaining runlevels provide various states for different services to run it

——> Don’t forget the the upstart is the program that actually starts & stops services at each runlevel now. The /etc/init/ rc.conf file shows how each set of scripts is called:

#cat /etc/init/ rc/conf

Runlevel Utilities:

àLet’s now look at the many system utilities that help you manage the system in different runlevels. These management cmds are

Sys: Shutdown [options] time

-k     ——>         doesn’t shutdown; just warns

-h     ——>        Halts the system after shutdown

-r      ——>        Reboots instead of turning off the system

-F     ——>         Forces a file system check on reboot.

-n     ——>        kills all processes quickly (not recommended)

-t       ——>       SECS sends a shutdown message but delays shutdown by x seconds.

EX:         #shutdown          -h           now

#shutdown          -r            now


#shutdown          -h           120          Delay the shutdown by 2 minutes.

Halt: powers down the system.

——>To turn of the system #shutdown now (or)        # halt

Poweroff: works the same as the halt cmd.

——>To check the current runlevel   # runlevel


#who –r

——>To change runlevel 3                                 #init 3

Indepth understanding of Linux click on

Review Date
Reviewed Item
System Initialization
Author Rating

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on System Initialization"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.