Chapter 2.9 - Boot Process
Learning Objectives
By the end of this chapter, you will be able to:
- Understand the Linux boot process
- Explain the boot steps
- Identify the components (BIOS/UEFI, bootloader, kernel, init)
- Troubleshoot boot issues
Boot Overview
The Linux boot follows a well-defined sequence:
Boot Steps
1. BIOS/UEFI
Role: Basic hardware initialization
Actions:
- Hardware check (POST)
- Device detection
- Loading the bootloader from disk
Difference BIOS vs UEFI:
- BIOS: Old, limitations (2TB disk)
- UEFI: Modern, supports GPT, Secure Boot
2. Bootloader (GRUB)
Role: Load the kernel
Actions:
- Displays the boot menu
- Loads the kernel and initramfs
- Passes parameters to the kernel
Files:
/boot/grub/grub.cfg(configuration)/boot/vmlinuz-*(kernel)/boot/initrd.img-*(initramfs)
3. Linux Kernel
Role: System initialization
Actions:
- Hardware detection and initialization
- Mounting the root filesystem
- Starting the init process
Kernel parameters:
root=: Root partitionquiet: Fewer messagessplash: Boot screen
4. Init/systemd (PID 1)
Role: First user process
Actions:
- Mounting filesystems
- Starting services
- Transitioning to target runlevel
systemd sequence:
default.targetactivated- Required services started
- System ready
Initramfs
initramfs (Initial RAM File System) is a temporary filesystem in memory:
Roles:
- Load necessary kernel modules
- Detect hardware
- Mount the root filesystem
- Prepare the environment for init
Detailed systemd Sequence
Troubleshooting Boot
Common Issues
1. Corrupted bootloader:
# Repair GRUB
sudo grub-install /dev/sda
sudo update-grub
2. Kernel does not start:
- Check kernel parameters
- Try a previous kernel
- Check logs:
dmesg
3. Missing initramfs:
# Regenerate initramfs
sudo update-initramfs -u
4. Corrupted filesystem:
# Rescue mode
fsck /dev/sda1
Useful Commands
# View boot messages
dmesg
journalctl -b
# View boot time
systemd-analyze
systemd-analyze blame
# View dependency chain
systemd-analyze critical-chain
# View services slowing down boot
systemd-analyze blame | head -10
Summary
In this chapter, you learned:
Boot Sequence: BIOS → GRUB → Kernel → initramfs → systemd
BIOS/UEFI: Hardware initialization
GRUB: Bootloader, loads the kernel
Kernel: Initializes the system
initramfs: Temporary filesystem in memory
systemd: First process, starts services
Troubleshooting: GRUB repair, logs, fsck
Next Steps
Chapter 2.10: Inter-Process Communication
Module 3: Filesystem
Chapter created on: December 2024