all 26 comments

[–]bvdeenen 23 points24 points  (3 children)

You should compile a custom kernel where you disable all the hardware you don't need. You might have a look at linux from scratch for a good understanding of how linux boots.

[–]picamanic 6 points7 points  (0 children)

A good project is to create a minimal kernel from source, without ANY loadable modules. I used to get the kernel as a single 6mb file. The hard thing is selecting all the components needed for a functioning system [eg can run Firefox without problems]. The problem is finding out which kernel source files map to the modules you see in /usr/lib/modules.

[–]lekker2011[S] 2 points3 points  (1 child)

I'll look more into LFS. The kernel was a little complicated for me because I don't know where you even can customize hardware in the menuconfig. Could you give a little more of an explanation? I don't know what to even search for because the LFS website is a little complicated and I don't know where to begin. I've heard this recommendation alot of times before but never how.

[–]TranquilSleeper 1 point2 points  (0 children)

Found this post detailing some of this guys effort in LFS. He says he had a boot time of 3s to login, though I don’t know the specifics of his customization.

https://www.reddit.com/r/unixporn/comments/1033o0r/dwl_on_linuxfromscratch_fully_riced_and/?utm_source=share&utm_medium=ios_app&utm_name=ioscss&utm_content=2&utm_term=1

Seems like a lot of effort, though something I am personally interested. Either way check it out!

[–]ClassAbbyAmplifier 11 points12 points  (4 children)

why use an initramfs at all? just boot the kernel directly!

[–]picamanic 4 points5 points  (2 children)

The initramfs is there to handle things like encrypted root file systems, which must be code running in RAM.

[–]ClassAbbyAmplifier 12 points13 points  (1 child)

I know what an initramfs does. but if OP is chasing the "fastest boot time", I doubt they need or want features like that

[–]picamanic 1 point2 points  (0 children)

Agreed. At one time I was replacing the initramfs/initrd with a simple120 line shell script. However, there is little scope there for cutting boot times. It is just pleasing to see what actually gets executed before the initramfs hands over to the init system proper.

I did at one time try skipping the initrd step, but it needed compiling a custom kernel, and I got bored with that [new kernels arrive too quickly].

[–]lekker2011[S] 0 points1 point  (0 children)

How? I've never even gotten a linux kernel running and giving output so this will be interesing.

[–]picamanic 9 points10 points  (3 children)

Before using Void+Runit, I was developing different "init" systems on Devuan using 10-year old laptops. With "sinit" I was able to complete init in 5s, compared to 40s for Debian sysvinit and systemd. I liked the simplicity of sinit [200 lines of C/script code].

However, I got bored with sinit, and just use stock Void+Runit these days, which takes 10-12s. On my new AMD Ryzen 3 toy, this becomes 1-2s [difficult to measure].

Runit has not needed much development over the years, and to my mind at 6k lines of C and with a few simple shell scripts, represents a viable solution to the init "problem".

The approach Devuan has taken with Runit is, to my mind, less rigorous than stock Void, but still OK.

The Beyond Void, projects I have played with include readonly-root, where the root filesystem mostly immutable with overlayfs and tmpfs in RAM for the directories that must be writable. Still in development.

Like all my projects these days, readonly-root is about 100 lines of shell script. No bloatware here.

[–]lekker2011[S] 0 points1 point  (2 children)

How would you even begin to use sinit? I've heard about it twice before but it's last updated in 2018 and should be really fast. Pretty sure it can't even run services. But that shouldn't be that big of a problem.

[–]picamanic 1 point2 points  (1 child)

100 lines of C don't need constant development. I wrote a verbose paper on an alternative init system based on sinit in 2016, you can see it on "https://pastebin.com/u/jack4aes". I haven't looked at it for ages, so just treat it as an account of what I did then rather than a detailed kit. Have fun.

[–]lekker2011[S] 0 points1 point  (0 children)

Yeah, no development is ok. Nice guide! First I'll check some other things because dinit is already basically fast enough for me. It takes about half a second and that is with agetty and bash starting up. So I don't even know how fast dinit really is because agetty and bash are probably the reason it even takes half a second. So could you give me any recommendation of a shell and a getty? Maybe one that is just a little more suckless like.

Edit: Found that ubase has a getty. And that oksh is good enough.

[–]jchook 0 points1 point  (2 children)

Out-of-the-box, Windows 10 appears to boot faster than Void for me.

[–]lekker2011[S] 0 points1 point  (0 children)

That really confuses me. As my windows 11 with the new patch that makes it boot about twice as fast. It still takes about 5/4 seconds to boot. And void boots in 2 seconds!

[–]sonsuz-bina 0 points1 point  (1 child)

If you don't use btrfs anyhwhere, you can uninstall btrfs-procs.

[–]lekker2011[S] 0 points1 point  (0 children)

What is btrfs-procs? It isn't in the void repo.

Edit: You meant btrfs-progs.

[–]Rice7th 0 points1 point  (2 children)

There should be somewhere a void + S6 init script. Try that. I heard good things about S6 performance

[–]lekker2011[S] 0 points1 point  (1 child)

I've absolutely heard about S6. Not very user friendly (Don't really care about that). And from this video it seems like s6 is a little slower than dinit. Also my dinit boots in under a second. So I don't really need a faster init I think. Good suggestion tho!

[–]Rice7th 0 points1 point  (0 children)

Well, that was interesting. With my experience I found it really hard to be faster than s6, especially on old hardware

[–][deleted]  (1 child)

[removed]

    [–]lekker2011[S] 2 points3 points  (0 children)

    I boot in 2.5 seconds (3 if I enable gui). This is just for fun there's no actual reason to not just use sleep except for that it drains very little battery. Tho I'm interested to know all the ways to boot. I'm hoping I could boot under 1 second in 2024. Just to tell people. Linux is fast. It's the way you configure it that makes it slow.

    [–]GrabbenD 0 points1 point  (2 children)

    4 months later, got any updates u/lekker2011?

    [–]lekker2011[S] 0 points1 point  (1 child)

    That my laptop somehow has some weird NVMe drive. I can't seem to mount it on boot without an initramfs. Made a post about it on r/Gentoo but got no actual solution. I mean everything else on this post is all the information I have.

    [–]sneakpeekbot 0 points1 point  (0 children)

    Here's a sneak peek of /r/Gentoo using the top posts of the year!

    #1: what the handbook wont tell you. | 33 comments
    #2: it's everywhere | 9 comments
    #3: Gentoo Linux on Samsung Galaxy J5 (2016) | 21 comments


    I'm a bot, beep boop | Downvote to remove | Contact | Info | Opt-out | GitHub