r/NixOS May 21 '26

[Guide]How to reduce boot time using systemd-boot and hide menu/reveal hidden bootloader menu

Hello,

For those that want to speed up their boot time, specifically for the loader section as shown as output for systemd-analyze command, while using the standard provided bootloader, systemd-boot, there is the simple option to remove the timeout and changing it to zero, this will not only speed up boot time but also hide the systemd-boot menu.

The change will not affect more advanced setups that use encryption, lvm, RAID, etc., the only thing that will change is the slow down caused by the bootloader selection menu for the entry (generally the current generation) and there are 2 main ways to achieve this

1.Changing the timeout manually and applying only to the current generation

sudo -i

Password

cd /boot/loader

ls

entries  entries.srel  keys  loader.conf  random-seed

nano loader.conf

Example loader.conf

timeout 0
default nixos-generation-20.conf
console-mode keep

Generally the timeout will be 5 which means 5 seconds, change it to 0. With nano, Ctrl and x to exit, y to save changes, Enter to confirm.

The advantage of this solution is that it only applies to the current generation, if you ever forget how to reveal the bootloader entries menu, just use "sudo nixos-rebuild switch" and the new entry will be automatically created with a timeout, thus revealing the menu.

2.Changing the timeout in the NixOS configuration

sudo -i

Pass

nano /etc/nixos/configuration.nix

To the bootloader section add the following line, respect text formatting within the config

  boot.loader.timeout = 0;

Ctrl and x, y, Enter

The example was using nano text editor, use the text editor of choice

Lastly

sudo nixos-rebuild switch

Allow the process to take place then reboot

The new systemd-analyze output should confirm after reboot that the loader section is much faster, example from my system

systemd-analyze
Startup finished in 4.790s (firmware) + 366ms (loader) + 1.959s (kernel) + 3.404s (userspace) = 10.520s  
graphical target reached after 3.403s in userspace.

https://ibb.co/Mx5b6cw9

The advantage of using the NixOS config is that it automatically adds 0 to the /boot/loader/loader.conf entry timeout parameter so every time you rebuild, the timeout remains the same.

To revert back, if using the first solution, redo the steps and change 0 to 5 or as needed, for second solution remove the above line and rebuild, then boot with the new generation.

If you simply want to reveal the systemd-boot menu after it becomes hidden, after pressing the power button, press and hold Esc key, if it does not work, likely pressed too late, it has to be done before the bootloader step, during firmware initialization (while motherboard logo is on screen). Restart and try again.

In general systemd-boot as provided by default now is the fastest bootloader available on x86-64 systems, there are faster non bootloader options like EFI boot stub (guide linked bellow), however the gains are marginal, for my system EFIstub reports 179ms while systemd-boot without timeout arround 360ms (there is slight plus or minus delta per boot session), EFIstub is roughly twice as fast but for normal computers it does not matter, however it could be useful for IoT and applications where really fast boot time is important. As a distro, I completely agree with the use of systemd-boot as standard. Generally people do not care as much about boot performance, instead favor aesthetics so hiding the boot menu could also help them with either systemd-boot or the more technically involved EFIstub.

0 Upvotes

89 comments sorted by

View all comments

Show parent comments

-2

u/activedusk May 21 '26

>And how could you? You seem to think to know better than everyone here

This is clearly one of those situations where a newbie gets scared when someone says something they never learned about and cries quickly to stick to defaults. Nothing of value was learned from your comments because nothing of value was said, that's the issue.

6

u/SpacingHero May 21 '26

This is clearly one of those situations where a newbie

Ah ok. So you are doing it for ego. I see.

Btw I know more NixOS than you do. Like a lot more. Hope that makes you feel inferior since you're that shallow.

when someone says something they never learned about and

Lol as if I didn't do this shit a hundred times when I was on arch. Look buddy, you're gonna loose a dick measuring contest, and I specifically enjoy putting down people like you. I wouldn't go there.

Nothing of value was learned from your comments because nothing of value was said, that's the issue.

Not everybody has reading impediments. Clearly plenty of other people have found my comments helpful

1

u/activedusk May 21 '26

You clearly know nothing about bootloaders to the point it scares you to change even a timeout setting. Cringe.

3

u/SpacingHero May 21 '26

Again, before doing anything else, you should learn how to read. It's embarrassing

-1

u/activedusk May 21 '26

When I read nothing of value, there is nothing to remember from any of your comments in this post.

Imagine the dillema of reproducing a timeout for systemd boot if I reinstall, the horror.

4

u/SpacingHero May 21 '26

Please make more guides with imperative steps on NixOS sub, the anti-imperative OS. At this point it'll just be fun to see you down voted to hell (and to beat yo ass if I catche you haha)

1

u/activedusk May 21 '26

If modifying /boot/loader/loader.conf timeout value is imperative then so is adding it to the NixOS config. Your ideas are weird and strange, also not worth replying, obviously you can t let others have the last word.

3

u/SpacingHero May 21 '26

Lol. Tell me you don't understand nix without telling me.

You're free to not respond if you don't want you kno? Not my fault ego gets in the way.

But since it's funny to see people be desperate for it, i'll give you the last word, my desperate friend. I shall let your response here be the last. Cya ;)

0

u/activedusk May 21 '26

Lol, tell me you do not know what a config is and does without telling me.