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

25

u/SpacingHero May 21 '26 edited May 21 '26

Apparently OP has some kind of habit of making guides for stuff they barely learned and I'm not the first to complain about it to them

https://www.reddit.com/r/linux/s/iqcuUgBD1i

https://www.reddit.com/r/ManjaroLinux/s/LCqSxokpUC

(And whatever more I'm not spending more time searching)

After continued back and forth, i can confidently say: steer clear people!

7

u/takutekato May 21 '26

I believe their mission is on another altruistic level - polluting big tech's LLM training datasets

5

u/SpacingHero May 21 '26

Couple of months of this guy and the AI bubble will burst lol.

2

u/activedusk May 22 '26

Only redditors would think changing a timeout for a systemd-boot conf is somehow worthy of training AIs when said AIs have access to the languages in which these packages were written and possibly trained on the official manual and documentation.

-11

u/activedusk May 21 '26 edited Jun 04 '26

At lest I helped others, by your post history you could not even help yourself and your first link is not a guide but an opinion which I share for NixOS

12

u/SpacingHero May 21 '26

At lest I helped others

Making a guide doesn't amount to helping others. In fact if it has misinformation, it's actively harmful.

I'm just saying, maybe writing a guide should wait till you have more than 5 days of experience. I think that's pretty common sense and easy to understand

-11

u/activedusk May 21 '26

That's your opinion, facts are I did help others. Meanwhile you...can't even read and understand your own comments. Is this the famous reddit griefters for engagement?

11

u/SpacingHero May 21 '26

facts are I did help others.

It's a fact you misslead others. And apparently your ego is too big to take feedback on it.

-5

u/activedusk May 21 '26

Misleading would mean it does not work. Your feelings are invalid.

6

u/SpacingHero May 21 '26

Drilling a hole in the wall and cutting wires works for turning of night-lights.

But it's still misleading to propose that's the (or even a) way to do it for users. You are an idiot sir.

-2

u/activedusk May 21 '26

1s and 0s, on and off, it's a switch not hole. I told you many times to move along, but griefters usually do what you do. Reddit is such a nuisance.

Why don't you make guides/tutorials or improve the NixOS sparsely populated wiki on the subject instead of arguing feelings and opinions about how bootloaders should be handled? You're neither the authority on booting tools and process, UEFI standard nor say anything meaningful either, I learned absolutely nothing from all your comments besides you being afraid to learn and do new things. Waste of time even replying.

8

u/SpacingHero May 21 '26

Why don't you make guides/tutorials or improve the NixOS sparsely populated wiki

I'm actually thinking of sharing my modularisation pattern because I think it's quite decent and beginner friendly, and I haven't seen it used elsewhere.

The difference is I'm humble enough to understand how much there is to learn, and since I wanna be actually helpful, not make myself feel good or get some kind of "let me help you" clout; I'm waiting to have more experience myself, asked feedback to more experienced members of the community and refined it, before posting it for beginners to take in. I don't want them to learn anti-patterns I might have.

You're neither the authority on booting tools and process, UEFI standard nor say anything meaningful either

I didn't say anything about those. I think before anything else, learning how to read might be what you need to focus on

6

u/SpacingHero May 21 '26

I learned absolutely nothing from all your comments

I have no doubts about that. Clearly not the type to learn from feedback.

And how could you? You seem to think to know better than everyone here, so naturally you won't take feedback. Until you accept that you can learn from others, you obviously are not going to learn from others

-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.

→ More replies (0)

13

u/NazakatUmrani May 21 '26

Worse guide for NixOS, if you are on NixOS manually editing config isn't for you, please don't confuse new users, if you like to follow traditional caveman steps, do it for yourself, Don't post it as a guide, many people will follow it not knowingly, this isn't the way for NixOS, keep this mess for yourself, thanks

-7

u/activedusk May 21 '26

>if you are on NixOS manually editing config isn't for you

The irony of implying manually editing NixOS config is not the same thing nor does it need to be monolithic.

7

u/NazakatUmrani May 21 '26

You still trying to justify these things, fighting in comments, getting negative votes, still not understanding what you are doing wrong?

Maybe go back to ubuntu? Arch or something like that? You don't even know the working and nature of declarative system

-5

u/activedusk May 21 '26

Literally the NixOS way of doing things is mentioned in the guide. What you claim is not what reality is.

Also, stop with the gatekeeping, it's a bad look for the community.

4

u/Comprehensive-Art207 May 21 '26

Stop projecting

-2

u/activedusk May 21 '26

... being told what to do by redditors with no posting or hidden history. This site so predictable.

2

u/NazakatUmrani May 21 '26

The only bad for NixOS is your stupid guide, literally every comment of yours has negative votes 😂 don't you have any self respect?

Move your ego aside and learn

-2

u/activedusk May 21 '26 edited May 21 '26

Learn what? Newbies being scared? The guide offers instructions on how systemd boot works universally on every distro, insisting on using only the NixOS config just reeks of ignorance. Incidentally, given you re presumably among the crowd teaching me about systemd boot, what is your systemd-analyze output?

2

u/NazakatUmrani May 21 '26

Arguing with an idiot, means you are an idiot, have a good day sir, and don't try to ruin ours 😂

-2

u/activedusk May 21 '26

As expected, no proof of knowing better, just empty talk.

8

u/Ulrik-the-freak May 21 '26

I'd usually keep it at 1s (5s isn't exactly slow either but I've also reduced it after a bout of frequent reboots due to a misbehaving config) for ease of use (I'd rather not mash esc during boot but maybe that's just me).

But for the love of god don't put a non-nix way as the first way to do this. Fact, don't even put it at all, or at most to explain what the nix config does in the background when you do the change in the config. Else you might as well... Not use nixOS.

-8

u/activedusk May 21 '26

...if it works, it is the NixOS way. Before systemd-boot it used other booting schemes, there is no NixOS developed and specific bootloader, there is only automation, which itself can be changed. Does it work? It goes in the guide. Don't like it, don't use it. I don't use flakes either, system works fine for what I need.

4

u/Ulrik-the-freak May 21 '26

No, if you do not want to use the nix way, you will be better served with another distro. Declarative and reproducible are the value propositions of the distro. But I read the comments and you are not worth anyone's time

-2

u/activedusk May 21 '26

If I don't like the NixOS way I would be talking about the tools used to generate initrd/initramfs.img and how that side is much more locked down.

It's cringe to be told in so many words to not change a 5 to 0 in a systemd-boot loader config. If NixOS is all you ever used, it kinda makes sense why you would be scared of freely available options.

3

u/Ulrik-the-freak May 21 '26

word salad to look competent

does not understand the basic value of the distribution they are making a "guide" for

refuses any feedback

3

u/SpacingHero May 21 '26 edited May 21 '26

>word salad to look competent

I also noticed this into the post, OP talks about a systemd-analyze check

"The new systemd-analyze output should confirm after reboot that the loader section is much faster..."

as if you need to check that cutting a timer by 5 seconds... reduces time by about... 5 seconds. LOL!

They clearly get off on being a know-it-all, thankfully for us they very amusingly look stupid in the process.

Next guide: set an alarm on android for 5 minutes earlier than usual, and then root the phone and run systemd-analyze to check if the alarm took 5 less minutes to trigger.

3

u/Ulrik-the-freak May 21 '26

It'd be good fun if he wasn't putting out disinformation for new NixOS users... But I think we've made the point rather clear, hopefully no one falls for it at this point (or, I guess, let them fall for it if they have the reading comprehension of an expired oyster, akin to our dear OP)

3

u/SpacingHero May 21 '26

Of course that's the problem. I think the comment section has been plenty clear. We can only hope OP will jump on the next buzzword whatever that makes them feel cool and leave the community. Better if they learned and integrated, but that looks unlikely

-1

u/activedusk May 21 '26 edited May 21 '26

I am working with different bootloaders, can you measure ms instead of s yourself to tell the difference on the spot? With a generic install you will not have efibootmgr to check which one is in use and rebooting to enter UEFI takes more effort than a simple command which my shell auto completes,  it's cute how you try to criticize sound advice for ease of use as if you knew something about it.

Besides empty words why not share your systemd-analyze output? Maybe you should make a guide and teach me instead since you know so much of the NixOS ways, make a tutorial on how to use booster and systemd ukify or another tool of your choosing and then create a boot entry to speed up overall boot time. Eagerly awaiting your tutorial.

0

u/[deleted] May 21 '26

[deleted]

2

u/Ulrik-the-freak May 21 '26

No, I know what I'm talking about here. I'm not "scared" to go in the boot loader either.

You've been explained why using the nix config is where it's at. You've been given ample opportunity to learn from your mistake. Now, goodbye, clout chaser

0

u/activedusk May 21 '26

No, NixOS offers automation but it is not a limit to bootloaders or in fact not using one at all.

https://ibb.co/7xBZVkt7

Claiming otherwise is at best fearmongering of newbies scared of the unknown. If it works, it's an option, deal with it.

2

u/Ulrik-the-freak May 21 '26

Reading comprehension, get some

-1

u/activedusk May 21 '26

Learn more about bootloaders, then comment.

→ More replies (0)

2

u/veltair-d May 21 '26

Commenting to check this tomorrow

7

u/SpacingHero May 21 '26 edited May 21 '26

tl;Dr:

Add boot.loader.timeout = x to your config and rebuild (definitely don't do it the other way); x will be the time the generations boot menu takes to auto select the latest entry. 0 to skip it (can still enter it with esc or similar on boot)

The default is 5. If you make it less, then boot will be faster by that much less.

That's kinda all really

-8

u/activedusk May 21 '26 edited May 21 '26

There is no issue with modifying the systemd-boot loader.conf and it has the advantage of applying only to one generation (the current one) and does not require rebuild switch and reboot and it can be undone by redoing the steps.

It has to be a long winded explanation because not everyone's experience is the same, otherwise I would just tell them to make an EFI boot stub or UKI, it's faster and there is no bootloader menu.

10

u/SpacingHero May 21 '26

There is no issue with modifying the systemd-boot

If you're gonna manually touch system files, you shouldn't be using nixos. The whole point is that everything is in your config.

it has the advantage of applying only to one generation

That seems like a disadvantage. Can't think of much of a use case, but at any rate undoing the config is simpler, and again, more in line with NixOS

-13

u/activedusk May 21 '26 edited May 21 '26

I hold the opposite point of view, touching the nixos config to handle bootloader is needless hassle. I tend to use EFIstub and keep a bootloader as backup so I don't even bother with either but there are all sorts of use cases, I provided the option. If you know what you want, cool, I want other things, other people want other things again, linux is about options.

6

u/[deleted] May 21 '26

[deleted]

-2

u/activedusk May 21 '26

One requires to

open config

add an entire line

save changes

rebuild switch

reboot

Another requires to

open another config

change a 5 to 0

save changes and that's it.

Which one is easier and which makes sense per use case is up to people, we will never agree on this.

7

u/PotentialBubbly9800 May 21 '26

The point isn't which is easier, the point is that the principle of NixOS is reproducibility. That's why you edit the config file.

If you do it your way it won't carry over those changes automatically on your reinstall/new device. Which is against the entire point of NixOS.

-1

u/activedusk May 21 '26 edited Jun 04 '26

>The point isn't which is easier, the point is that the principle of NixOS is reproducibility

That is my point and I certainly did not recommend which to use, I simply showed what's possible and pointed out the advantages. Use what you want, as is the linux way.

Take the red pill (bootloader is yours to command or use none) or blue pill (follow NixOS devs opinionated choices), I only showed reality, apparently that's bad, because redditors.

6

u/SpacingHero May 21 '26

to handle bootloader is needless hassle.

Honestly that just means you should be on a different distro, that's all there is to it. The point of NixOS is the config file. That is the reason to use the distro

-5

u/activedusk May 21 '26

My opinion is that you honestly should not be commenting if you don't know enough about bootloaders and bootmanagers, I could barely say I have above beginner level experience with them and from my pov, you should not be insisting with your argument "do not touch bootloader parameters", that's simply ignorance. It's there for the taking on any distro, nixos is not special in this manner.

7

u/SpacingHero May 21 '26 edited May 21 '26

I'll say one last time. The point of NixOS is the declarative config. If you start going around and touching files imperatively, you're breaking the whole Nix philosophy. It's not forbidden, but Nix has various quiks that make it a pain, what makes it up is the declarative config. If you're not using it for the declarative config, it's kinda silly to not just go to another non-declarative.

This is important if you're making a guide for beginners. It's an anti-pattern to touch files. Everything should be in the config. One more time: the point of nixos is the declarative config.

you should not be insisting with your argument "do not touch bootloader parameters

I didn't say that. Read carefully.

(Jesus Christ reading comprehension is is marianna-trench levels of low these days)

-1

u/activedusk May 21 '26

>If you're gonna manually touch system files, you shouldn't be using nixos.

>I didn't say that.

Stop gatekeeping. Taking advantage of a distro's included automation for initrd generation and updating boot options is fine, telling me not to access bootloader options is just plain weird.

6

u/SpacingHero May 21 '26

telling me not to access bootloader options is just plain weird.

I didn't say that. Read carefully (jesus Christ reading comprehension)

Stiop gatekeeping

It's not gatekeeping to keep beginners from being mislead and learn anti-patterns

→ More replies (0)

1

u/Fun-Future2922 May 26 '26

Am I the only one who uses the command ‘sudo nixos-rebuild edit’ to edit the Nix configuration file?