Have you ever wondered how long it takes for your system to boot? Maybe someone you know has claimed that their system starts up faster than yours and you are curious about the exact time. While not everyone is interested in numbers, you could be. You will definitely want the startup to be as quick as possible.
By the end of this guide, you will have a brief understanding of what affects the boot time of your Linux system and how to calculate its total time. You’ll also learn ways to cut boot time and turn your computer into a fast, responsive beast.
How to check Linux boot time using systemd-analyze
Systemd is the default service manager preinstalled on most Linux distributions. Using the systemd-analyze command, you can get detailed statistics about the previous boot of your system. You can also see a breakdown of the services and know the time taken by each to start up.
To verify the start time using systemd-analyze, type:
The system will display an output containing the total start time. It also shows the time taken by the kernel and user space separately.
In this sample output, you can see that it took about nine seconds for the machine to boot. Since the image above represents a virtual machine, its startup time may be faster than a normal Linux installation.
To get information about the time taken by each service during startup, use the blame systemd-analyze method:
This will produce output that looks a bit like the following:
As you can see, the output shows a list of all the services and the time taken by each.
What Affects Linux Boot Time?
When you start your Linux system, the BIOS is the first thing that loads. The BIOS then transfers control to the master boot record (MBR), which starts the GRUB boot loader. GRUB is responsible for loading the kernel, which further configures the initial root filesystem and runs the init to treat. Then the execution of other services takes place.
The time taken by these other services accounts for the majority of your system startup time. The more services you have at startup, the longer it will take to boot your system. Therefore, it is important to prevent unnecessary services from running on startup if you want your system to start faster.
How to fix a slow booting Linux machine
You cannot stop the boot process or start the GRUB boot loader during boot, as this will cause problems with your system’s boot sequence. However, you can disable unimportant services on your system so that they do not run on startup.
The systemctl utility allows you to manage services on Linux. By using the tool, you can easily start and stop services. But first, let’s remember which services started during the last startup:
In this output you can see that the exim4-base.service takes up most of the startup time (about three seconds). Exim4 is a postal transport agent and exim4-base is the service that provides the necessary support files required by the exim4 daemon.
Since this is not an important service for a local system, you can disable it using systemctl to save boot time:
sudo systemctl disable exim4-base.service
To note: If you are not completely sure what you are doing, you should check with an experienced Linux user before disabling services. Disabling a critical service can cause unexpected problems with the operating system.
To reactivate a service, simply replace deactivate with activate in the systemctl command:
sudo systemctl enable exim4-base.service
By using this process, you can modify the services that your system starts up to reduce startup time.
Improve Linux boot time without any hardware modification
While many will suggest installing Linux on an SSD to improve boot time, you can do it for free by disabling unwanted services on your system. While this doesn’t dramatically reduce boot time, every second counts if you want a computer with fast performance.
Do you want a fast and responsive system? Installing a lightweight and minimal Linux distribution on your PC can help.
Need a lightweight operating system? These special Linux distributions can run on older PCs, some with as little as 100MB of RAM.
About the Author