Find the Boot Bottleneck with systemd-analyze blame
Read systemd-analyze time, blame and critical-chain output, and use critical-chain to tell which slow units on the blame list actually delayed the boot.
The unit at the top of systemd-analyze blame is often not what slows the boot. All three commands below are read-only and change nothing on the system. The output comes from a real Ubuntu 24.04 run; two unit names were replaced with nightly-job and report-job.
[1] Check the total first.
$ systemd-analyze timeStartup finished in 3.526s (kernel) + 5.185s (userspace) = 8.712s graphical.target reached after 5.169s in userspace.Kernel 3.5 s, userspace 5.2 s. Per the manual, these numbers stop when all services have been spawned, not when they finish initializing. Dig into userspace next.
[2] List the slowest units with blame, sorted by start-up time.
$ systemd-analyze blame --no-pager | head -81h 46.595s nightly-job.service 31.836s report-job.service 3.352s systemd-networkd-wait-online.service 2.398s apt-daily-upgrade.service 2.260s snapd.seeded.service 1.998s lm-sensors.service 1.968s grub-common.service 1.908s e2scrub_reap.service1h 46.595s is far longer than the whole boot (8.7 s). That is a Type=oneshot service a timer started after boot, unrelated to boot time. blame lists every unit that is up now, not only those started during boot.
[3] Use critical-chain to see the path the boot actually waited on. The default target is graphical.target. The time after @ is when the unit became active; the time after + is how long it took to start.
$ systemd-analyze critical-chain --no-pagergraphical.target @5.169s└─multi-user.target @5.169s └─apport.service @4.775s +393ms └─remote-fs.target @4.773s └─remote-fs-pre.target @4.773sThe 3rd–5th entries of blame (systemd-networkd-wait-online.service at 3.352 s, apt-daily-upgrade.service, snapd.seeded.service) are not in this chain, while apport.service in the chain took only +393ms. The rank in blame and the chain differ. The chain also stops at remote-fs-pre.target @4.773s without saying why.
[4] Query a unit near the break point to go deeper. network-online.target has the same timestamp (4.773 s).
$ systemd-analyze critical-chain --no-pager network-online.targetnetwork-online.target @4.773s└─systemd-networkd-wait-online.service @1.398s +3.352s └─systemd-networkd.service @1.160s +212ms └─systemd-udevd.service @1.049s +82ms └─systemd-tmpfiles-setup-dev.service @1.014s +20ms └─systemd-tmpfiles-setup-dev-early.service @871ms +92ms └─kmod-static-nodes.service @489ms +236ms └─systemd-journald.socket @405ms └─-.mount @310ms └─-.slice @310mswait-online starts at 1.398 s, takes 3.352 s, and finishes around 4.750 s. network-online.target comes up right after, and so does apport.service @4.775s in the default chain. The timestamps line up, but critical-chain does not show the link between the two chains directly. To confirm, add --fuzz=3: it also prints units that finished within 3 seconds of the chain's end. The output runs to dozens of lines, so pipe it to less.
[5] Check who waits on network-online.target with reverse dependencies.
$ systemctl list-dependencies --reverse systemd-networkd-wait-online.servicesystemd-networkd-wait-online.service● └─network-online.target○ ├─report-job.service○ ├─nightly-job.service○ ├─iscsid.service○ └─open-iscsi.service● is active, ○ inactive. These services need the network before they start. Whether you need them decides what you do next.
[6] Only then shorten the wait. The commands below were not run. Use them only if step 5 showed that nothing that waits needs the network.
# systemctl disable systemd-networkd-wait-online.service# undo# systemctl enable systemd-networkd-wait-online.service