Understanding systemd-analyze critical-chain in Linux

The systemd-analyze critical-chain command is an essential diagnostic utility in modern Linux distributions used to identify and troubleshoot slow boot times. This article explains the significance of the critical-chain output, how to interpret its execution tree, and how system administrators can leverage this tool to pinpoint startup bottlenecks and optimize system initialization.

What is the Critical Chain?

During the Linux boot process, systemd starts multiple services, sockets, and targets concurrently to minimize startup latency. However, because certain units depend on others to complete before they can start, a specific sequential path emerges that directly dictates the minimum total time required to reach a operational state. This path is known as the "critical chain."

The systemd-analyze critical-chain command prints this exact time-critical dependency tree, tracing back from the default boot target (usually graphical.target or multi-user.target) to the earliest services initialized by the kernel.

How to Read the Output

When you run the command in a terminal:

systemd-analyze critical-chain

The output displays a tree structure indicating when each unit was activated relative to boot time and how long it took to initialize.

A typical line looks like this:

network-online.target @1.234s └─NetworkManager-wait-online.service @456ms +778ms

Key Significance in Linux Administration

1. Identifying True Bottlenecks

Not every service that takes a long time to start causes a slow boot. If a service takes ten seconds to initialize but runs in parallel without blocking other dependent services, it does not delay reaching the login prompt. The critical-chain command filters out these harmless parallel operations and exposes only the services actively blocking the startup sequence.

2. Visualizing Dependency Blockers

By mapping parent-child relationships, the command reveals unexpected dependencies. For example, if a custom background script depends on network-online.target, and that target is waiting on a misconfigured network interface, the entire boot process stalls. The critical chain highlights this dependency chain clearly.

3. Targeted Performance Optimization

Instead of guessing which services to disable, administrators can use the output to make informed decisions:

Evaluating specific targets is also supported by specifying the target directly, such as systemd-analyze critical-chain multi-user.target, enabling granular analysis of specific operational states.