PID 1systemdjournaldnetworksshgetty$ ps -p 1 -o comm=systemd$ cat /proc/cmdline… root=/dev/sda2 roLinux kernelmemory (RAM)loaderemptykernelemptyinitramfsemptymenuentry 'Ubuntu' {linux /boot/vmlinuz root=/dev/sda2 roinitrd /boot/initrd.img}/boot/grub/grub.cfgUEFICPUsda1 · EFI/sda2 · root
Front: hardware and disk. Middle: memory (RAM) and the Linux kernel. Back: user spaceRose baton: the program running the CPU right nowEnvelopes: files copied from the disk into memory, and the mount of the real rootFront: the main board (power button, firmware chip, CPU) and the disk with its EFI and root partitions. Behind them: three memory slots and the grub.cfg card, then the Linux kernel, and at the back user space with systemd, its services and a terminal. The rose baton marks the program running the CPU: firmware, then GRUB, then the kernel, then /init from the initramfs, then systemd. Envelopes carry files from the disk into memory. The machine is an example: an Ubuntu-style PC with UEFI, GRUB, the kernel /boot/vmlinuz and the root file system on /dev/sda2. A real grub.cfg is longer and names the disk by UUID; /proc/cmdline also starts with BOOT_IMAGE=/boot/vmlinuz, cut to "…" on the card.

Power on

  1. Press the power button. The CPU knows nothing about disks or Linux yet. It starts running the firmware, a program kept in a flash chip on the main board; on modern PCs it is UEFI. The firmware checks and wakes the hardware.

The boot loader

The kernel

User space

What happens

;; step 1/10 · power
power on
  CPU      first instruction at 0xFFFFFFF0 (x86)
           the board maps that address to the flash chip
firmware   UEFI on modern PCs (BIOS on older ones)
  checks the memory, finds the disks
  baton    the firmware runs the CPU

The machine is an example: an Ubuntu-style PC with UEFI, GRUB, the kernel /boot/vmlinuz and the root file system on /dev/sda2. A real grub.cfg is longer and names the disk by UUID; /proc/cmdline also starts with BOOT_IMAGE=/boot/vmlinuz, cut to "…" on the card. Warning: grub.cfg is generated; do not edit it by hand. To change the kernel command line, edit GRUB_CMDLINE_LINUX in /etc/default/grub and run sudo update-grub (Ubuntu, Debian) or grub2-mkconfig (Fedora). A wrong root= can leave the machine unable to boot, so keep a rescue USB stick ready.