Each time you power on your Linux PC, it goes through a series of steps before the login screen, which asks for your username or password, finally appears. Each Linux distribution goes through 4 different steps in a typical boot process.
In this tutorial we will explain the different steps of the Linux operating system, from switching on to logging on. Note that only the GRUB2 and systemd init bootloaders are covered in this manual as they are currently used by the vast majority of modern Linux distributions.
The download process consists of the following 4 steps, which we will explain in more detail:
- BIOS Integrity Check (POST)
- Charger (GRUB2)
- Basic initialization
- Starting up the system, older of all processes
1. BIOS Integrity check (POST)
The boot process is usually started when the user presses the power button – if the PC is already turned off – or reboots the system, either from the GUI or from the command line.
When the Linux system is switched on, the Basic Input/Output System (BIOS) starts up and performs the power-on self-test (POST). This is an integrity check that performs various diagnostic tests.
The POST monitors the hardware performance of components such as hard and solid state drives, keyboards, RAM, USB ports and other hardware. If a hardware device is not detected or if one of the devices is faulty, such as a damaged hard drive or solid-state drive, an error message appears that encourages you to take action.
In some cases, especially when the RAM module is not available, an acoustic alarm will sound. However, if the intended equipment is available and functioning as intended, the start-up process continues to the next phase.
2. Charger (GRUB2)
Once the POST is completed and the coast is clear, the BIOS checks the MBR (Master Boot Record) for boot and partition information.
The MBR is a 512-byte code located on the first sector of your hard drive, usually /dev/sda or /dev/hda, depending on the architecture of your hard drive. Note, however, that the MBR can sometimes be placed on a USB or Linux Live DVD installation.
Linux has 3 basic types of bootloaders: LILO, GRUB and GRUB2. The GRUB2 bootloader is the last and most important loader of the modern Linux distributions and informs us about our decision to give up the other two, which have become obsolete over time.
GRUB2 stands for GRand Unified Bootloader Version 2. As soon as the BIOS recognizes the grub2 boat loader, it starts up and loads it into RAM.
In the grub2 menu there are things you can do. It allows you to select the version of the Linux kernel you want to use. If you have updated the system several times, you can see the different versions of the kernel. You can also change some kernel parameters by pressing a hotkey.
Choosing the kernel version
In addition, for double boot settings when more than one operating system is installed, you can select the system to boot from the Grub menu. The configuration file for grub2 is /boot/grub2/grub2.cfg. The main task of GRUB is to load the Linux kernel into memory.
3. Core initialization
The kernel is the heart of every Linux system. It connects the PC hardware to the underlying processes. The kernel controls all processes in the Linux system. As soon as the selected Linux kernel is loaded by the bootloader, it must extract itself from the compressed version before a task can be executed. After self-extracting, the selected kernel mounts the root file system and initializes the /sbin/init program, usually called init.
Core initialization process
Init is always the first program to be run and assigned a process identification or PID 1. This is an initialization process that creates different daemons and assembles all the partitions specified in /etc/fstab.
The kernel then attaches the initial RAM disk (initrd), which is the temporary root file system until the actual root file system is attached. All kernels are in /boot with the original RAM disk image.
4.1 Launching system
The kernel finally loads Systemd, which is a replacement for the old SysV init. Systemd is the mother of all Linux processes and takes care of, among other things, the installation of file systems, starting and stopping services, to name but a few.
Systemd uses /etc/systemd/system/default.target to determine which state or target Linux should boot to.
- For a desktop workstation (with GUI), the default setpoint is 5, which is the starting level 5 for the old SystemV init.
- For the server, the default target is multiuser.target, which corresponds to execution level 3 in SysV init.
Here is a breakdown of the objectives of the system:
- poweroff.target (level 0) : Turn the system off or shut it down.
- rescue.target (level 1) : Launch a salvage session.
- Multi-user target (execution level 2,3,4) : Configures the system as a non-graphical multi-user system (console).
- graphic.target (execution level 5) : Configure your system to use a multi-user GUI with network services.
- reboot.target (runlevel 6) : System reboot.
To check the current target in your system, execute the command:
$ systemctl get-default
Check output level
You can switch from one destination to another by executing the following command on the terminal:
For example, init 3 puts the system in a non-graphical state.
The init 6 controller restarts the system and init 0 switches off the power to the system. Don’t forget to call the Sudo command if you want to switch to these two destinations.
The boot process is completed after systemd has loaded all daemons and set a target or runlevel value. At this point you will be asked to enter your username and password, after which you will be able to access your Linux system.
If you like what we do here at TecMint, you should think:.
TecMint is the fastest growing and most reliable community site for all articles, guides and books about Linux on the web. Millions of people visit TecMint! to find or consult thousands of published articles that are accessible to everyone for FREE.
If you like what you read, consider buying us a coffee (or 2) as a thank you.
Thank you for your continued support.
boot process in linux 7,linux boot process interview questions,linux boot process systemd,linux booting process step by step pdf,embedded linux boot process,linux boot process crybit,os boot process windows,which of the following sends a sigterm,steps of booting process in windows,/boot linux partition,linux boot process medium,linux boot process mnemonic,smps in booting,arm linux boot process step by step,what is the final stage of linux boot process,boot process in linux step by step,booting process in linux 7,what is the final stage of linux boot process mcq,booting process in linux geeksforgeeks,grub stages in linux