Expert · Boot, recovery and containers · topic 39 of 57 · 30 min
The boot process, step by step
Explanation
Why learn the boot order?
When a server does not come up, the first question is "how far did it get?" Each stage hands over to the next, and each has its own typical failures and fixes. If you know the stages, you can look at the screen and say "GRUB is fine, the kernel started, but systemd is stuck mounting /data", which is half of the fix.
The stages
- Firmware: BIOS (older) or UEFI (modern) tests the hardware and finds a boot device. UEFI reads boot entries from NVRAM and runs a program from the EFI system partition (/boot/efi).
- Boot loader: GRUB2 shows the menu, reads its config, and loads the chosen kernel and its initramfs into memory, passing kernel arguments (the command line).
- Kernel: starts, detects hardware, and unpacks the initramfs into memory as a temporary root file system.
- initramfs: a small image built by dracut that contains just enough drivers and tools (storage, LVM, RAID, encryption) to find and mount the real root file system on /sysroot. Then it switches root to it.
- systemd: PID 1 on the real root. It reads /etc/fstab and unit files and starts units in parallel until default.target (multi-user or graphical) is reached. Then you see a login prompt.
$ ls /boot
config-5.14.0-427.13.1.el9_4.x86_64 loader
efi symvers-5.14.0-427.13.1.el9_4.x86_64.gz
grub2 System.map-5.14.0-427.13.1.el9_4.x86_64
initramfs-5.14.0-427.13.1.el9_4.x86_64.img vmlinuz-5.14.0-427.13.1.el9_4.x86_64
$ cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt2)/vmlinuz-5.14.0-427.13.1.el9_4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quietHow long did each step take?
$ systemd-analyze
Startup finished in 1.912s (kernel) + 2.410s (initrd) + 9.884s (userspace) = 14.207s
multi-user.target reached after 9.861s in userspace.
$ systemd-analyze blame | head -3
5.102s NetworkManager-wait-online.service
1.344s kdump.service
611ms dnf-makecache.service
$ journalctl -b -p warning --no-pager | head # warnings from this bootWhere boots fail, and what it looks like
| Stage | Symptom | Typical cause |
|---|---|---|
| Firmware | No boot device found | Wrong boot order, failed disk |
| GRUB | grub> or grub rescue> prompt | Damaged GRUB files or config |
| Kernel / initramfs | Kernel panic, or a dracut emergency shell | Missing driver in initramfs, wrong root= argument |
| systemd | Emergency mode, "Give root password for maintenance" | Bad /etc/fstab line, missing disk |
| Login | Boots fine but you cannot log in | Lost root password (next lessons) |
If the initramfs is broken, for example after a driver change, you can rebuild it for the running kernel with dracut -f, or boot an older kernel from the GRUB menu first.
Common mistakes
- Deleting "old" kernels from /boot by hand to free space. Use dnf remove kernel-core-<version> instead, so GRUB entries stay consistent.
- Ignoring the "rhgb quiet" arguments when debugging: remove them for one boot (press e in GRUB) to see all messages on screen.
- Assuming a slow boot is hardware. systemd-analyze blame usually shows one service, often a network wait, that holds everything up.
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
The boot process, step by step · 1/6
Booting is a relay race with five runners.
Prefer a video by a teacher? Find free videos on “linux boot process explained bios uefi grub2 initramfs systemd” on YouTube ↗
In real life: A slow-booting bank branch server
A bank branch server in Patna took four minutes to boot after every power cut, delaying counter opening. systemd-analyze blame showed NetworkManager-wait-online taking almost the whole time, because a second, unplugged network card was set to wait for DHCP. The admin set that connection to not autoconnect, and boot time fell to 25 seconds.
$ systemd-analyze blame | head -2
3min 2.412s NetworkManager-wait-online.service
1.388s kdump.service
# nmcli con mod "Wired connection 2" connection.autoconnect noPractice (0/3 done)
Which component loads the kernel and the initramfs into memory?
The boot stops with "Give root password for maintenance" after a "Dependency failed for /data" message. Which stage failed?
Write slowest(blame_text, n) for "systemd-analyze blame" output. Each line is a time and a unit, like "5.102s NetworkManager-wait-online.service", "611ms dnf-makecache.service" or "3min 2.412s foo.service". Convert each time to seconds (min = 60 s, s, ms = 0.001 s) and return the names of the n slowest units, slowest first.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- GRUB2, kernel arguments and the default kernelBoot, recovery and containers · same module
- Recovering a lost root passwordBoot, recovery and containers · same module
- Containers with Podman: images, run, ports and logsBoot, recovery and containers · same module
- Processes, signals and systemd servicesDevOps: Git, Docker, Kubernetes and CI/CD · Linux for DevOps
- SELinux: what it is and its modesSELinux and SSH
- Processes: ps, top and jobsProcesses, services and logs
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What is the job of the initramfs?
Answer: Provide drivers and tools to find and mount the real root file system
It is a temporary root used early in boot.
Which tool builds the initramfs on RHEL?
Answer: dracut
dracut builds initramfs images.
Which file shows the kernel arguments of the current boot?
Answer: /proc/cmdline
/proc/cmdline.
Which command lists services by how long they took to start?
Answer: systemd-analyze blame
blame sorts units by start-up time.
Which command shows the kernel that boots by default?Related
Answer: grubby --default-kernel
uname -r shows the running kernel, which may differ.
Which command shows the logs of the service orders-api and keeps following new lines?Related
Answer: journalctl -u orders-api -f
journalctl -u selects the unit and -f follows new entries.
Which target is the usual default on a RHEL server?Related
Answer: multi-user.target
Servers normally boot to multi-user.target.
Which kernel argument replaces systemd with a bash shell for one boot?Related
Answer: init=/bin/bash
init= sets the first program the kernel runs.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 4 more topics in “Boot, recovery and containers” before its exam: GRUB2, kernel arguments and the default kernel, Recovering a lost root password, Containers with Podman: images, run, ports and logs, Persistent storage and containers as systemd services.
- Module 8 exam: Boot, recovery and containers · 13 questions · 25 min, without help. 5 topics of this module still to finish first.
- Then the next module, Ansible fundamentals. 57 topics left in the course before the final exam.