Linux Boot Process – 6 stages
Every time you power on your Linux PC, it goes through a series of stages before finally displaying a login screen that ask you for a username or password.
Once you supply user name and password few other things happen. We are going to check each stage thoroughly.
Your Linux PC is the result of many hardware devices(click below to expand)
All these hardware’s connected to a board called the mother board.
What this mother board can do or cannot do is pre-programmed and stored inside ROM(Read only Memory). So this is the first stage.
When you power ON your computer, it is this ROM on your computer mother board that will run first and tell what to do next.
It first read from Read Only Memory or ROM. What It read?
Basic Input Output System BIOS, is a software.
BIOS is the first program run when computer start.
The primary function of the BOIS is to preform POST (Power on Self Test).
In this step, BIOS check for essential hardware such as memory,storage ,video display etc.
If something is wrong with essential hardware, you may hear beep sounds or warnings.
Next task for the BIOS is to locate master boot record by looking the first sector of each hard disk.
In this step BIOS check if Master Boot Record MBR is available anywhere.
Once BIOS find Master Boot Record MBR, it then check for the boot loader.
So third stage of the Linux Boot process is Boot loader.
At this stage you may get an option to load the Kernel.
This stage is called GRUB. If you have multiple kernal images installed, you will have the option to choose at this stage.
Few other task takes place when the boot loader loads
-It might create a ramdisk (RAM based file system).
-Mount the root filesystemc.
-Run linuxrc command which will start hardware and drivers.
-dismount ramdisk
So once the root file system mounted, Kernel then execute initial programs (/sbin/init).
Kernel is the 4the stage
Next stage is called Init.
At this stage, your kernel will choose a run level by looking at /etc/inittab location.
Do you remember the stage when Linux is asking you to put user name and password? This is that stage.
There are 7 run levels available
0- halt/shutdown
1 single user mode
2 -Multiuser,without network
3- Multiuser full mode
4- unused
5- x11(graphical mode)
6- reboot
Last stage of the boot process is where it load rest of the programs(run level programs). This stage is called Runlevel
If you are familiar with windows operating system, its similar like startup programs in windows.
There are 7 run level programs. Based on your init level settings, system will execute one of the following
Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/
Do you remember seeing this? “starting sendmail …. OK”. It’s not mandatory but if you see it means its the last stage
In summary Linux boot process consist of 6 steps
1. BIOS
2. MBR
3. Boot loader> LILO/GRUB
4 .Kernel
5. Init programs
6. Runlevel Programs
Now go back and play the video once again. Understand the 6 steps.
ps: If something is unclear for you, add that in the comment or DM me here @Jobi
Share