linux boot process explained in detail

(Last Updated On: September 30, 2018)

Linux Boot Process detail explanation with examples

 

                            Before starting the Linux boot process, I would like to ask you a simple question. Did you ever wonder what happens in the background of a computer when you press the power button and get a flashing login screen?

I guess no! So let me just tell you what exactly goes on behind a Linux boot process. There are some stages we can define while describing the booting process. In fact, there are 6 stages that a Linux system has to go through while booting. So check out all the 6 stages of the Linux boot process has been explained in this article.

The entire process of booting a system while executing some pre-mentioned script or commands is called as Bootstrapping. In the earlier days, the boot process has to be executed while loading the bootloader program manually. But now in today’s computers, as they are equipped with facilities that make the process automatic and much simpler than before.

If you are planning to grow your professional carrier with Linux, then you have to understand the Linux boot process properly from the core level otherwise you can not progress far. And more importantly, you would be facing questions like ” kindly describe the booting process of Linux” or ” tell me about Linux boot process in detail” while attending for Linux Job Interview.

 

linux boot process

 

I have explained each and every single process in detail so that you can have a pretty good idea about what is the process and do they linked to each other while performing a successful boot of a Linux system.

 

As the above image explains, there is a total of 6 stages in the booting of a Linux system.

 

So here are the detail explanations of all the 6 stages that have to be executed while a linux boot process.

 

 

BIOS 

Bios stands for Basic Input Output System. Before it starts searching for the bootloader, it has to perform some initial checking.  Then it searches the bootloader that can be available in CD-Rom, Floppy drive, and Hard disk. Now after the bootloader is detected, it simply provides the control to it. So we can say that BIOS finds and execute the MBR bootloader.

So we can simply say that BIOS is the first process that loads the bootloader and transfers the control to it.

 

 MBR

It stands for Master Boot Record. It has a size of 512 Bytes and resides in the first sector of the bootable media.

MBR has 3 components such as mentioned below:

1) primary boot loader info (contains in the first 446 bytes,)

2) partition table info (in the next 64 bytes,)

3) Master Boot Record validation checks ( in the last 2 bytes). It contains information about the GRUB ( LILO for old system).

So we can say that MBR loads and executes GRUB boot loader.

 

GRUB

It stands for Grand Unified Boot Loader. It displays a splash screen and if you don’t press anything, it loads the default kernel mentioned in the Grub configuration file.

Grub has the filesystem knowledge which in the older one (Lilo) didn’t have. The default  configuration file is /boot/grub/grub.conf or /etc/grub.conf . Grub contains Kernel and initrd image on it.

So we can say, Grub loads and executes Kernel and initrd image.

 

Kernel

Initrd stands for Initial RAM Disk. Kernel uncompresses the initrd image and mounts it and loads all the drivers that are necessary. There are some programs like insmod, rmmod, presents in the initrd image, help in loading and unloading of kernel modules.

The kernel looks for Hard Disk ( LVM / RAID) and unmounts the initrd image, this way frees up some memory occupied by the Disk image.

Kernel then mounts the root file system as specified in the grub.conf file in the ” root=” section as read-only and runs the init process.

 

Init Process

Executes the system to boot into the run level as specified in the /etc/inittab.

These are the run levels.

0 – Halt
1 – Single User Mode
2 – Multiuser Mode without NFS
3 – Full Multiuser Mode
4 – Unused
5 – X11
6 – Reboot

You can check current run-level with this command  # who -r

 

Runlevel Scripts

When a Linux system boots up, you can see various service getting started, those are the run-level programs.

below are the run-level scripts,

Based on the selected run-level, the init process then executes the start-up scripts located in the sub-directory of the /etc/rc.d directory.

SO this is the background process of a Linux system when it boots up, and if everything goes fine you will see the login screen.

 

 

 

Conclusion:

So, guys, I have tried my best to simplify things so that you can have a better understanding and user experience. Now it’s your turn to pay me back.

I am expecting your responses. If you like this content inspire me by just commenting or liking this article. Your responses will motivate me to do better and deliver better. Even if you do not like this article then also tell me by commenting below. I will try my best to improve my skill.

So thank you guys, Have a good day.

Rate this content
Sending
User Review
5 (6 votes)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ad Blocker Detected

Ad Blocker Detected, please disable it to help this page in many ways. Thank you so much.

Refresh