“systemd-analyze” — Blame Ain’t Nobody For Boot Wait

systemd“, the most comprehensive and feature-rich init system has been a new wave in the way Linux’ userspace is managed. Among the many new tools the suite provides, systemd-analyze is the one that gives primary information about the system’s boot performance.

To see the time spent in kernel space and user space during booting, run systemd-analyze :

deepakd@penguin:~# systemd-analyze
Startup finished in 4.315s (kernel) + 14.907s (deepakdspace) = 19.223s

If the system is booted via UEFI and the boot loader implements systemd’s Boot Loader Interface (which currently systemd-boot and GRUB do), we’ll also get the time spent in the EFI firmware and the boot loader itself.

deepakd@penguin2:~$ systemd-analyze
Startup finished in 16.342s (firmware) + 22.752s (loader) + 12.406s (kernel) + 1min 2.976s (deepakdspace) = 1min 54.477s

To list which unit files were started, sorted by the time they took to start up, run systemd-analyze blame :

deepakd@penguin:~# systemd-analyze blame
          9.069s thin.service
          7.376s ModemManager.service
          5.566s networking.service
          5.263s NetworkManager.service
          4.527s accounts-daemon.service
          3.774s polkitd.service
          3.532s dev-sda3.device
          3.344s arpwatch.service
          3.057s irqbalance.service
          2.958s postgresql@9.5-main.service
          2.824s stunnel4.service
          2.640s systemd-logind.service
          . . .

Though the output is insightful, the information can be misleading. Because the initialization of one service might be slow simply because it is waiting for another service to complete its initialization. To see which of such units (service in SysVinit parlance) find themselves waiting during the startup chain, run systemd-analyze critical-chain.

systemd-analyze-critical-chain

My personal favorite is the graphical representation of the color-coded break-down of the booting timeline, the plot of which systemd-analyze exports to SVG format.

systemd-analyze plot > bootup-plot.svg

systemctl-analyze-bootup-plot

click here to open the image in new tab

That’s it for now. In the next post we’ll investigate the ways of optimizing the boot time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s