News for hackers. Stuff that matters.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by PragmaticPulp on Saturday October 23, 2021 @02:42PM (#28971126)
This is a common technique in embedded products, but I should point out that it's not useful for general purpose Raspberry Pi work.

The author disables several important kernel features to boot faster, including network support and USB support. Obviously, if you plan to use network or USB then it's not an option to disable those. You can disable some of the other debugging features and little extras for a slight boost, but it's going to be negligible (<1s, in my experience).

The biggest change comes from removing the init system entirely and replacing it with the user-facing app. This is the fastest way to get your app started, but now you're responsible for doing everything that was previously handled by the init system. The author can do this because they don't have any network, timekeeping, or other system functions normally handled by the init system. They only needs to mount filesystems, which is easy to replicate inside of the app.

Anyone planning to ship a Raspberry Pi based product should read this article carefully as a great starting point. Anyone who wants to use their Raspberry Pi for general purpose use or even with network connectivity or USB devices will be disappointed if they try these techniques. Great article, but it's a narrow use case.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by lhl on Saturday October 23, 2021 @03:34PM (#28971509)
A few years ago, there was an article on getting a fully functional Linux booted on an rpi in 3-4s which has a few other, maybe more generally useful tips for speeding up startup times: http://himeshp.blogspot.com/2018/08/fast-boot-with-raspberry...
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by pchanda on Saturday October 23, 2021 @04:24PM (#28971907)
The bootlin training slides on embedded linux boot time optimisation is also quite informative: https://bootlin.com/doc/training/boot-time/boot-time-slides....
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by _red on Saturday October 23, 2021 @03:23PM (#28971415)
Great points, a tangential thought:

MacOS and Windows have figured out that showing a GUI ASAP satisfies the user. Even if in the background its still negotiating networks, initializing sub-systems, etc.

I wonder why Linux has not yet taken that approach? That is move GUI far up in the init-queue and let it initialize networks, avahi, resolved, firewalld, etc as GUI is showing login screen...

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by rusk on Saturday October 23, 2021 @03:29PM (#28971463)
> satisfies the user

Does it though? Has this ever really satisfied you … that you get to login and then circle your mouse for a few minutes while you wait for things to kick off.

Na, all or nothing please I don’t want to be teased by an is-it-isn’t-it experience I want my boot to take its time, let me know what’s going on and when it’s all there let me enjoy a responsive experience.

It’s just a cheap trick and it probably doesn’t matter as much as they think it does.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by fizzynut on Saturday October 23, 2021 @05:57PM (#28972748)
Cheap tricks can create a much more responsive experience.

Whenever a user interactable element will be ready in <~100ms, you can display it as ready now, because it is faster than the reaction speed of a human, which makes all interactions with the software faster, smoother and more responsive than if I used a loading indicator. It's a free win.

Whenever you know in advance you need to display something to the user and need to load/process something that takes much longer than 100ms, you can load in the background while displaying whatever needs to be displayed and if the time spent on the screen is slower than the loading time then the next interaction will be instant (common case), if the user is faster on the screen you can still go to a loading screen, but the time it is on screen for would still be much much shorter.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by rusk on Sunday October 24, 2021 @05:42AM (#28976302)
> Whenever you know in advance

Knowing things in advance is not a cheap trick. I’m not talking about a well structured boot. I’m talking about the far more common approach of just showing a moving mouse pointer and a few icons and “pretending” the computer is ready to use, a notion that is quickly disabused as soon as you try to get to work. Then even, you will her no way to know when it “is” actually ready.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by grayhatter on Saturday October 23, 2021 @03:47PM (#28971618)
Do you believe that you can reason about a computer? I'm going to assume yes. If you'd rather your computer do the countable number of things you know it needs to do, before it draws to the display because it's faster. That's only because you know thoes things exist, and how long they should reasonably take. Most users can't count them, nor do they trust their computer. The loading screen does satisfy them because they know the computer hasn't randomly crapped out... *again*. People who don't understand how to fix computers don't trust them. Rightfully so, they generally dont do what their owner/users want, and randomly will just break costing more money, for seemingly no reason. Those loading screens prevent some of the anxiety of using something you need when you don't understand any part of it.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by smoldesu on Saturday October 23, 2021 @04:06PM (#28971757)
Today's laptops and the majority of desktops boot more than 10x faster than they did a decade ago, so for all but the youngest users I feel like this point is moot. There was an age where you had to go get a coffee while your hard drive started spinning up, I remember kids starting their Macbooks before they got in the car for school so they'd be booted by the time they were in class...
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by bitwize on Saturday October 23, 2021 @04:15PM (#28971831)
When I was a kid, kids weren't issued MacBooks for class. There was a single, lone Apple II in the back we played Oregon Trail on -- and it took a fair few minutes to load from floppy.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by nl on Saturday October 23, 2021 @06:35PM (#28973041)
A floppy drive? Get off my lawn

On my C64 I'd start loading a game from cassette tape before dinner so I could play it afterwards.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by jamiek88 on Sunday October 24, 2021 @02:45AM (#28975482)
Cassette? Pah!

I had to type the games source code in from a magazine for my acorn electron.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by noizejoy on Saturday October 23, 2021 @08:15PM (#28973663)
Cassette tape?

Punched tape[0]: Hold my beer

[0] https://en.wikipedia.org/wiki/Punched_tape

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by nl on Sunday October 24, 2021 @12:52AM (#28975075)
I don't think punched tape or punched card was ever used for a personal computer though.

The Altair launched with a cassette tape interface anyway.

https://en.m.wikipedia.org/wiki/Altair_8800

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by noizejoy on Monday October 25, 2021 @02:54PM (#28991642)
Fair enough, but would it be fair to argue that personal computer is a pricing distinction, rather than a technology distinction?

In my mental model, the technology distinction is more between single user and multi-user systems. And arguably that is more a a software differentiator than a hardware difference.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by gzer0 on Sunday October 24, 2021 @12:46AM (#28975052)
Floppy drive?

On my 9 track tape I would be lucky if the thing loaded and was ready to use 72 hours later [1].

[1] https://en.wikipedia.org/wiki/9_track_tape

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by rusk on Saturday October 23, 2021 @07:52PM (#28973549)
I … think I agree with you …
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by II2II on Saturday October 23, 2021 @05:48PM (#28972679)
Yes, it does matter. If Microsoft switched things up to provide users with a responsive desktop just after logging by loading more services before the login screen comes up, existing Windows users would perceive it as slower. If Linux distributions delayed the loading of services at the expense of a less responsive desktop just after logging in, existing Linux users would perceive it as slower. Simply put, each user base is using different metrics for boot time and their metrics are based upon their prior experiences.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by MuffinFlavored on Sunday October 24, 2021 @10:24PM (#28983914)
> for a few minutes

When is the last time you cold booted a modern Apple Macbook for example?... Minutes is an absolute exaggeration.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by bayindirh on Saturday October 23, 2021 @03:34PM (#28971501)
> I wonder why Linux has not yet taken that approach? That is move GUI far up in the init-queue and let it initialize networks, avahi, resolved, firewalld, etc as GUI is showing login screen...

Because it boots faster than a Windows system in that scenario. I personally like to be able to use my system as soon as the desktop is visible.

Also this is the way. When your system boots, it boots.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by fortran77 on Saturday October 23, 2021 @04:05PM (#28971755)
I just timed my Windows 11 vs my Ubuntu. Windows 11 booted faster to a usable GUI by a factor of about 2:1
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by bayindirh on Saturday October 23, 2021 @04:14PM (#28971821)
> Windows 11 booted faster to a usable GUI by a factor of about 2:1

Probably used fast boot and returned from an image. :)

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by ohgodplsno on Saturday October 23, 2021 @04:59PM (#28972201)
From a fully fresh start on an NVMe, Windows 10 does start up approximately just as fast as a brand new Debian install.

With the added benefit of not having X11 setting modes 5 times in the mean time.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by harshitaneja on Sunday October 24, 2021 @12:51AM (#28975069)
This is quite surprising. My experience has been quite different. Have you run systemd-analyze to try to locate what's causing the slower boot?
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by jraph on Sunday October 24, 2021 @02:49AM (#28975491)
Surprising indeed. Windows 10 boots quite quickly (don't know about Windows 11) but the boot of a fresh install of the latest version of Debian feels instantaneous. In a systemd container, it boots under 2 seconds even with a few extra services.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by bayindirh on Sunday October 24, 2021 @03:40AM (#28975688)
> but the boot of a fresh install of the latest version of Debian feels instantaneous.

Starting with latest iterations CentOS 7 and Debian 10, booting Linux is almost instantaneous. We have quite a few VMs, and after restarting one (i.e.: reboot <enter>), I just need to sip a little coffee to be able to SSH into a fully booted system.

On the other hand some of the higher end servers we have can fit a meaningful chat to the booting process (in fast boot mode, no less).

This means that most of the overhead is hardware initialization waits, IO and GRUB.

BTW, X11 is not modesetting 5 times on me. Maybe the first modeset you see is kernel's terminal modeset?

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by GekkePrutser on Saturday October 23, 2021 @11:09PM (#28974586)
Windows has a trick for that. It actually hibernates the OS, GUI, Drivers etc when you shut down, just without any apps running. This way it can come back up in seconds.

You'll notice that after you install a new device driver it'll boot much slower. This is because it invalidates the hibernate image and does an actual boot next time.

It's also why it won't let you fiddle with the BIOS settings before it does a quick boot. Because the hibernate image presumes the exact same hardware configuration.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by c21h30o2 on Sunday October 24, 2021 @12:38AM (#28975019)
And it doesn't unmount partitions when you shut down so if you use Windows one day and Linux the next you have to boot up Windows first and then reboot into Linux so that Windows will unmount its partitions, otherwise Linux can't mount them.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by GekkePrutser on Sunday October 24, 2021 @07:23PM (#28982857)
Oh yeah good point. I forgot about that.

Linux updates also wreck bitlocker if the windows partition is on the same drive (which I have to use for work) so I left the whole dualboot thing behind.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by fistynuts on Saturday October 23, 2021 @03:48PM (#28971625)
I have to say I agree. Presenting a login screen early is a great idea, as most people take a short while to log in, and in that time system can finish initialising - as long as there is enough free CPU and interrupts to service the keyboard and mouse during that time.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by moron4hire on Saturday October 23, 2021 @04:11PM (#28971802)
I even do this in my web apps. The login screen shows immediately, and while the user is filling it out, the WebGL app and assets are loading in the background. The login button doesn't become enabled until the audio system is loaded, so that the click on the login button can be used as the User Gesture to activate the AudioContext.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by ranger_danger on Saturday October 23, 2021 @10:49PM (#28974515)
why do you need WebGL and an AudioContext to click a login button??
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by moron4hire on Sunday October 24, 2021 @05:14PM (#28981996)
I don't? Why would you think I did? My app is a WebXR social app. You need to login first, and I use the login process as an opportunity to make a better user experience.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by aidenn0 on Saturday October 23, 2021 @04:29PM (#28971936)
I have rewritten my init system in the past to start xorg before e.g. DHCP initializes.

It takes about 5 seconds to login anyways, so DHCP is usually done before my browser wants network

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by m45t3r on Saturday October 23, 2021 @06:44PM (#28973107)
If you're using systemd and NetworkManager, this is already what happens. Services that depend on network are delayed until a connection is made, that generally only happens after login.

If you're using something else than yes, the start of network services are made during boot. But it can be argued that if you're not using NetworkManager, you are a server and wouldn't benefit from delayed connection.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by ranger_danger on Saturday October 23, 2021 @10:45PM (#28974493)
Because you would have to assume too many things.

What if the GUI bring-up required mounting filesystems that need a kernel module that hasn't loaded yet?

What if the filesystem is on a network?

What if the network isn't up yet?

What if someone's xinit script needs access to the bluetooth stack which isn't up yet?

And even if the all the "correct" assumptions were made for a default install... doing anything different from that would require unraveling a mess to fix.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by numpad0 on Saturday October 23, 2021 @08:03PM (#28973602)
Because Xorg is just a UNIX app ported to Linux and not an integral part?
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by amelius on Saturday October 23, 2021 @05:57PM (#28972747)
If only the init system was lazy, i.e. running parts of the boot sequence only when required.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by stjohnswarts on Saturday October 23, 2021 @06:31PM (#28973013)
It's very possible in linux. Modules can be loaded and unloaded for some kinds of hardware. I don't know if that's true for rpi though.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by Denvercoder9 on Saturday October 23, 2021 @08:15PM (#28973665)
systemd fully supports that.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by cztomsik on Monday October 25, 2021 @11:30AM (#28988939)
I believe it was meant to be ironic comment, pointing at systemd
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by jandrese on Saturday October 23, 2021 @05:07PM (#28972278)
Doesn't disabling USB cut you off from most of the hardware on a Raspberry Pi?

Come to think of it, doesn't the SD card slot sit off of the USB bus?

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by goodells on Saturday October 23, 2021 @09:32PM (#28974092)
I have at least a few Raspberry Pi's that are programmed to simply boot and hit the aux out. This could be the difference between my car's white noise system coming online before I even shift the car out of park, vs. when I'm in the roundabout a few hundred feet away. Lifechanging.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by mmastrac on Saturday October 23, 2021 @11:07PM (#28974579)
Curious: why does your car have a white noise system?
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by vardump on Saturday October 23, 2021 @06:01PM (#28972780)
> Come to think of it, doesn't the SD card slot sit off of the USB bus?

It doesn't.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by II2II on Saturday October 23, 2021 @08:08PM (#28973634)
You're probably thinking of the ethernet controller, which is often cited for the Pi 3 and earlier.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by Nursie on Sunday October 24, 2021 @08:02AM (#28977130)
Theoretically (I have no idea about the Pi specifically) it's entirely possible for the bootloader to speak USB, load the kernel + initramfs from the device into memory and then then boot a kernel which knows nothing about USB.

This can be done with (for instance) u-boot.

Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by SahAssar on Saturday October 23, 2021 @07:08PM (#28973266)
If it did it wouldn't be able to boot, right? The OS/bootloader is on the SD.
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by sdfhsdfhsdfh on Saturday October 23, 2021 @09:19PM (#28974010)
The bootloader would still support SD, but the kernel would come up just fine without supporting it, as by the time the kernel is booting it's already in memory. You just wouldn't be able to mount any filesystems from that kernel, so you'd be stuck with whatever userland you packed into your initramfs
Re:Raspberry Pi 3 Fastboot – Less Than 2 Seconds by srcmap on Sunday October 24, 2021 @12:03AM (#28974866)
Most the drivers can be configured as ko and one can load them later on - such as after GUI is up. It should give impression of fast boot.