Linux Labs

Inside the system: resources, kernel, processes / Stage 10 of 12

From GRUB to a target: how the system boots

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · on a machine · 4 min

Who held the boot up

blame and critical-chain answer different questions: how long each unit took to start, and whom the boot waited for.

systemd-analyze blame (in the Wiki) prints how long each unit took to start, slowest first. systemd starts units in parallel, so the lines of blame add up to more than the whole boot, and the slowest unit may have run alongside others without holding anyone up. blame also lists units started later, after the boot. At the start of the lesson the slowest unit did hold the boot up: the network wait service is both in blame and in the chain.

systemd-analyze critical-chain (in the Wiki) shows the chain by which the boot reached its target last. The chain goes down from the target: under each unit is the one it waited for last. The number after @ is when the unit became active, counted from the start of the services; the number after + is how long it took to start. Units that finished their work and did not stay active are not in the chain, and neither is anything started after the boot.

You can ask for the chain of a single unit too:

bash
systemd-analyze critical-chain nginx.service
Check yourself 1 question

In blame a unit has 2 seconds — the second line of the list — yet it is not in critical-chain. Why?

  • A crashed unit shows up in systemctl --failed; it is not there. blame times the start of any unit, and the chain only holds the units that were waited for last.

  • blame counts from the start to the end of the unit's own startup — it really took 2 seconds. The chain shows something else: whom the target waited for.

systemd starts units in parallel: a slow unit may finish earlier than the ones the target waited for longest. critical-chain only shows those last in line, so both outputs are worth reading.

Key points

  • blame is how long each unit took to start; units start in parallel, and a slow unit has not necessarily held the boot up.
  • critical-chain is whom the boot waited for: @ is when a unit became active, + how long it took to start.
Ubuntu 24.04
Loading…