L2 · Operating systemsHow Computers Work · part 3 of 4

How Linux Boots: From Power Button to Login

Firmware, bootloader, kernel, initramfs, PID 1: the chain of programs that runs between pressing the power button and seeing a login screen.

Takumi Yamada
· 6 min read · 3 references
linuxbootuefiinitramfssystemd
Tux, a cartoon penguin with a yellow beak and yellow feet, sitting down.
Tux, the Linux mascot, drawn by Larry Ewing in 1996 with the image editor GIMP. When the kernel starts, some systems show one small Tux for each CPU core in the corner of the screen.Drawing: Larry Ewing and The GIMP, free to use with credit, via Wikimedia Commons (original). Changes: placed on a background.

You press the power button. A few seconds later, there is a login screen.

Between those two moments, a chain of separate programs runs, and each one hands control to the next. It works like a relay race, where each runner only has to carry the baton to the next runner. Each program exists only to find the next one, load it, and start it.

Once you know the stages, "my computer won't start" becomes a more precise question: which handover failed?

The relay race

1FIRMWAREUEFIfinds a boot entry,loads an .efi file2BOOTLOADERLimine, GRUBloads the kerneland the initramfs3KERNELvmlinuzsets up memory,drivers, scheduler4INITRAMFStiny root in RAMunlocks the disk,mounts the real root5PID 1systemdstarts everythingelse, in parallel
Five programs, each one started by the one before it.

Every stage has exactly one job: get the next stage into memory and start it. Here are the stages in order.

Stage 1: Firmware

When the power comes on, the (Central Processing Unit) can't run your . It doesn't even know that disks exist. It starts by running code from a memory chip on the motherboard. That code is the firmware. On any modern computer it's UEFI (Unified Extensible Firmware Interface). The older kind, BIOS (Basic Input/Output System), survives mostly as a compatibility mode.

A black rectangular chip with two rows of metal legs, lying on a wooden table. A sticker on it reads Award, 1998.
A firmware chip taken out of a PC from 1998. This one holds a BIOS. A modern board has a smaller chip that holds UEFI and does the same job.Photo: Thomas Bresson, CC BY 3.0, via Wikimedia Commons (original). Changes: cropped and resized.

UEFI does three things.

It checks the hardware. This is called the power-on self test. It prepares the (Random Access Memory), finds the connected devices, and beeps if something is broken.

It finds something to start. UEFI understands disk and the FAT32 (32-bit File Allocation Table) . It looks for the EFI System Partition, a small FAT32 partition usually mounted at /boot or /efi, and loads a program file ending in .efi from it. The order in which it tries the entries is stored in a small memory on the motherboard called NVRAM.

It starts that program. That program is your .

You can look at the boot entries from a running system.

$ efibootmgr
BootOrder: 0001,0000
Boot0000* Windows Boot Manager
Boot0001* Limine
FIRMWAREUEFINVRAMBootOrder: 0001, 0000the order to tryBoot0001 Liminetried firstBoot0000 Windows Boot Managertried secondDISKnames a fileEFI System PartitionFAT32BOOTLOADER.efi fileloaded, thenjumped tootherpartitions
The two entries from that listing. NVRAM holds the order, and the entry tried first names the bootloader's file on the disk.

UEFI is also where Secure Boot works. With Secure Boot on, UEFI refuses to run any .efi program that isn't signed with a trusted key. This makes sure every step of the start-up is trusted. It's also why some Linux distributions need an extra signing step before they can start at all.

Stage 2: Bootloader

The bootloader, such as GRUB, systemd-boot or Limine, is a tiny program with one purpose: load the into memory and start it with the right settings.

It reads a settings file that says roughly this.

kernel  = /vmlinuz-linux
initrd  = /initramfs-linux.img
cmdline = root=UUID=3f2a... rw quiet

There are three pieces there.

The kernel image is the Linux kernel, compressed. The initramfs is a small compressed file system, which we will get to in a moment. The kernel command line carries settings for start-up. The most important one is root=, which tells the kernel where the real root file system is.

/vmlinuz-linuxthe kernel, compressed/initramfs-linux.imga small filesystem, compressedroot=UUID=3f2a… rw quietthe kernel command lineBOOTLOADERloads all threeRAMkernelinitramfsits arguments
What the bootloader hands over. After this the kernel is running and the bootloader's job is done.

When you have two operating systems, the menu where you choose one is the bootloader. The bootloader also lets you edit that command line by hand before starting. That's why adding a 3 to the kernel line, to start in a text-only mode, is a well-known way to rescue a broken system: you change what the bootloader passes to the kernel.

Stage 3: The kernel wakes up

The bootloader unpacks the kernel into RAM and starts it. Now Linux is running, but almost nothing is set up yet, so the kernel does that next.

It sets up memory management, the , and the handling of hardware signals. It finds the hardware and loads the built into it. That's the long scrolling text you see when start-up messages are shown. Then it needs to mount the root file system.

And here there is a problem that goes in a circle. Reading the real root file system might need a driver or a decryption key, and those are stored on the root file system. Examples are the driver for an NVMe (Non-Volatile Memory Express) , the btrfs file system module, or the password prompt for an disk. The kernel can't read the disk that contains the tools for reading the disk.

KERNELrunning in RAMREAL ROOTstill unreadableneeds a driver, or a key, to read itthe driver and the unlock tool are files on itStage 4 breaks the loop: a copy of those drivers and tools is loaded into RAM beside the kernel.
The loop the initramfs exists to break.

Stage 4: initramfs, the temporary world

The solution is the initramfs, short for initial RAM file system. It's a small compressed archive that the bootloader loads next to the kernel. It contains just enough to reach the real root file system: drivers for your storage, file system tools, and a start-up script.

The kernel unpacks it into RAM and runs it. On an encrypted computer, this is the moment when you type your disk password.

initramfs job list:
  1. load storage drivers (nvme, ahci...)
  2. cryptsetup open /dev/nvme0n1p2  ← your LUKS prompt happens HERE
  3. mount the real root (btrfs, ext4...)
  4. switch_root into it and exec the real init

switch_root is the key step. The initramfs mounts your real root file system, switches over to it, deletes itself from RAM, and starts the real init system, the program that starts everything else. The temporary file system is gone, and the real one takes over.

BEFOREswitch_rootRAMKERNELINITRAMFStiny root in RAMunlocks and mountsREAL ROOTstill lockedDISKAFTERswitch_rootRAMKERNELINITRAMFSdeleted from RAMPID 1systemdreal init startsREAL ROOTmounted as /DISK
Before and after switch_root. The initramfs is only needed until the real root is unlocked and mounted.

On Arch Linux, a tool called mkinitcpio builds this archive, and the HOOKS line in its settings decides what the initramfs can do. On an encrypted disk, if the encrypt hook is missing, you get one of the most common start-up failures: a kernel with a disk it can't unlock.

Stage 5: PID 1

The kernel starts exactly one program as process ID 1, and on almost every modern Linux distribution that program is systemd.

PID (Process Identifier) 1 is special. Every other program you run descends from it. It takes care of programs whose parent has ended. And if it stops, the kernel stops too, with an error called a kernel panic.

Its job is to go from one running program to a whole working system. It mounts file systems and starts network services, logging and timers. It treats this as a set of tasks that depend on each other, and runs them in parallel. Each task says what it needs first, and every task whose needs are already met starts at the same time.

That's why modern Linux computers start in seconds, instead of the full minute that the older start-up scripts took by running one task after another.

SCRIPTSone at a timeMOUNTSLOGGERNETWORKTIMERSLOGINSYSTEMDa dependency graphMOUNTSLOGGERNETWORKTIMERSLOGINthese four need nothing fromeach other, so they start togethertime
Five example jobs, run both ways. In the graph, the four that need nothing from each other start at the same time.

Afterwards, you can see how long each part took.

$ systemd-analyze
Startup finished in 9.8s (firmware) + 2.1s (loaders) + 1.9s (kernel) + 2.4s (userspace)

$ systemd-analyze blame
1.2s NetworkManager.service
0.8s systemd-journald.service
...
FIRMWARE9.8sLOADERS2.1sKERNEL1.9sUSERSPACE2.4smore than the kernel and userspace together4.3s together
The four numbers from the first line of that output, drawn to scale.

Look at where the time went. On this computer, the took longer than the kernel and systemd together. A start-up time only means something when you know which stages it includes.

The last step is a target, a group of services that make up a finished system. The graphical target starts a display manager, which draws the login screen. On a setup that logs in automatically and starts a Wayland desktop directly, you go straight to your desktop instead.

Debugging by handoff

Thinking in stages makes start-up failures much easier to find.

What you seeWhich handoff failed
Black screen, no logoFirmware can't find a boot entry. Check efibootmgr and the ESP
Bootloader menu, then an errorBootloader can't load the kernel. Wrong path or UUID in its config
Kernel messages, then a panic about mounting root is missing a driver or a hook. Rebuild it
No passphrase prompt on an encrypted diskThe encrypt hook is missing from the initramfs
Boots, but a service is downThe problem is in . Try journalctl -b and systemctl status

Every symptom points to exactly one stage.

THE STAGE THAT FAILEDFIRMWAREblack screen,no logoBOOTLOADERits menu,then an errorKERNELINITRAMFSpanic about root,or no passphrase promptPID 1it boots, buta service is down
The table as the relay from the top of the post.

The Bottom Line

I run Arch Linux on an encrypted btrfs disk, and I'm building NEJEN, a desktop environment based on Hyprland that installs onto it. Because of that, I have had to debug most of these stages at least once.

The initramfs stage is the hardest one. Every encrypted setup depends on stage 4 being built correctly. When it fails, you don't get a helpful error message, you get a kernel that can't unlock its disk. And you can't fix it from inside the system, because the system doesn't start.

Once you see start-up as a chain of small programs, each one starting the next, a failure like that becomes a list of stages to check.

Check yourself

3 questions · nothing is saved
  1. 1.Why does Linux need an initramfs?
  2. 2.What happens if PID 1 stops?
  3. 3.An encrypted Arch system prints kernel messages but never asks for the disk password. What's the likely cause?

References & Primary Sources

Official specifications, standards, and documentation cited in this post.

  1. [1]

    Official kernel documentation on initialization and spawning PID 1

    DOCSdocs.kernel.org
  2. [2]

    Industry standard for firmware interfaces, ESP FAT32 partitions, and boot handoffs

    STANDARDuefi.org
  3. [3]

    Standardized specification for drop-in boot entries shared across Linux loaders

    SPECsystemd.io

Who wrote this

Author profile and background

Takumi Yamada

Takumi Yamada

· Backend Engineer

Backend engineer building services, databases, Linux tooling, and NEGEN SYSTEMS. Writing about low-level mechanics, distributed systems, and real-world security.

End of post
NEGEN SYSTEMS
Receipt · post 9 of 31
Written
Dec 27, 2025
Length
1,395 words · 6 min
Built
…
Served by
…
Delivered
…
Over the wire
…
Go's share
…
Next in How Computers Work · part 4 of 4

How an Operating System Schedules Work

You have more programs than CPU cores, yet everything seems to run at once. Here's how the scheduler does it.

6 min read