systemd-analyze is the command-line tool that inspects and measures the systemd service manager, reporting how long each boot phase took, which units delayed startup and whether unit files are valid. In System initialization on Linux, it is the standard instrument for turning a vague complaint such as “the server boots slowly” into measurable, attributable delays.
The tool ships with systemd itself and reads data that the manager already records, such as activation timestamps for every unit. It therefore adds no overhead to the boot it analyzes. Beyond timing, it also offers static checks of unit files, calendar expression parsing for timers and a security exposure assessment for services.
How systemd-analyze measures the boot process
systemd-analyze measures boot time by reading monotonic timestamps that systemd stores for each boot phase and each unit state change. PID 1 records when the kernel handed over control, when the initramfs finished and when the default target was reached, and the tool queries these values over D-Bus.
The plain systemd-analyze time command splits the boot into phases. The firmware and loader values appear only when the boot loader implements the Boot Loader Interface, as systemd-boot does; with GRUB on many distributions these fields are simply missing. The phases are summarized below.
| Phase | Starts at | Ends at | Typical range |
|---|---|---|---|
| Firmware | Power on | Boot loader start | 1-15 s, depends on UEFI POST |
| Loader | Boot loader start | Kernel handover | 0.1-5 s, includes menu timeout |
| Kernel | Kernel start | initramfs start | 0.5-3 s |
| Initrd | initramfs start | Switch to real root | 0.5-10 s, longer with disk unlock |
| Userspace | Real root mounted | Default target reached | 2-60 s, service dependent |
The final line also states when the default target was reached, such as graphical.target or multi-user.target. This value is the most meaningful single number, because it marks the point at which the system is usable for its intended role.
Main subcommands and what they answer
systemd-analyze is organized as a set of subcommands, each answering a different diagnostic question. The timing commands analyze the last boot, while the verification commands work on files and expressions without starting anything.
| Subcommand | Question it answers | Output form |
|---|---|---|
| time | How long did each boot phase take | One summary line |
| blame | Which units spent the most time activating | Sorted list of units |
| critical-chain | Which dependency chain delayed the target | Indented tree with timings |
| plot | How did units overlap during boot | SVG timeline chart |
| dot | How are units ordered and required | Graphviz graph source |
| verify | Does a unit file contain errors | Warnings and errors |
| security | How well is a service sandboxed | Exposure score from 0.0 to 10.0 |
| calendar | When will a timer expression fire next | Normalized form and next elapse |
Most subcommands accept --user to inspect the per-user service manager instead of the system instance, and --host or --machine to query a remote host or a local container. Newer releases add helpers such as cat-config, unit-paths and condition, which show effective configuration and evaluate unit conditions.
Reading blame and critical-chain correctly
The difference between blame and critical-chain is the most common source of misdiagnosis. systemd-analyze blame lists the activation duration of every unit, but units start in parallel, so a unit that took 20 seconds may not have delayed the boot at all.
systemd-analyze critical-chain follows the ordering dependencies backward from the target and shows only the chain that actually determined the finish time. Each entry shows @ for the moment the unit became active and + for its own startup duration. The comparison below shows how the two views differ.
| Aspect | The blame view | The critical-chain view |
|---|---|---|
| Scope | All units that ran | Only the time-critical path |
| Accounts for parallelism | No | Yes |
| Includes Type=oneshot waits | Yes | Yes, when on the path |
| Best used for | Spotting slow units overall | Finding the real boot bottleneck |
| Typical pitfall | Blaming harmless background units | Missing delays outside the chain |
A frequent pattern is NetworkManager-wait-online.service or systemd-networkd-wait-online.service dominating both lists. These units deliberately block until the network is configured, and they matter only when other units order themselves after network-online.target.
Verifying units and assessing service security
systemd-analyze verify performs static validation of unit files before they are deployed. It loads the unit and its dependencies, reports unknown directives, missing executables and broken references, and returns a nonzero exit status on errors, which makes it suitable for continuous integration checks.
systemd-analyze security evaluates sandboxing directives such as ProtectSystem=, PrivateTmp=, NoNewPrivileges= and CapabilityBoundingSet=. It produces an overall exposure score, where lower is better, and maps the score to a qualitative label.
| Score range | Label | Interpretation |
|---|---|---|
| 0.0-1.9 | OK | Strong sandboxing applied |
| 2.0-4.9 | MEDIUM | Partial hardening, gaps remain |
| 5.0-7.9 | EXPOSED | Few restrictions in effect |
| 8.0-10.0 | UNSAFE | Service runs almost unrestricted |
The score is a heuristic, not a vulnerability scan. A service marked UNSAFE is not necessarily compromised, and a low score does not prove the code is secure; it only measures how much the kernel-enforced confinement would limit damage after a compromise.
Limitations and common mistakes
systemd-analyze reports what systemd observed, so it has blind spots outside the service manager. Time spent in firmware without loader support, in a slow disk unlock prompt or in a login screen after the target is reached does not appear in unit timings.
- Treating blame as a ranking of culprits leads administrators to disable harmless units while the real critical path remains unchanged.
- Measuring a single boot gives noisy results; caches, firmware checks and network conditions vary, so several boots should be compared.
- Ignoring user sessions hides delays in the desktop session, which require
systemd-analyze --userto inspect. - Running verify on the wrong path may test an installed copy instead of the edited file; passing the file path explicitly avoids this.
- Reading security scores as compliance overstates their meaning, because no standard defines the thresholds.
Related tools complement it: journalctl shows log messages explaining why a unit was slow, and systemctl inspects or changes unit state once the bottleneck is known.
The short version
systemd-analyze is a stopwatch and inspector for Linux startup. When a computer boots, many small programs start at once, some waiting for others. This tool reports how long the whole process took and which programs held everything up.
It can also check configuration files for mistakes before they cause trouble, and it can grade how tightly a background service is fenced off from the rest of the system. It measures and reports; it does not fix anything by itself.
Where it makes a difference
An operations team runs a fleet of virtual machines that are recreated automatically during traffic spikes. New instances take about 48 seconds to reach multi-user.target, which is too slow for the scaling policy. Running systemd-analyze blame shows a database client cache unit at the top with 14 seconds, so the team first suspects it.
systemd-analyze critical-chain tells a different story: the cache unit runs in parallel and is off the critical path, while the application service waits behind systemd-networkd-wait-online.service, which spends 31 seconds waiting for an unused secondary interface. Marking that interface as optional in the network configuration cuts time to target to about 17 seconds.
The team then adds systemd-analyze verify to its image build pipeline and tracks the systemd-analyze security score of the application service, lowering it from 9.2 to 4.1 by adding sandboxing directives.