If your Linux system is taking so much time to boot, and you want to know which process is taking so much time to boot then you are on the right page. We are going to see how to get a complete overview of system boot-up time and which service is taking more time to initialize.
We are going to use the systemd-analyze command and subcommands of systemd-analyze to view the statistics and retrieve other states and tracing information from the system and service manager. To see information like time taken by the kernel and userspace while booting use the simple systemd-analyze command.
To view the list of all running services sorted in order of time taken to initialize by respective process use the blame sub command. After running the process use [ENTER] key to view more services and use q to quit.
We can see in the above output to all services are sorted in the time taken to initialize in decreasing order. And we also see which process is taking the maximum time.
To view the list of services or units with the time taken to initialize in a tree-like structure We are going to use the critical-chain sub-command.
Now let’s see about one more sub-command of systemd-analyze which allows us to produce the graphical (SVG format) with details like initialization time taken by the service to start.
Make sure you have installed the gpicview on the Linux system. You can install it simply by the following the command:
sudo apt install gpicview
The use of the plot subcommand of systemd-analyze command
systemd-analyze plot > boot_stat.svg gpicview boot_stat.svg
You can zoom the output using the ctrl and + key.
To view the information from a remote host over ssh use the -H flag and specify the username@host. Here is example:
systemd-analyze time -H firstname.lastname@example.org systemd-analyze blame -H email@example.com systemd-analyze critical-chain -H firstname.lastname@example.org
To know more about the systemd-analyze see the man page of systemd-analyze using the following command.