In this lesson, you will learn how to trace the transition from the kernel’s initial execution to the fully operational user-space environment managed by systemd.
The Handover from Kernel to Init
When you power on your machine, the kernel initializes hardware and mounts the root filesystem. Once the kernel finishes its setup, it executes the first process, which is traditionally assigned PID 1. In modern Linux distributions, this is the systemd binary. At this exact moment, the kernel "hands over" control of the system to systemd, which becomes the parent of all subsequent processes.
The Initialization Chain
systemd does not start services in a linear list; it treats them as a complex graph of dependencies. Here is how the chain unfolds:
- Initial Target:
systemdfirst looks for thedefault.target(usuallygraphical.targetormulti-user.target), which acts as the "goal" state for the boot. - Dependency Resolution: Because
systemdis designed for speed, it analyzes theWants=andRequires=directives in unit files. It calculates the most efficient order to start services in parallel. - The Chain of Units: You can visualize the current chain of your boot process by running:
This command tells you exactly how much time was spent in the kernel vs. user-space. If you want to see the specific chain of execution for a target, use:systemd-analyzesystemd-analyze critical-chain
Why Trace the Chain?
The critical-chain command is vital for debugging slow boots. It identifies which unit was the bottleneck—the service that took the longest to initialize and held up other dependent processes. Each unit in the chain must complete its start-up sequence (which often involves opening sockets or mounting internal paths) before the next link in the dependency graph can safely proceed. By tracing this chain, you see exactly where systemd is orchestrating the transition from a blank state to a functional desktop or server environment.
Key Takeaway: The systemd initialization chain is a dependency-driven graph that starts at PID 1 and parallelizes service activation to reach a defined target state as efficiently as possible.