1. Overview
In this tutorial, we’ll dive into the details of how to improve the boot speed of Linux. So many things can affect the boot performance, such as startup services and daemons, disk fragmentation, outdated software, etc.
In this article, we’ll look at how to identify the reason and possible solutions to improve the boot speed of Linux.
2. Analyzing the Boot Time
It’s important to analyze the current boot time and identify the bottlenecks before optimizing. We can use the systemd-analyze command to understand the system’s boot time overview and pinpoint specific services causing delays:
$ systemd-analyze
Sample output can be like below:
Startup finished in 2.256s (kernel) + 7.174s (userspace) = 9.430s
This output shows that the kernel took 2.256 seconds to start, while userspace processes took 7.174 seconds. We can analyze the output to detect which part of the boot process takes the most time.
3. Disabling Services and Daemons
After analyzing the services, we can disable unnecessary ones to speed up the process. We can list enabled services using systemctl list-unit-files –type=service command and identify services we can disable.
For instance, to disable the example service:
$ sudo systemctl disable example.service
We can manage other systemd units in the same approach. We need to be careful not to disable critical services that the system needs for proper functioning.
4. Optimizing Disk Usage
A cluttered disk can slow down the boot times. We can clean up unnecessary files using tools like Staces or Bleachbit. We can install and run bleachbit:
$ sudo apt-get install bleachbit
Also, we may consider switching to a lightweight desktop environment if our current one is resource-heavy. For example, if we’re using Ubuntu with the default GNOME desktop, we may consider switching to Xfce:
$ sudo apt-get install xubuntu-desktop
5. Kernel and Driver Optimization
We can keep our kernel up to date with the latest stable version. We can check our distribution’s documentation for kernel updates. For example, on Ubuntu, we can use the Ubuntu Kernel Update Utility (UKUU) tool to manage kernel updates:
$ sudo apt-get update
$ sudo apt-get install ukuu
Additionally, tuning kernel parameters in /etc/sysctl.conf can affect the boot performance. For instance, to improve I/O performance, we can set the vm.swappiness to a lower value:
$ echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.conf
6. Utilizing Bootloaders
We can consider a different boot loader, one of the important components in the boot process. For example, instead of the GRUB bootloader, the rEFInd bootloader can be selected for faster startup. We can install rEFInd:
$ sudo apt-get install refind
To configure the bootloader to ship the boot menu and reduce the timeout, we can edit the rEFInd configuration like:
$ sudo nano /boot/efi/EFI/refind/refind.conf
We need to change the timeout and hideui options as desired.
7. Enabling Fastboot
Fastboot is a BIOS/UEFI setting feature that reduces hardware initialization time. We can enter our BIOS/UEFI settings, usually by pressing F2, F10, or Del during the startup, and look for fastboot or quick startup options. We should enable these features if available.
To remove the unnecessary boot message and splash screen, we can edit the GRUB configuration:
$ sudo nano /etc/default/grub
We should remove the quiet and splash from GRUB_CMDLINE_LINUX_DEFAULT line, then update GRUB:
$ sudo update-grub
8. Updating System Regularly
Keeping our system, drivers, and applications up to date is essential. Regular updates include performance improvements and bug fixes. We can use our distribution’s package manager to ıpdate the system:
$ sudo apt-get update
$ sudo apt-get upgrade
Scheduling regular updates to ensure our system benefits from the latest enhancements has a crucial role in boot time and other important features.
9. Conclusion
In the scope of this article, we’ve looked at how we can improve the boot speed of Linux. Since the scope is too wide, we’ve tried to narrow it down to some steps. By following these steps, we’ll be able to improve the boot speed of our Linux system significantly. We need to remember to monitor boot times after each change and assess the impact on system performance.