Linux Command Reference ยท Concepts
The Linux boot process
Follow the Linux boot process step by step: firmware, bootloader, kernel, initramfs, systemd targets and login, plus where to look when a boot goes wrong.
Booting turns a powered-off machine into a running system. It is a relay race: each stage does just enough work to load the next one, from firmware that knows nothing about Linux, through a bootloader and the kernel, to the first user-space process that starts everything else.
Understanding the stages tells you where to look when a machine will not start. A black screen before any menu is a firmware problem, a missing menu is the bootloader, a panic about the root filesystem is the kernel or initramfs, and a login that never appears is usually a service or target in systemd.
cat /proc/cmdline # options the kernel was started with systemd-analyze # time spent in firmware, loader, kernel, userspace journalctl -b # messages from this boot
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
The stages
1. Firmware (BIOS or UEFI)
When power arrives, the CPU runs code stored on the motherboard. This firmware performs the power-on self-test, sets up basic hardware and finds something bootable. Classic BIOS reads the first 512 bytes of a disk (the Master Boot Record). UEFI reads a file from a small FAT-formatted EFI System Partition (ESP), usually mounted at /boot/efi, using entries stored in the firmware's NVRAM. UEFI can also verify signatures (Secure Boot).
2. Bootloader
The bootloader (GRUB, systemd-boot, rEFInd and others) lets you choose a kernel, edit its command line, and loads two files into memory: the kernel image (vmlinuz-*) and the initramfs (initrd.img-* or initramfs-*.img), both normally in /boot. GRUB's configuration is generated into /boot/grub/grub.cfg; you edit /etc/default/grub and run the update command for your distribution instead.
3. Kernel
The kernel decompresses itself, detects the CPU and memory, initializes core drivers and mounts the initramfs as a temporary root. Messages from this stage are in dmesg. Options on the kernel command line (root=, ro, quiet, init=, systemd.unit=) change its behavior. See dmesg.
4. initramfs
The initramfs is a small compressed archive containing just enough tools and drivers to find the real root filesystem: storage drivers, RAID or LVM assembly, disk decryption and filesystem modules. When the real root is ready, the system switches to it and runs the real init. If this stage fails you land in an emergency shell with a message about being unable to find the root device.
5. Init (PID 1)
The kernel starts the first user-space process with PID 1, normally /sbin/init, which on most distributions is a link to systemd. PID 1 mounts filesystems from /etc/fstab, starts services and brings the machine to a target. If PID 1 ever exits, the kernel panics.
6. Services and targets
systemd reads unit files and starts what the default target needs, in parallel where dependencies allow. multi-user.target gives a text system; graphical.target adds a display manager. Older SysV systems used numbered runlevels instead (0 halt, 1 single-user, 3 multi-user, 5 graphical, 6 reboot). See systemctl and targets.
7. Login
A getty on each virtual console, or a display manager for graphical sessions, asks for credentials. PAM checks them, and your login shell starts and reads its startup files. See Startup files.
flowchart LR
A["Firmware<br/>BIOS or UEFI"] --> B[Bootloader]
B --> C["Kernel + initramfs"]
C --> D["PID 1<br/>systemd"]
D --> E["Targets<br/>and services"]
E --> F["getty or display manager<br/>login"]The boot sequence from power-on to a login prompt.
Usage notes
- Read the boot log.
journalctl -bshows the current boot,journalctl -b -1the previous one (if the journal is persistent).dmesgshows only kernel messages. - Find slow boots.
systemd-analyze blamelists units by start time, andsystemd-analyze critical-chainshows the path that actually delayed boot. Seesystemd-analyze. - Rescue mode. Adding
systemd.unit=rescue.target(orsingle) to the kernel command line in the bootloader menu gives a minimal root shell for repairs.init=/bin/bashskips init entirely, useful for resetting a lost password. - Never edit
grub.cfgby hand. It is overwritten on updates; change/etc/default/gruband regenerate. - After a kernel update the initramfs is rebuilt automatically. If you change disk encryption or storage settings, rebuild it yourself (
update-initramfs -uon Debian-based systems,dracut -fon Red Hat-based ones). - Containers and WSL do not go through this process; they start a process directly under an existing kernel. See Namespaces and cgroups.
- The runner on this site is a container, so most boot facts above are read-only for you here.