Javatpoint Logo
Javatpoint Logo

Linux Boot Process Step-by-Step Explained

When we click the power button of our system, several processes are executing in the background. It's very important to understand the booting process to learn the working of an operating system. It's a must to understand how the Linux kernel boots to resolve the booting error. It is a very curious topic to know, so let's begin with the basics.

A clear boot read method is discussed as follows:

Linux Boot Process Stages:

  • The boot microcode or BIOS of the machine hundreds and executes a boot loader.
  • The boot loader catches the kernel image over the disk and ships it into memory to begin the computer.
  • The kernel boots the devices and drivers.
  • The kernel mounts the common filesystem.
  • The kernel begins a program called init with a zero method ID.
  • Init configures the system processes remainder in motion.
  • Init begins a method allowing us to log in for some purpose, typically at the close or top to the head of the boot order.

Start-up Message

Classic UNIX operating system manufacturers many diagnostic messages on boot that tell us about the boot method. Initially, the messages recover from the kernel and processes that init begins. Although, these messages are not consistent or pretty, and they are not even informative terribly in some cases. Hardware enhancements additionally have led to the kernel to begin a lot quicker as compared to before messages flash by accordingly quickly; it might be tough to see what is happening. Almost all current Linux distributions do the best for covering boot medical specialty with different filter and splash screen varieties to distract us, whereas the system begins as a result.

Kernel Boot and Initialization Options

Linux Boot Process Step-by-Step Explained
  • CPU examination
  • Device bus discovery
  • Memory examination
  • Devices discovery
  • Root filesystem mount
  • Auxiliary kernel system start-up
  • Userspace begin

The CPU examination and memory examination are not so exceptional. Although, when the kernel provokes devices, the dependencies question comes. For instance, the disk device drivers may depend on the SCSI system and bus support. We would not need to be worried about the dependencies in general, except that a few essential parts are loadable kernel modules rather than a part of almost all kernels.

Kernel Parameters

The Linux Kernel receives a set of text-based kernel parameters having a few further system details when it starts. The parameters describe several alternative types of behaviors, such as a diagnostic result of the kernel concern to device driver-specific and manufacturer selections. The Ro parameter guides the kernel for mounting the common filesystem in the read-only mode under the user area starts. This general read-only mode guarantees that fsck can inspect the basis filesystem safely before trying to do anything serious. The boot-up technique remounts the basis filesystem in the read-write mode during the check.

Tasks of Boot Loade

  • Choose from multiple kernels.
  • Shift between groups of kernel parameters.
  • Supports booting distinct OSes.

Significantly, bootloaders became more advanced since the Linux kernel origin, with options such as menu systems and command-line history. Although, a common want has been perpetually flexibility in parameter choice and kernel image. One brilliant development is that a few wants have diminished.

For instance, as an outcome of we can perform recovery boot or associate emergency from a USB device, we seldom require to be worried about getting into kernel parameters manually or going into the single-user mode. Modern bootloaders supply more power than ever, which may notably be handy if we are creating custom kernels or want to tweak parameters.

Overview of Boot Loader

  • GRUB: It is a normal near-universal under Linux systems, along with UEFI and BIOS/MBR versions.
  • SYSLINUX: SYSLINUX may be managed to execute from several alternative filesystem styles.
  • LILO: It is one of the main Linux bootloaders. ELILO can be a UEFI version.
  • LOADLIN: It boots the kernel through DOS.
  • System-boot: It is a straightforward boot manager of UEFI.
  • coreboot: It is a good replacement for the system BIOS which will demonstrate the kernel.
  • EFI Linux: It is a UEFI boot loader specified to work as a model and prefers different boot loaders of UEFI.
  • Linux Kernel EFISTUB: It is a kernel plug-in used to directly load the kernel from related UEFI/EDI System Partition.

GRUB Work and Introduction

GRUB is an acronym for Grand Unified Boot Loader. One of the most vital capabilities of GRUB is filesystem navigation that lets straightforward configuration choice and kernel image.

  • The GRUB code hundreds.
  • The BIOS hundreds and runs it upon searching the boot code. Often, it is wherever GRUB starts.
  • The code initializes. Currently, GRUB will access filesystems and disks at now.
  • GRUB recognizes its boot partition and several configurations there.
  • GRUB provides the user the opportunity to differentiate the configuration.
  • GRUB runs the configuration after a user action or timeout.
  • In the course of configuration execution, GRUB may load further code in the boot partition. Also, several modules are preloaded.
  • To run and load the kernel, GRUB runs boot commands.

Linux Boot Process Steps in Detail

An OS is low-level software that handles resources, gives basic services to other software, and controls peripherals. We will explain each boot process in detail:

Linux Boot Process Step-by-Step Explained
  • BIOS
    BIOS is an acronym for Basic Input/Output System. In other words, the BIOS can load and run the MBR (Master Boot Record) boot loader. When we first turn on our system, the BIOS first implements a few integrity checks of the SSD or HDD.
    After that, the BIOS finds, loads, and runs the boot loader function, which can be detected in the MBR. Sometimes, the MBR is on a CD-ROM or USB stick, like with a live Linux installation. Then, the boot loader function is loaded into memory, and BIOS provides system control to it once it is detected.
  • MBR
    MBR is an acronym for Master Boot Record and is liable to load and run the GRUB boot loader. MBR is placed in the first bootable disk sector, which is generally /dev/sda, relying on our hardware. Also, the MBR includes details of GRUB, or LILO is an older system.
  • GRUB
    GRUB is sometimes known as GNU GRUB, which stands for GNU GRand Unified Bootloader. It is the classic bootloader for almost all the latest Linux systems. The splash screen of GRUB is often the initial thing we see when we boot our system. It contains a general menu where we can choose some portions.
    We can use our keyboard to choose the one we wish our system to initiate with if we have multiple installed kernel images. The latest kernel image is chosen by default. The splash screen will delay for some seconds for us to choose options. It will load the kernel image (default) if we don't. In several systems, we can see the GRUB configuration file at /etc/grub/conf or /boot/grub/grub.conf.
  • Kernel
    Often, the kernel is called the code of an operating system. It contained full control on everything in our system. In this boot process stage, the kernel mounts the base file system that was chosen that is set up in the file, i.e., grub.conf. Then, it runs the /sbin/init function, which is always the initial function to be run. We can confirm it with its PID (process id), which should be always 1. Then, the kernel creates a temporary base file system with the help of initrd (Initial RAM Disk) until the actual file system is mounted.
  • Init
    At this stage, our system runs runlevel programs. It would find an init file, generally detected at /etc/inittab, to determine the run level of Linux. Modern Linux systems utilize systemd to select a run level rather. Then, systemd will start running runlevel programs.
    There are six run labels in the Linux operating system:
    • 0- halt
    • 1- single-user mode
    • 2- multiuser, without NFS
    • 3- Full multiuser mode
    • 4- unused
    • 5- X11
    • 6- reboot

We can check the configuration default run level of our system by running the following command:

  • Runlevel programs
    We can see distinct services getting started depending on which distribution of Linux we have installed. They are called runlevel programs and are run from distinct directories depending on our run level. All six runlevels mentioned above contain its directories:
    • Run level 0- /etc/rc0.d/
    • Run level 1- /etc/rc1.d/
    • Run level 2- /etc/rc2.d/
    • Run level 3- /etc/rc3.d/
    • Run level 4- /etc/rc4.d/
    • Run level 5- /etc/rc5.d/
    • Run level 6- /etc/rc6.d/

Important: The exact location of the directories differentiates from one distribution to another.

If we look in distinct run level directories, we will find programs that begin with either a "K" or "S" for kill and startup, respectively. These start up programs are run at the time of the system startup and kill several programs at the time of shutdown.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA