7 ms·
For those who haven't dug that deep. initramfs is essentially a tiny Linux operating root image that Linux boots to RAM, before it goes on to boot from hard di
by andrewstuart 7y ago
For those who haven't dug that deep.
initramfs is essentially a tiny Linux operating root image that Linux boots to RAM, before it goes on to boot from hard disk.
You can actually configure Linux to never go onto the next step of booting from hard disk, and run the operating system purely from RAM. Indeed there are distros such as Tinycore Linux that are designed exactly this way which can make things very fast compact and secure and diskless.
- solarkraft 7y agoIIRC Chrome OS was designed to do exactly this (in its early days, anyway).
- swiley 7y agoI’m thoroughly convinced google will never be able to produce light weight consumer software. That was their second try at a “light weight operating system” and they so wildly missed the mark both times.
- flatiron 7y agoWell remember what happens. Engineers get it working. It’s a success. Now let’s make some money. Happens with every job. I always seem to mosey on step 3 to another job :)
- microcolonel 7y agoI think they just failed to maintain what they accomplished (I remember when they really did have sub-one-second boot). Google's culture has been dying slowly and painfully over the decade; the less people care, the sadder the products will get.
- GordonS 7y ago> I remember when they really did have sub-one-second boot Wow, as someone who never owned a Chromebook, >1s boot times seem enviable, even if booting into Chrome is rather restrictive. What are boot times like nowadays?
- solarkraft 7y agoThey still advertise sub-8 second boot, but it seems like that's possible with any decently light weight Linux system nowadays.
- meddlepal 7y agoYea but most people are comparing Chromebook boot their Windows laptop or equivalent. No idea what Windows boot time is these days but I'd be shocked of it's under 20 seconds.
- Already__Taken 7y agoEveryone "cheated" that by making going to sleep or hibernating the new norm. My chromebook wakes back to playing the youtube video I was watching quicker than opening the lid.
- pdimitar 7y agoMy 9-year old desktop on Windows 10 boots in <15 seconds. SSDs do make a huge difference. But I'm unsure which class of hardware were you talking about.
- cmurf 7y agoOn my HP Spectre dual-boot Windows 10 / Fedora Workstation 31, it's roughly 6s and 12s respectively.
- toast0 7y agoFor my windows systems, a majority of boot time seems to be in pre-boot environment (bios/uefi/whatever), once it hits the disk it's pretty fast. They're all ssds though, because Windows 10 on spinning disks seems intollerable. I'm pretty sure Microsoft cheats the boot process, and it's a special hibernation restore, but either way, it's pretty fast. Chrome devices benefit from also having a much faster firmware than most, so even if Windows booted as fast as Chrome OS, the whole device would still be much slower to boot.
- ynx 7y agoA lot of its key people ended up at a startup which was acquired by another of the FAANGs.
- transpute 7y agoIf there isn't enough memory to fully unpack the initramfs, Linux 4.x kernels will log a message and silently proceed with a partial filesystem, instead of panic/halt. The resulting failures can take time to root-cause. Haven't tested on 5.x kernels, but similar code is still present: https://github.com/torvalds/linux/blob/master/init/initramfs.c https://github.com/torvalds/linux/blob/master/init/initramfs...
- 3xblah 7y agoWhat happens when out of memory on Tinycore.^1,2 1. On NetBSD, I could make RAM-only, no swap distributions that might thrash but would gracefully recover once some RAM was freed. 2. On Ubuntu, when running from a tmpfs root, I have found that running out of memory causes unrepairable filesystem errors.
- Nursie 7y agoIt's essential on some embedded boards as a first step because a well crafted initramfs can fit in a few MB of flash, and it's sometimes the case that the onboard bootloader can read the flash but has no other capabilites (well, aside from usually tftp). So you read the kernel and initramfs from there, then load the real root FS from whatever storage you need to.
- megous 7y agoYou can also go in reverse, and escape the running distribution's mounted / by pivoting to a tmpfs /, kill all processes and unmount the old root. Figuring out how to do this was quite fun. Systemd makes it actually fairly easy, because you can easily hijack the PID 1 if it's systemd, which is necessary to be able to umount the old /.
- Hello71 7y agosystemd makes it the most easy. all you need is systemctl switch-root ROOT. on other inits, you usually need to replace /sbin/init, then use some non-portable (sysvinit is not the only competitor) method of telling init to re-exec itself. sometimes that method doesn't even stop the running services, so you need to either manually stop them, or kill them.
- CameronNemo 7y agoIn what situations would you expect a re-exec to stop the services? The normal case is that the reexec preserves state.
- Hello71 7y agoIIRC, some init implementations have this capability. I'm not saying that it's good in general, but just that it facilitates this particular case.
- megous 7y agoYou can do it non-destructively by bind mounting a binary from ramfs over /bin/init When it reexecs, the new binary can kill and umount everything and switch roots. If it fails somehow, you just reboot and everything is back to normal.
- arminiusreturns 7y agoIt is also useful for some other interesting use cases. For example I have done what I call "initram shims" to give me a way to enter FDE passwords on remote systems during boot.