How to Use systemd-analyze to Diagnose Boot Issues


Boot or startup issues are something that nobody wants to experience. Fortunately, if you know how to analyze, debug, and fix them appropriately, then you can maintain a stable system. These issues often occur because multiple services start during boot, and some may lead to delays or timeouts. However, finding or analyzing the service that is causing the issue is the real challenge. That’s where systemd-analyze comes in; it helps you identify the services that are impacting your system’s boot time.

In this write-up, I’ll show you how to use the systemd-analyze command to diagnose boot issues.

What is systemd-analyze

Systemd-analyze is a command-line utility in Linux that assists us in diagnosing boot issues. To use this command, you must follow the given syntax:

systemd-analyze [sub-command]

Here, the sub-command is optional and can be one of the following: blame, critical-chain, time, or dump. Each of these commands serves a specific purpose, which we will discuss in detail in the upcoming sections of this post.

Note: Run the man systemd-analyze command to understand how to use it with different subcommands and options to diagnose the boot issues.

Understanding the Working of systemd-analyze

The systemd-analyze command can be used with or without subcommands. If you execute it standalone, it retrieves the current boot time of the kernel and userspace.

Analyzing Current Boot Time With the systemd-analyze

Let’s check the current boot time of your system using the systemd-analyze command without any arguments or subcommands:


The output shows that the startup takes 56.773 seconds to complete the boot process:

Analyzing all Running Services Using systemd-analyze

To diagnose boot issues, you need to analyze each service that’s running on startup. For this purpose, run the systemd-analyze command with the blame subcommand:


It retrieves the service name along with the time it takes during the boot process. It sorts the services according to time taken, i.e., the service that consumes the most time comes first, and the one that takes the minimum time appears at the end. This helps you identify which service is taking an unusual time or causing the delays:

Press the “Enter” key to see more services and the “q” key to revert to the terminal.

Showing Boot Issues in a Tree-like Format

If the regular services format (as shown in the above section) seems a bit messy, you can format it in a tree-like structure to avoid any conflicts. In that case, you need to execute the systemd-analyze command with the critical-chain subcommand:

systemd-analyze critical-chain

It shows the “time when a unit starts”, which is represented by a @ symbol, and the “time a unit took to start”, which is printed after the + sign:

The critical chain allows us to analyze why a service takes a particular amount of time to activate a specific unit.

Showing Boot Issues in a Graphical Format

You can also view the services in a Graphical format to diagnose the boot issues more conveniently. To do this, you need to install the gpicview image viewer:


Once the gpicview is successfully installed, you can use the systemd-analyze command to plot a graph and store it as an SVG file. After this, you can use the gpicview command to view the plotted graph and analyze the boot issues:

systemd-analyze plot > boot_issues.svg
gpicview boot_issues.svg

Here, you can check the service loading time across the X-axis. You can identify which service is taking too much time and stop it to enhance the boot time.

Analyzing the System’s Current State

You can also use the systemd-analyze with the dump sub-command to analyze the output in a human-readable serialization of the complete server state (usually too long):


How to Use systemd-analyze to Diagnose Remote Hosts

To analyze remote hosts using the systemd-analyze command, you need to specify the -H option followed by the username@host:

systemd-analyze time -H username@host
systemd-analyze blame -H username@host
systemd-analyze critical-chain -H username@host

Replace the username and host with the ones that you want to analyze.

Final Thoughts

systemd-analyze is a handy command-line tool that helps you diagnose boot issues. It returns the services list along with the time they take to boot. The services list is sorted in descending order, where the service taking the maximum time comes first, while the one that consumes the minimum time is listed at the end. This way, you can easily identify which service is causing the boot issues. Once you diagnose the services causing the boot issues, you can optimize them to speed up your Linux boot time.