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 1 of 8 · on a machine · 4 min

How long the boot took

What you will learn

  • Find out how long the boot took and which units it waited for with systemd-analyze, blame and critical-chain.
  • Tell start ordering (After=, Before=) from a dependency (Wants=, Requires=) and see what a service is waiting for.
  • Add a service to the boot in the right order and check the unit with systemd-analyze verify.

After a kernel update the server was rebooted, and it answered over SSH noticeably later than usual. A colleague asks: how long did the boot take, and what was it waiting for? Reboot your machine — it is set up the same way — and look.

Exercise · look

Look at the machine's boot

Reboot the machine with sudo reboot: the terminal shows the boot and logs in again. Then look at how long the boot took, which units took longest to start and which units the boot went through to the end.

First, predict

The boot took longer than usual. What will be the first line of systemd-analyze blame — the slowest unit?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

systemd-analyze says multi-user.target reached after 12.450s in userspace, and the first line of critical-chain is multi-user.target @12.450s. What follows from this?

  • The end of the boot is exactly the moment the boot reached the target: both outputs name it with one number.

  • How long a unit took to start, critical-chain writes after +. After @ comes the moment the unit became active.

Both numbers are the moment the boot reached multi-user.target.

Ubuntu 24.04
Loading…