Understanding the Linux Boot Process from BIOS to Shell
Jul 29, 2025 am 02:24 AMBIOS/UEFI performs POST, selects boot device, and loads bootloader—BIOS reads MBR while UEFI uses EFI System Partition. 2. Bootloader (GRUB) loads kernel and initramfs into memory, allowing kernel selection or parameter editing before execution. 3. Kernel initializes hardware, mounts initramfs as temporary root, runs its /init script to prepare storage, then switches to real root filesystem and starts systemd. 4. systemd, as PID 1, reads default target and starts services in parallel including filesystem mounting, networking, and login managers using target-based units instead of runlevels. 5. A getty process provides login prompt, authentication proceeds via PAM, and upon success, user’s shell launches with configuration files sourced, delivering an interactive prompt—this sequence from firmware to shell enables effective troubleshooting and system understanding.
When you press the power button on a Linux machine, a carefully orchestrated sequence of events takes place before you get a shell prompt. Understanding the Linux boot process—from BIOS to shell—helps with troubleshooting, system customization, and gaining deeper insight into how Linux works under the hood. Here's a breakdown of each stage, explained clearly and practically.

1. BIOS/UEFI: The First Code to Run
When the computer powers on, the first software to run is the BIOS (Basic Input/Output System) or its modern replacement, UEFI (Unified Extensible Firmware Interface).
- Power-on self-test (POST): The BIOS checks hardware components (RAM, CPU, peripherals) to ensure they’re functional.
- Boot device selection: BIOS/UEFI looks for a bootable device (hard drive, USB, CD-ROM) based on the configured boot order.
- Loads the MBR (Master Boot Record): On BIOS systems, it reads the first 512 bytes from the bootable disk (the MBR), which contains the bootloader and the partition table.
?? UEFI systems skip the MBR and instead look for a special EFI System Partition (ESP) containing bootloader files in a FAT32-formatted partition.
![]()
Once the bootloader code is loaded into memory, control is passed to it, and the BIOS/UEFI job is done.
2. Bootloader: GRUB Takes Over
The most common bootloader in Linux is GRUB (Grand Unified Bootloader), specifically GRUB 2 on modern systems.

At this stage:
- GRUB displays a menu (if multiple OS or kernel versions are installed).
- You can choose a kernel or edit boot parameters (e.g., to enter recovery mode).
- GRUB locates and loads two critical components into memory:
- The Linux kernel image (usually
/boot/vmlinuz-x.x.x
) - The initial RAM disk (initramfs), which contains essential drivers and tools needed to mount the real root filesystem.
- The Linux kernel image (usually
? Why initramfs? Because the kernel may not have built-in drivers for your storage device (e.g., RAID, LVM, encrypted drives). Initramfs acts as a temporary root filesystem to bridge the gap.
After loading both, GRUB executes the kernel and passes control to it.
3. Kernel Initialization: Setting Up the System
The Linux kernel starts executing and performs several low-level setup tasks:
- Hardware detection and driver loading: Scans and configures hardware using device trees or ACPI tables.
- Mounts the initramfs: Uses it as a temporary root filesystem.
- Executes /init (inside initramfs): This script does whatever is needed to access the real root filesystem—unlocking encrypted volumes, loading modules, activating LVM/RAID.
-
Finds and mounts the real root filesystem: Once the necessary drivers are loaded, the kernel switches to the actual root (
/
) partition. -
Executes the first user-space process: Traditionally
init
, but now usually systemd on most distributions.
? The "switch_root" command is used to transition from initramfs to the real root filesystem, then the init process starts.
4. init and systemd: Starting User-Space Services
This is where user-space programs begin to run. The first process (PID 1) is responsible for starting all other processes.
- systemd has largely replaced older init systems (SysVinit, Upstart).
- It reads configuration from
/etc/systemd/system/default.target
(oftengraphical.target
ormulti-user.target
). - systemd starts essential services in parallel:
- Mounting filesystems (via
/etc/fstab
) - Starting networking
- Launching login managers (like GDM) or getty terminals
- Running startup scripts and daemons
- Mounting filesystems (via
? systemd uses "targets" instead of traditional runlevels. For example:
multi-user.target
≈ runlevel 3 (text mode)graphical.target
≈ runlevel 5 (GUI mode)
You can check the current target with:
systemctl get-default
5. Login Prompt and Shell
Once systemd finishes initializing the selected target:
- A getty process starts on a terminal (e.g., tty1), displaying a login prompt.
- When you enter your username and password, the system authenticates you via PAM (Pluggable Authentication Modules).
- Upon successful login, your shell (e.g., Bash, Zsh) is launched, reading configuration files like
~/.bashrc
or/etc/profile
.
At this point, you have an interactive shell prompt and can begin using the system.
?? If you're using a desktop environment, a display manager (like GDM or LightDM) may launch a graphical session instead of a text login.
Summary of the Boot Flow
Here’s the complete sequence in order:
- BIOS/UEFI → runs POST, finds boot device, loads bootloader
- Bootloader (GRUB) → loads kernel initramfs
- Kernel → initializes hardware, mounts initramfs, locates real root, switches to it
- init/systemd → starts services and essential processes
- Login/Shell → user logs in, gets a shell prompt
Understanding this flow helps when debugging boot issues—like a stuck GRUB menu, kernel panic, or failing services. Tools like dmesg
, journalctl
, and GRUB rescue mode become much more useful when you know what’s supposed to happen at each stage.
Basically, from BIOS to shell, Linux follows a chain of responsibility—each stage prepares the next. It’s not magic, just well-orchestrated code.
The above is the detailed content of Understanding the Linux Boot Process from BIOS to Shell. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Ventoy is a USB boot tool that can directly boot ISO/WIM/IMG/VHD(x)/EFI and other types of files in the USB flash drive. It is very easy to use. Laptops have secure boot turned on by default. If they are not turned off or cannot be turned off, they cannot be booted from a USB device. Ventoy also supports secure boot. The principle is to inject a GRUB installation certificate into the current computer. As long as your computer After being injected once, any USB disk PE booted based on grub can pass. The official description of Ventoy is a GIF image. The playback speed is too fast and you may not be able to remember it. The editor has divided the GIF image to make it easier to understand. Ventoy secure boot has EnrollKey and Enro

I repaired an Acer laptop and had to turn off secure boot when entering PE. I recorded how to turn off secure boot and remove the password from Bios. Turn on the computer and when the screen is not on, keep pressing the F2 key to enter the BIOS. On Acer laptops, turn off Secure Boot and press the arrow keys to switch to Boot. If SecureBoot is gray and unclickable, switch to the Security page, select SetSupervisorPassword and press Enter to set the password. Then switch to Boot, SecureBoot can be selected as Disabled, and press F10 to save. Modify and clear the BIOS password on your Acer notebook. Switch to the Security menu and select SetSupervisorPasswo.

You may have had to shut down the system at least once due to overheating, or it may have shut down on its own. We've all been there. But what if you could manually control the fan in Windows 11 for optimal results? Most people would be excited by the idea of ??manually controlling fan speed, but it's not that straightforward. You have to find the right app that is both compatible and offers the option to not only view but also control the speed. In the following sections, we'll list various ways to obtain the right tools from OEM or third-party sources, as well as fan control in Windows 11 via the BIOS. What should I know about fan control in Windows 11? Although the built-in settings should be able to

Are you receiving warnings about your computer's graphics card memory when using graphics-intensive software or a new game? To prevent these issues and run resource-intensive games or applications smoothly, you need a graphics card and RAM that meet its specifications. Whether your computer is old or has graphics issues for no apparent reason, you can fix the problem by adjusting a few parameters in certain situations. The method we will cover in this article is to increase VRAM in Windows 11, which is one of the most effective ways to get the most out of your computer, especially your graphics card. But before we get into it, let's see what VRAM is and what it does. So, without further ado, let’s get started. Why increase video memory? What aspects of gaming and graphics software do we need to point out?

The operating system looks much better than its predecessor and has gamer-oriented features like AutoHDR and DirectStorage, but Valorant players have had some trouble launching the game. This is not the first issue faced by gamers earlier, Valorant not opening on Windows 11 is another issue plaguing them but we have covered the ways to fix it. Now it seems that Valorant players who switched to Windows 11 are facing issues due to Secure Boot and TPM2.0 services, which causes the game menu to only show an exit option while running. Many users are getting the VAN1067 error, but it shouldn't be a cause for alarm

Secure Boot is a security feature integrated into most current hardware and UEFI firmware that provides a secure environment for booting any Windows system. This utility prevents malware from hijacking the device during the boot process. This feature works like a security door, which can be tricky when you enable Secure Boot for Windows 11 in user mode. If your system uses an older boot framework and Secure Boot is not enabled, the Secure Boot state is not supported. Even if your motherboard includes a secure boot option. Let's look at some possible solutions. This solution perfectly solves the problem of Secure Boot not supported on all devices including HP, Dell and Lenovo laptops or ASRock and Gyg

How do you set up a USB drive if your computer is a Dell laptop? Many friends have found that Dell laptops will not display the USB disk option by pressing the boot hotkey, so they need to enter the BIOS to set up the USB disk boot, so what if they don't know how to operate it? Now follow the editor’s steps to demonstrate how to set up a USB flash drive on a Dell laptop. Many friends assemble Dell computers, but don't know how to use the USB boot tool after entering the USBPE interface. Many friends don't know that they need to enter the BIOS interface to set up USB boot, so pressing the boot hotkey will not appear. what should we do? Let’s see how Dell sets up USB boot! Set up Dell laptop to reinstall system bootable from USB disk

After the computer is turned on, it prompts The system has posted in safe mode. You can set it in the BIOS to ignore the F1 error. Although it does not prompt, it directly enters the BIOS when it is turned on. Sometimes F1 is useless every time it is turned on. Then you need to restart the BIOS, and then exit the BIOS to enter the system. . thesystemhaspostedinsafemode=The system is in safe mode. This problem is relatively common on ASUS motherboards. As long as you turn off the XMP of the memory and adjust the memory frequency back to normal, you can boot normally without the thesystemhaspostedinsafemode error. Updating the latest motherboard BIOS should be OK.
