System and processes

The systemd-analyze command

Measures how long boot takes and which services slow it down.

Syntax

systemd-analyze [opciones] [orden] [unidad...]Try it in the terminal →

Most useful options

--systemOperates on the system systemd instance. It is the default
--userOperates on your user's systemd instance, that is, its session services
--globalOperates on the system-wide configuration of user instances
--order, --requireWith dot, shows only ordering dependencies (After= and Before=) or only requirement ones
--from-pattern=, --to-pattern= PATRÓNWith dot, filters relationships by source or destination node, using a glob pattern
-H, --host= [usuario@]equipoRuns the query on another machine, connecting over SSH
--no-pagerDoes not send the output to a pager

Copy-ready examples

$ systemd-analyze timehow long boot took, split into kernel, initrd and user space.

Example output

Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s
multi-user.target reached after 47.820s in userspace
$ systemd-analyze blame | head -n 3the units that took longest to start, from longest to shortest.

Example output

32.875s pmlogger.service
20.905s systemd-networkd-wait-online.service
13.299s dev-vda1.device
$ systemd-analyze critical-chainthe chain of time-critical units up to the default target.
$ systemd-analyze --user blamethe same for your user services, without touching the system ones.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
System has not been booted with systemd as init system (PID 1). Can't operate.systemd-analyze queries the systemd manager, and the machine was not booted with systemd as PID 1. It happens in containers and in environments without systemd.Run it on a machine that boots with systemd. Inside a container there is no manager to query.

Typical mistakes

  • blame does not show services with Type=simple, because systemd considers them started at once and there is no time to measure.
  • blame times are not exact blame: a service can be slow because it waits for another one, so the real cause is often in its dependency.
  • time measures until all services have been spawned, not until they finish starting or until the disk goes idle.

Differences from similar commands

  • journalctl: shows the log messages, boot ones included. systemd-analyze summarizes how long each part took.
  • systemctl: starts, stops and queries units. systemd-analyze only measures, analyzes and verifies.
  • dmesg: shows kernel messages with their time since boot. systemd-analyze splits that time between kernel, initrd and user space.

Related commands

FAQ

Why does blame not show a service I know exists?

Most likely it is Type=simple, which systemd considers started at once. critical-chain will not include it either if it never went through the activating state.

How do I read the @ and + symbols in critical-chain?

@ shows when the unit became active; + shows how long it took to start. That tells you which part of the chain was slow.

Can I measure the boot of another machine?

Yes, with -H user@host, which connects over SSH. You need prior SSH access to the remote machine.

More System and processes commands

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course