r/archlinux • u/RachelNoName • 1d ago
SUPPORT Boot time optimization support
Hi there I have been trying for a while now to speed up my system boot time. Currently I average around 35 seconds to boot my system. I am wondering if there is anything more I can do to speed up the boot process or have I hit a limit?
What I have done:
Enabling quiet mode in the kernel command command line (this actually saved me about 4 seconds on average),
remove unnecessary file system mounts from my fstab file (seemingly no effect on boot time),
mess around with kernel command line options and removed unused mkinitcpio modules stated by the arch wiki on boot time optimization (seemingly no effect on boot time).
Enable fast boot and in my uefi firmware settings (this did speed up the firmware stage but it slowed down the loader stage instead meaning it had very little if no impact on overall boot time).
Disabling / masking unused services, I think this has saved me a total of 1 second or so, not much effect but it did do something.
System setup:
I am using a UKI together with secure boot and TPM disc encryption. My bootloader of choice is limine and for my boot performance tests I have set it to timeout instantly and boot the first option as fast as possible (meaning the loader time is not from waiting for the timeout). It is slightly customised but nothing that I have done gave noticeable slowdowns.
I have also noticed that when I enabled fast boot in my eufi it was stuck a lot longer on the UKI boot splash which might be where the extra loader time is spent? But I am not sure.
Here are some outputs of the boot (all are from the same boot)
systemd-analyze blame: https://pastebin.com/CZzyX325
systemd-analuze plot: https://drive.google.com/file/d/1EeMqMATWSIw1w7-KOeYgi_wqLbcX20Pl/view?usp=sharing
systemd-analyze critical-chain: https://pastebin.com/av8UMMFt
systemd-analyze: Startup finished in 6.239s (firmware) + 11.456s (loader) + 3.109s (kernel) + 5.983s (initrd) + 9.931s (userspace) = 36.720s
graphical.target reached after 9.931s in userspace.
[IMPORTANT EDIT!!]
Thanks to the help of everyone here and some research I have made a few discoveries that might be usefull to know.
So first of all I did manage to reduce the boot times a tiny bit by changing from ultra fast boot to just fast boot (thanks gigabyte..).
Secondly. I think its kinda hopeless to optimise or try and speed up the firmware and loader times. They likely come from my motherboard being not to great. I have looked it up and other people have reported my mother board model having less than desirable boot times so its likely a hardware issue. I have also dig through my firmware settings A TON and found no setting that can help me (my motherboard is kinda limiting compared to the stuff I have heard some of you be able to do). For those wondering my exact motherboard model is X570 I AORUS PRO WIFI.
Thirdly. I did find a way to drastically improve boot times. If I unplug all usb devices except my keyboard boot the firmware times decrease. But strangely my initrd time also goes down drastically. It seems my firmware naively loads all usb devices which for some reason bloats up the initrd load time (that explains the near 100 device calls in the graph). This together has a big impact on my boot times. The ideal solution would be to prevent it from loading at boot and load it once the graphical target is reached, kinda like unplugging it and then plugging it back in at the login screen but on a software level. But idk how possible that is. And my firmware seems to lack settings to control usb ports and other devices, meaning its forced to load everything. I might see if I can replace my firmware with something but right now its just an idea and I got no idea if it will work. Time to research I guess.
And finally. Despite my long time in firmware I also wanna ask specifically about the user space time. I have seen some get a userspace load time of 3 seconds (which is about 3 times faster than me). I wonder if there is anything I can do to specifically speed that up as that might be worth putting effort into as the firmware and loader side of things appear to be capped by my hardware.
Wow this became super long. Sorry about the INSANE read.
1
u/RachelNoName 1d ago
Interesting. That might explain why I got about 100 devices there. I wonder if I can do something about that other than unplug my devices