You are not logged in.

#1 2022-08-30 02:24:00

12345
Member
Registered: 2022-07-16
Posts: 6

How much better will boot performance be with a minimal initramfs?

Archwiki says that system boot time can be reduced by optimizing the initramfs. I'm wondering how many seconds can I win using a minimal initramfs? Has anyone done this, what are your results?

Offline

#2 2022-08-30 02:46:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: How much better will boot performance be with a minimal initramfs?

12345 wrote:

I'm wondering how many seconds can I win...

None.  It might be better to ask how many milliseconds, or perhaps microsecond, to which the answer might not be "none" but rather "not enough to care about".

But if you are even able to ask about shaving seconds, something may be wrong - why is it taking seconds in the first place?  You may not need to focus on optimizing, but rather troubleshooting to fix whatever is wrong.

But in any case, for making a minimal initramfs, go for it.  You'll not likely save any time with it, but you'd definitely spend less time trying it out than it will take you to read this reply.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-08-30 03:17:10

12345
Member
Registered: 2022-07-16
Posts: 6

Re: How much better will boot performance be with a minimal initramfs?

Trilby, your answer is absolutely useless, pass by.

Offline

#4 2022-08-30 03:27:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: How much better will boot performance be with a minimal initramfs?

Screw you too.  How is it useless.  What exactly are you looking for - I answered exactly what you asked.

But rest assured, I'll never offer you help again.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-08-30 03:27:33

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,623

Re: How much better will boot performance be with a minimal initramfs?

Actually, his answer is absolutely correct. 
How much less time do you think it will take to read a 10MB file into RAM from a disk vs 30MB (assuming you can cut the size by 3)?
[Hint a rotating disk is on the order of 200MB/sec.  SSDs are on the order of 7000MB/sec.]

Be civil.

Edit:  I guess Trilby and I were responding at the same time.

Last edited by ewaller (2022-08-30 03:28:17)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#6 2022-08-30 03:31:19

loqs
Member
Registered: 2014-03-06
Posts: 18,872

Re: How much better will boot performance be with a minimal initramfs?

Standard kernel from 5.19.4-arch1-1 11MB plus my current initrd produced by mkinitcpio at 10MB round up to 25MB to allow for other utilities this system is missing.
HD transfer rate 100 MBs will perform that in 0.25 seconds.  Unless your system is installed on a USB thumb drive your premise that you can save multiple seconds by reducing the size of the initrd would seem to be flawed.

beaten by ewaller

Offline

#7 2022-08-30 06:41:52

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How much better will boot performance be with a minimal initramfs?

Trilby is correct.
You will probably save less time booting over the lifetime of your computer than it took you to write your post.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#8 2022-08-30 09:32:38

sabroad
Member
Registered: 2015-05-24
Posts: 242

Re: How much better will boot performance be with a minimal initramfs?

12345 wrote:

I'm wondering how many seconds can I win using a minimal initramfs?

Trilby wrote:

something may be wrong - why is it taking seconds in the first place?  You may not need to focus on optimizing, but rather troubleshooting to fix whatever is wrong.

Trilby is right.

My systemd-analyze, for reference:

Startup finished in 5.764s (firmware) + 526ms (loader) + 839ms (kernel) + 684ms (initrd) + 3.579s (userspace) = 11.395s
Minimal initramfs wrote:

The big advantage of creating your own initramfs images is that you can eliminate udev. [...] bigger size lead to longer boots (more data to decompress) but initializing udev itself will also take some extra time.

So, theoretical (but unattainable) best would be to elimitate entirely the loader and initrd to shave 1210ms.

To recover the 5 minutes it's taken for me to volunteer a reply would require almost a years worth of reboots (with me sat waiting to type credentials watching 30m of bios [accumulated]).

Last edited by sabroad (2022-08-30 09:46:04)


--
saint_abroad

Offline

#9 2022-08-30 12:14:57

goran'agar
Member
From: Nothern Italy
Registered: 2009-05-19
Posts: 171

Re: How much better will boot performance be with a minimal initramfs?

This is my personal experience, YMMV.

My old system running a custom kernel optimized for the actual hardware (by me, actually) boots Archlinux 6.5 seconds faster than the default -arch kernel (the last kernel message is the wlan association that happenes a 20s after boot with my kernel and 26.5s with default -arch - userspace is already active at the time). So definitely yes, at least for old hardware it's definitely worth fiddling with all the possible options, but obviously the initramfs is just a very minimal part of it.

Last edited by goran'agar (2022-08-30 12:18:06)


Sony Vaio VPCM13M1E  - Arch Linux - LXDE

Offline

#10 2022-08-30 13:45:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,287

Re: How much better will boot performance be with a minimal initramfs?

@goran'agar - it should be pointed out that this is most likely because of compiling modules into the kernel that otherwise would likely not even be in the initramfs, allowing more HW to be initialized in parallel (and esp. before the root partition is mounted/fsck'd)
That being said: 20s boot time seems kinda excessive (unless "old" falls outside x86-64) and you may or not want to take a closer look at the critical-chain.

Not to pile on too much, but unless the OP is outright trolling, this is an xy-problem.
They seek to shave off *seconds* from their boot time and randomly picked out a somewhat questionable (or unsharp - the purpose might have rather been to save memory on embedded systems) paragraph in the wiki as desired resolution.
And when confronted w/ reality their ego got in the way and they elected to simply reject reality. Happens.

@skroobs_password (google it), revisit the article you linked, start at the top, figure what actually consumes time during the boot and focus your efforts there. Downsizing the initramfs won't do jack-squat.

Offline

#11 2025-03-26 14:48:19

rlees85
Member
From: Daventry, UK
Registered: 2015-04-29
Posts: 98
Website

Re: How much better will boot performance be with a minimal initramfs?

Bit of a necrobump but this is high on Google. It is worth optimising the initial ramdisk and its fairly easy. The main reason though is because of how slow `mkintcpio` is rather than boot time. Also if you are in the cloud (or otherwise have a tiny instance - say 512mb RAM) and you want to EFI boot with a 100mb+ ramdisk, then good luck with that!

The best optimisation is to get rid of fallback ramdisk generation, just make sure you are comfortable with booting from a live environment to fix stuff (personally, I've never needed fallback ramdisk)

The second best optimisation is to get rid of `kms` hook, if your system lets you get away with late initialising graphics, which is not recommended generally.

Tiny savings possible by getting rid of `block` and adding `nvme` module since most root devices are nvme now. You can get rid of `filesystems` all together as well if using ext4 on the root volume.

Managed to get initial ramdisk down to 9mb (autodetect) and about 20mb (no auto detect - good for generic/cloud images) which from 120mb I am delighted with. `mkinitcpio` run is extremely fast in comparison

Offline

#12 2025-07-01 12:33:48

rr
Member
Registered: 2018-03-29
Posts: 2

Re: How much better will boot performance be with a minimal initramfs?

Trillby from 2022 is wrong. Initramfs can do hardware probing when it boots and depending on your hardware this probing can last several seconds. On my machine about 20 seconds are spent in the initramfs stage. If you disable these probing steps it can make a huge difference.

I would not bother too much with compression and such indeed it's not going to make a huge difference.

Last edited by rr (2025-07-01 12:34:46)

Offline

#13 2025-07-01 12:40:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,287

Re: How much better will boot performance be with a minimal initramfs?

Who's Trixie?
The initramfs won't do any HW probing but the kernel but more importantly modules will - and whether they do this in the initramfs only makes a difference if they get loaded before the hardware has initialized.
And "20 seconds" means, as previously indicated, there's some fundamental problem that's completely unrelated to the generic question ITT and much more to your specific HW and setup.
If you want help with that, please open a new thread and post a journal of the delayed boot.

Offline

#14 2025-07-01 12:55:53

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,971

Re: How much better will boot performance be with a minimal initramfs?

Closing this old thread


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB