Back to lessons

Linux Survival Basics

Find Slow Services During Boot

A server comes back after reboot, but boot time feels long and there is no obvious culprit.

Command

systemd-analyze blame | head -20

What changed

Nothing changes. systemd prints units ordered by startup duration.

Danger

safe

When to use it

Use after slow reboots, maintenance windows, or image changes that affect startup time.

When not to use it

Do not assume the top line delayed the whole boot; follow up with systemd-analyze critical-chain.

Undo or recovery

No undo needed because the command is read-only.

Expected output

Startup durations sorted from slowest to fastest.

demo script

Disposable terminal steps

  1. systemd-analyze blame | head -20
  2. last -x reboot | head -5

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ systemd-analyze blame | head -20
12.441s cloud-init.service
4.982s docker.service
2.104s nginx.service
1.660s networking.service
::exit-code::0
$ last -x reboot | head -5
reboot   system boot  6.8.0-60-generic Thu Jun 25 14:09   still running
reboot   system boot  6.8.0-60-generic Wed Jun 24 03:12 - 14:08  (1+10:56)
::exit-code::0

YouTube Short

What slowed down boot?

When a VPS takes too long to come back, systemd can rank startup units by duration. Treat it as a lead list.

LinkedIn hook

Find which units made your VPS boot slowly.

Question: Which services usually dominate boot time on your servers?

experiments

A/B tests to run

Metric: comment_rate

A: Lead with the parallel-startup caveat.

B: Lead with the ranked output.