A Breakdown of How Linux First Boots Up

Mou
7 min readMay 12, 2023

--

The process of booting Linux consists of a series of stages, beginning with the initialization of the firmware and continuing with the loading of the operating system and the beginning of the processes that run in user space.

It is comprised of a few essential tasks, such as initialising the BIOS POST check, loading user programmes, and presenting a graphical user interface (GUI). By the time you finish reading this article, you will have a comprehensive comprehension of the Linux boot process as well as the relevance of each stage.

the Linux boot process broken down into steps

The procedure by which Linux is booted consists of eight phases.

POST, BIOS, MBR, GRUB, KERNEL, INIT, SYSTEMD, RUNLEVEL

These eight stages will execute themselves in a responsible manner one after the other to load the operating system. Let’s investigate the specifics of how each stage of the boot process is carried out so we can get the full picture.

Stage 1: POST (Power-On Self-Test) (Power-On Self-Test)

After you turn on your computer, the first thing that will take place is something called a Power-On Self-Test, which is performed by the hardware (POST). During this phase of the process, the computer examines each individual component of its hardware to validate that it is operating appropriately. In the event that any of the components do not pass this test, the computer will either make a beeping sound or show an error message on the screen.

Immediately after the POST, the logical process will run the BIOS. In the following step, we will become familiar with Bio and its various functions.

Stage 2: BIOS/UEFI:

The Basic Input/Output System (BIOS) or the Unified Extensible Firmware Interface (UEFI) will load once the POST has finished running its course. It maintains control over hardware resources such as hard drives, RAM, and video cards, amongst others. In addition, the BIOS stores the code necessary for controlling the keyboard, reading data from floppy discs, and producing text on the display.

The loading of the boot loader and the initialization of the hardware are both the responsibility of this firmware.

Following this stage, the logical process advances to the MBR, which is the component that is accountable for initiating the boot loader.

Master Boot Record constitutes the third stage.

The Master Boot Record, abbreviated MBR, is a relatively tiny programme that is located at the beginning of a storage device, most commonly a hard drive. It is comprised of the boot loader, which is the component in charge of loading the operating system.

While using Linux, the Master Boot Record (MBR) is what is utilised to boot the system and initiate the GRUB (GRand Unified Bootloader) bootloader. GRUB will then load the Linux kernel as well as any modules that are required to start the operating system. The Master Boot Record (MBR) is an essential component of the system’s initialization procedure; hence, if it is altered in any way, including being overwritten, the system may be unable to boot.

Because we already know that Stage three taught us that GRUB is a boot loader in Linux, let’s go on to Stage four and learn more about the GRUB boot loader.

Step 4: GRUB (Grand Unified Bootloader)

GRand Unified Bootloader, also known simply as GRUB, is a bootloader that is utilised frequently in Linux operating systems. During the boot process, it is responsible for loading the operating system kernel as well as any necessary modules. GRUB is capable of managing many operating systems, giving users the ability to select which OS to boot from a menu during system startup.

The boot options and menu are both defined in a configuration file for GRUB that may be found in the directory /boot/grub/grub.cfg. This file is produced by a programme known as “grub-mkconfig,” which searches the computer for kernels that are installed and then provides a boot menu based on the results of its search.

It is also possible to manually modify GRUB by altering the configuration file; this gives users the ability to personalise the boot choices and menu. Troubleshooting and general system maintenance can both benefit from GRUB’s support for a wide variety of boot options, including recovery mode, alternate boot targets, and kernel settings, amongst other things.

After this, we have arrived at the KERNEL stage, which is the most important part of the booting process in Linux. So let’s find out why the KERNEL is so important when it comes to the boot process.

Step 5: KERNEL

The Linux kernel is the central component of the operating system that is responsible for interacting directly with the computer hardware. It is accountable for the management of the system’s resources, such as the central processing unit (CPU), memory, and input/output devices. In addition, the kernel is responsible for providing system functions such as networking, file management, and the management of processes.

Because Linux is an open-source operating system, its kernel source code can be accessed and altered by any user who wishes to do so. This has resulted in a vast community of developers contributing to the development of the kernel, which has improved its overall performance as well as its security and reliability.

In a nutshell, the Linux kernel is the most important part of the operating system, as it is responsible for the management of the computer’s hardware and the provision of the required services for the execution of programmes and procedures.

The next level, known simply as INIT and after the KERNEL stage, is Initialization.

Step 6: INIT

During the process of booting Linux, the INIT process is the first one that the kernel begins running after it has been initialised. It is the duty of this component to initiate the system as well as start all of the other processes and services. The word “INIT” stands for “initialization.” It is the duty of this component to initiate the system as well as start all of the other processes and services.

INIT is responsible for generating processes based on the scripts that are saved in the configuration file /etc/inittab, which is used by the initialization system. This is the role of INIT.

This process is responsible for performing a variety of system initialization activities, including the beginning of daemons and other processes, the loading of modules that are required for the system’s fundamental functionality, and the execution of any one-time initializations.

Now that we have reached the seventh stage of this process, we will talk about systemd, which is a system that has replaced INIT in modern Linux systems.

Stage 7: systemd

It is a system and service manager in Linux that is responsible for initialising and managing system services and processes during the boot process and when the system is running. It performs these tasks both while the system is booting up and afterwards. It was conceived with the intention of supplanting the standard System V initialization system, known as SysV INIT, which is utilised by the majority of Linux variants.

Systemd is presently the initialization system that is set as the default in many Linux distributions. It is well-known for its swiftness, performance, and dependability. It offers a broad variety of capabilities and improvements in comparison to SysV INIT, such as the ability to start several services in simultaneously, activate services on demand, and handle dependencies in a more centralised manner.

We have now completed the final step of the boot procedure in Linux, which was attained when we reached this point. It is a component of Linux that is accountable for the carrying out of the commands that have been given.

Stage 8: RUNLEVEL

A mode of operation known as runlevel is responsible for determining the state of the system as well as which services are launched or halted in Linux. Each run level is associated with a distinct level of system capability, such as the single-user mode, the multi-user mode, or the graphical mode, respectively.

During the booting phase of Linux, runlevels are responsible for controlling the processes. On operating systems that are based on Linux or Unix, a pre-set operating state is referred to as a runlevel.

The range of run levels goes from 0 all the way up to 6. Runlevels determine, once the operating system has finished booting up, which applications are allowed to function. After booting, the system will be in the state that is specified by the runlevel.

The Linux Operating System includes the following six runlevels:

run level 0: This will cause the computer to power off.

run level 1: Rescue shell procedure gets started

run level 2 allows for multi-user mode but does not support networking.

Run level 3 sets up the system to function as a command-based multi-user environment. Run level 4 allows users to design their own run levels. Run level 5 generates a graphical multi-user interface by making use of network services.

level 6 restarts the machine and begins the run.

Conclusion

The boot process in Linux is an important component that is responsible for starting the system and getting it ready to be used.

Whether troubleshooting, optimising, or modifying Linux systems, having a solid understanding of the boot process is absolutely necessary.

The initialization of the firmware is the first step in the boot process, which is followed by the loading of the operating system and the beginning of the user-space operations.

POST, BIOS/UEFI, MBR, GRUB, KERNEL, INIT, SYSTEMD, and RUNLEVEL are the eight phases of the boot process. The final stage is RUNLEVEL. Each stage has its own unique significance as well as its own set of functions.

When a computer is powered on, the process is kicked off, and the first stage is the Power-On Self-Test (POST), which is performed by the hardware. This is followed by the MBR, which is followed by BIOS or UEFI, and so on.

The Linux kernel is the most important part of the Linux operating system. It is in charge of managing the system’s resources and delivering the essential services that are required to execute programmes and processes.

In general, the boot process in Linux is extremely important for an operating system that is stable, safe, and versatile.

--

--