Home > Package & System Management > systemd-analyze

systemd-analyze: System Boot and Service Analysis

systemd-analyze is a powerful tool used to analyze and debug boot times and individual service startup times on systemd-based systems. It is useful for optimizing system performance.

Overview

systemd-analyze helps system administrators diagnose and resolve performance issues by identifying bottlenecks in the system boot process and measuring the time each service contributes to the boot.

Key Features

  • Measure total boot time
  • Analyze startup times of individual services and units
  • Identify the 'critical chain' that most impacts boot
  • Visualize the boot process (SVG, DOT graphs)
  • Validate systemd unit files

Key Options

These are the main options used with the systemd-analyze command.

Boot Time Analysis

Visualization and Debugging

Generated command:

Try combining the commands.

Description:

`systemd-analyze` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Here are various examples of how to use the systemd-analyze command.

Check Total Boot Time

systemd-analyze

Check the total boot time of the system.

Check Boot Time per Service

systemd-analyze blame

Display the time each service took to boot, sorted in descending order.

Analyze Boot Critical Chain

systemd-analyze critical-chain

Check the dependency chain of units that have the greatest impact on boot completion.

Visualize Boot Time (SVG)

systemd-analyze plot > boot.svg

Generate a graph of the boot process in SVG format and save it to 'boot.svg'. This file can be opened in a web browser.

Verify Unit File

systemd-analyze verify /etc/systemd/system/my-custom.service

Check a specified systemd unit file for syntax errors or incorrect configurations.

Tips & Notes

Useful tips and points to consider when using systemd-analyze.

Graphviz Installation

To generate visualized graphs using the plot or dot options, the Graphviz package must be installed.

  • Debian/Ubuntu: sudo apt install graphviz
  • CentOS/RHEL: sudo yum install graphviz

Interpreting 'blame' Results

The output of systemd-analyze blame shows the 'time taken to start' for each unit. However, since systemd starts many services in parallel, you cannot simply conclude that the service with the longest time is the cause of boot delays. Analyzing it in conjunction with critical-chain is more accurate.

Boot Optimization

By focusing on the units identified by critical-chain, you can reduce boot times by removing unnecessary dependencies or changing service startup types (e.g., on-demand).


Same category commands