9 ms·
Booting Linux in five seconds (2008)
- mgraczyk 4y agoI use a Linux desktop and a MacBook for various things, and one of the things I appreciate most about my desktop is how fast it boots. I'm not sure if I configured anything special, I use xubuntu with i3, but it takes around 5s to boot and 1s to shutdown.
- butz 4y agoIf Linux could boot in 5 seconds on low tier hardware in 2008, why do I need to wait ~30 seconds to boot it on modern hardware in 2022?
- ggm 4y agoOn a VM, you often don't. I get login: on a bhyve virtual debian or FreeBSD in seconds. Probably, you're running in a mode which has no "hints" to avoid probe delay costs. Or, depend on subsystems (SCSI?) which depend on device spinup delay to avoid surges in current draw on the PSU, so e.g. raid disk arrays delay boot time to cohere and stabilise before they do cam control. But usually, its because people run un-optimised, generic, factory-shipped because 30s is lost in noise. If you dive down the rabbit hole, you can get a LOT faster.
- derefr 4y ago> so e.g. raid disk arrays delay boot time to cohere and stabilise before they do cam control. Huh. So is that why it takes server hardware two to four minutes to get past the BIOS screen? Gradual PSU-protecting spin-up of hardware RAID?
- Alupis 4y agoDepends on the specific server hardware of course. Generally, yes the hardware RAID controller does consume a great deal of time (often displaying a splash screen with progress on the console, if one is connected at boot). Server hardware also tends to do other hardware checks/validate before booting as well. Some of these checks are able to be disabled, and some others are not. Then, there are systems like IBM iSeries running iOS/OS400 which then hands over to the OS to perform a great deal of system integrity checks before enabling services and I/O. Our Power7 series "400" system used to take upwards of 20 minutes to come online before we decommissioned it. Generally speaking, for a server, boot time is not a factor. Nobody needs their physical server to boot and be ready in 5 seconds... so it's never been a priority. Stability and integrity are much more important in this arena.
- kevin_thibedeau 4y agoMy system boots slow because I have a legacy SCSI card installed and it's boot ROM takes ages to get running and scan the bus. Servers are more likely to have these sort of facilities onboard.
- Alupis 4y agoAbsolutely. Although I wouldn't peg this to just legacy support - in my experience even modern SAS arrays take ages to come online. As the GP noted, modern systems coordinate the array through an integral backplane and control spin-up of individual disks plus a lot more. The main difference between a "server" and a desktop is the reliability/integrity/redundancy built into the system, which comes at the cost of boot time. A worthy trade-off in most cases, and once the system is "alive", the expected performance is achieved.
- JoshTriplett 4y ago> Generally speaking, for a server, boot time is not a factor. Nobody needs their physical server to boot and be ready in 5 seconds Nobody has had the option of this. I very much have use cases for this, and while the firmware remains a persistent problem, I've been able to bring up the kernel and userspace on server hardware in a fraction of a second. I'd love to have the firmware stop adding so much time here.
- Alupis 4y agoI'm curious what that use-case might be, if you are able to elaborate. Physical servers tend to have extreme uptimes, compared to desktops and even VM's. It's a fairly rare occurrence to need to reboot a physical server (by rare, I mean only when doing updates that require a reboot, such as a kernel update, and these days there are mechanisms to avoid rebooting even under that scenario). Needing to reboot often and be available in seconds just isn't a thing needed by most folks operating physical servers. Typically folks that require that operate VM's instead, which can freely be rebooted without powering down the hardware.
- fmajid 4y agoRAM tests can be quite time-consuming. Not sure why they aren’t parallelized.
- cperciva 4y agoNever mind seconds, I have the FreeBSD kernel boot (aka time-to-init(8)) down to 40 ms in Firecracker.
- NickRandom 4y agoNo idea but I can cold boot a Deb VM containing full Samba and Emby Media server installations and have it responding and serving media in under 4 seconds. My 'host rig' takes about 10 seconds to go from power-off to logged in to a full graphical desktop (LXDE) on a low-end quad core desktop with 8GiB total memory running Mint 20.3 and the Deb based VM assigned 1GiB of memory and 2x cores.
- smoldesu 4y agoIf you're on a sufficiently fast SSD, you can boot Linux with a desktop environment in less than 5 seconds. Your "modern hardware" is probably getting throttled by flash storage or something.
- corrral 4y agoLakka boots Linux on an RPi and loads a (DRM—not X or Wayland) GUI in under 5s. Off an SDCard, at that.
- butz 4y agoInteresting, it is based on LibreELEC. Might consider it when building own RPi appliances.
- lostmsu 4y agoThis would have to be re-verified, but my anecdata is that most of the time my rig spends loading NVidia driver.
- throw10920 4y agoDepends on what distro you're running. If you haven't made time to move off Ubuntu, like me, than about 5 seconds is just loading Snap volumes :)
- numpad0 4y agoI wonder if it has to do with hardware stability, that the power supply or VRM could be unstable if pushed from 0 to 250W in 5s.
- outworlder 4y ago> If Linux could boot in 5 seconds on low tier hardware in 2008, why do I need to wait ~30 seconds to boot it on modern hardware in 2022? I am not sure why you have to wait 30 seconds. My current system runs PopOS, and it takes less than 10 seconds. My previous install (NixOS), used to boot in about the same time it took for my monitor to understand that the system was on. The BIOS screen takes about as much time as the OS to run(I have fast boot disabled). By modern hardware, I assume you are using a SSD.
- duffyjp 4y agoI just timed my 4th gen i7 laptop booting Manjaro, and from power button to login screen was 12 seconds. What hardware are you referring to?
- weberer 4y agoI'm going to guess its the BIOS taking up most of that time. Ubuntu and Manjaro both boot for me in less than 10 seconds.
- yjftsjthsd-h 4y agoSome of it is that it's not an explicit goal. Also, some of that time is spent doing things that are actually useful to some people, or doing things that the system needs to do unless someone tells it not to. For example, it might spend time waiting for hardware to settle, then querying what hardware there is, then loading drivers for the hardware. If you know in advance what hardware there is and how long until it starts up and know that you won't need anything else, you can disable it, but for a generic OS that boots on arbitrary hardware and works, it has value. Edit: Oh, and let me echo other comments: It depends on your hardware/firmware; the OS can't do anything about it if your machine takes 10 seconds to get to the bootloader.
- andai 4y agoI've been wondering about that... Linux seems to spend a lot of time investigating the hardware, as though it's booting for the first time, and not the thousandth. I basically never change system hardware, so it would make more sense to hold Shift or something while booting to trigger that stuff.
- draxil 4y agoI'd generally prefer a machine that copes with whatever it finds rather than keeping state, which is a recipe for trouble. I've booted an old disk on a different hardware and have it be fine. I've also seen windows folk change some hardware and have their machine freak out. But then I seldom reboot since linux hibernate got good, so maybe I'm a bad judge.
- doliveira 4y ago> Once you understand your computer has 16 cores running at 3GHz and yet doesn't boot up in .2 nanoseconds you understand everything they have taken from you.
- sgtnoodle 4y agoTo be fair, those 16 cores probably don't work at all until an obscure microcontroller configures them. It's probably running in the Mhz range, off of a flash or EEPROM chip. It's potentially copying in several MB of firmware into other obscure things. Still, that should only be 100ms or so.
- weberer 4y agoI recently got a new work laptop that doesn't support sleep mode (s3). Apparently its something that the vendor has to support in the BIOS. Dell says they're not going to support it anymore since Windows uses some fake sleep mode nowadays so they can collect telemetry 24/7, and they don't want to put in the effort just for Linux users. I can't believe we're going so far backwards with technology these days.
- sgtnoodle 4y agoI have a 5950X CPU, a gen 4 PCI-E NVME, and a 6800xt GPU. I normally run linux, but I wanted to play a computer game in VR last night like a jerk. I rebooted into Windows 10. It had at least three pages of full screen pop ups begging me to update to windows 11. I launched Steam. It took about 10 seconds to load, then restarted itself to update, then downloaded about 1GB of game files and did about 5GB of disk IO, over about 5 minutes. Launching VR took about 30 seconds, with at least one error message. The game didn't work with an obscure error message, and so I spent 10 minutes and a reboot updating my graphics drivers. That didn't work, so I tried deleting the game's config file. That didn't work, and so I unplugged all but one monitor. I finally got the game to work, and I had to restart it twice to tweak the graphics settings since I had deleted the config. So, about half an hour of hassle to play a game for about half an hour of gameplay.
- wyager 4y agoConsoles used to be better about this, but now it's the exact same BS. The only console that makes an effort not to waste your time is the switch.
- nicbou 4y agoI have the same experience with Windows. I launch Windows to play the same two games since 5 years, at it regularly fails at that simple task.
- vladvasiliu 4y agoMan, I don't know. I only use Windows for gaming, and I'm as much annoyed by it as the next guy, but I'm always impressed with how fast it boots compared to Linux (Arch with i3). Granted, apart from Steam, nothing's installed. But on Linux, not much is started in the background before I log in, either. This on a 2013 Xeon 2667v2 (ivy bridge) with a PCIe 3 NVMe.
- sgtnoodle 4y agoI run Arch. It seems like, in my case, its startup time is dominated by systemd networking coming up. It's pretty fast though.
- checkyoursudo 4y agoWith Gentoo/OpenRC using a minimal config and compiled kernel and booting from an efistub with built-in kernel cmd pointing to the root filesystem, my desktop boots from cold to login screen in about 8 seconds. My macbook takes ages to boot to login.
- microtonal 4y agoMy macbook takes ages to boot to login. My MacBook Air M1 takes 12 seconds from cold boot (including firmware) to the password prompt. This is the prompt that unlocks FDE. After that, it shows my desktop in 10 seconds. So, 22 second in total. I don't really care, because I reboot my Macs maybe once every few weeks. (My Linux workstations usually take more than 12 seconds, perhaps even more than 22 seconds in EFI firmware.)
- checkyoursudo 4y agoYeah, I don't reboot the macbook more than once every many weeks so it's not a big deal or anything. On the other hand, my super speedy linux doesn't quite know how to hibernate right, while the macbook does and wakes up again like a champ--like instantly. You win some and lose some.
- SahAssar 4y agoI have similar boot times on arch/systemd with efistub too, and with some basic optimization I get to sub 5s. At least for ubuntu there is a large layer of crap (snap, etc) that keeps it from being performant, and for other distros I'm guessing they have their own choices of what blocks the graphical target.
- checkyoursudo 4y agoI put a full, persistent Gentoo install on a usb drive (like a little 250GB flash drive) with a universal (e.g. livecd, BIG) kernel and disk encryption, and even that only takes about 30 seconds to get to the login screen on any relatively modern hardware. Loading from a flash drive. Some distributions make some ... interesting choices w/r/t performance. I guess.
- edgyquant 4y agoNot sure what you’re using but all my Linux boxes have boot instantly since I switched to ssds. I run a handful of hard drives, dedicated gpu, etc
- bitwize 4y agoBecause your distro's boot chain is a garbage fire? My boxen (Void or Alpine) consistently come up in count-on-one-hand seconds. If I wanted to start an X desktop at boot, that'd be maybe another second or two.
- gerdesj 4y agoPlease don't keep us guessing. Why is that? I have switches that boot Debian (on the control plane) that cost about £10,000 each. I've got similarly priced HPE servers that take around five minutes to tickle their fans, find their storage etc and generally piss around, not to mention Dell, IBM and Fujitsu. Your PC/laptop is a thing and it takes a certain amount of time to startup. When the BIOS/UEFI hands over to Linux it will boot rather quickly unless you stop it or something is wrong. Do you have a piece of hardware that takes ages to startup? Systemd has a utility to profile and graph the boot sequence by time. It will literally tell you what is happening. Use it and let us know how you get on.
- peanut_worm 4y agoOn any SSD I have used, Ubuntu starts in like 5 seconds or so.
- jvanderbot 4y ago> It [Ubuntu] spends 12 seconds running modprobe running a shell running modprobe, which ends up loading a single module. Is this a typo!?
- JoshTriplett 4y agoNo, it isn't. modprobe has a configuration file, and one of the directives in the configuration file is "if asked to load this module, run this command instead". And that command is sometimes "go figure out which module to really load". So "running modprobe running a shell running modprobe" was correct.
- okso 4y agoThe four steps that take time when booting a Linux system are: * bios/UEFI * bootloader (GRUB/...) * Linux kernel * service management bios/UEFI often have settings to reduce the time waiting for user input. Same goes for the bootloader. You can use `dmesg --boot` to analyze the boot of the Linux kernel. You can use `systemd-analyze critical-chain` to find out about what slows down the start of the services.
- butz 4y agoI've used `systemd-analyze` for whole boot process overview. Thanks to your suggestions I can dig deeper. Startup finished in 12.132s (firmware) + 1.822s (loader) + 2.106s (kernel) + 1.352s (initrd) + 10.098s (userspace) = 27.513s
- tecoholic 4y agoI did a `systemd-analyze citical-chain` and noticed that `snapd.service` took the most amount of time. So I edited the `/lib/systemd/system/snapd.service` based on the suggestion here [1] and set `After=network-online.start`. The critical-chain time has from ~12 sec to ~4sec. Here is full `systemd-analyze` Startup finished in 2.348s (firmware) + 3.276s (loader) + 3.303s (kernel) + 4.309s (userspace) = 13.239s graphical.target reached after 3.892s in userspace The interesting thing is, I haven't noticed any improvements in the time to interactivity from power button press. May a small 2-3 sec. That I could just attribute to disabling session saving and restoring in KDE Edit: I reverted the change in snapd.service, now I get Startup finished in 2.328s (firmware) + 3.599s (loader) + 3.284s (kernel) + 13.754s (userspace) = 22.966s graphical.target reached after 13.431s in userspace Again, almost no difference in actual time to usability. Where is this ~10 secs saved or exhausted? [1] - https://askubuntu.com/questions/1380790/is-it-possible-to-start-snapd-service-after-boot-finishes#comment2381176_1380796 https://askubuntu.com/questions/1380790/is-it-possible-to-st...
- vinay_ys 4y agosnapd doesn't block your interactivity. You can start typing in your password and login and start to launch your app, meanwhile the user space startup sequence is still running.
- caiobegotti 4y agoYou'd be surprised how faster the boot time back in those days got simply by disabling the kernel's printk! It was mostly for fun, of course, and there were alternative special-purposed inits too. I worked on a couple low-tier "netbooks" projects and the fastest we got was between 7-10 seconds but it wasn't worth the trouble and 15-30 seconds of boot time [to a fully functional desktop] back in 2008 was already fantastic anyway.
- sllabres 4y agoLinux: < 1 second into a custom gui application https://embexus.com/2017/05/16/embedded-linux-fast-boot-techniques/ https://embexus.com/2017/05/16/embedded-linux-fast-boot-tech...
- amelius 4y agoEmbedded products should probably use the hibernate/suspend functionality more often. Waiting more than 2 seconds to boot/start a device is like waiting more than 2 seconds for a webpage to load ... an eternity!
- HunterWare 4y agoA common use case for this is things like car/plane instruments/nav/etc. You don't want that sucking power all the time when your vehicle is parked for 1 week or two, but you do want a quick transition from POR to usable UI up and running.
- sagarm 4y agohibernate doesn't require any power; the kernel "just" restores userspace from swap instead of going through the normal boot sequence.
- danhor 4y agoHibernate has the disadvantage of needing a clean shutdown and increasing write cycles. You'd rather avoid the need to design for both. Additionally many embedded devices don't have perfect firmware and behave "weird" after a while (see planes needing a reboot every few months), which you'd extend over power cycles with this.
- bo1024 4y agoDon't forget how slow spinning hard drives were (are)!
- majewsky 4y agoAnd by now, lazy programmers have made their programs so fat that SATA SSDs feel as fast as HDDs felt back in the day. Now everyone is hailing NVMe SSDs as our savior.
- pdimitar 4y agoMy wife's gaming laptop has an NVMe drive. My aging gaming PC with a SATA III SSD objectively boots slower than hers. Games start faster on her laptop too. But I do see your point. Random file access speed isn't hugely different between a NVMe and SATA III drive.
- gorkish 4y agoBack about 20 years ago when I did my first Car PC, I got ~3s boots to graphical UI (SDL Framebuffer) using LinuxBIOS (now coreboot) and a very well curated set of hardware. I do remember that I was using the EPIA M VIA Mini ITX board (one of the first Mini ITX boards) and I had a special adapter that let me switch between two BIOS chips.
- amelius 4y agoThey should write this stuff in Haskell, so booting can happen lazily and you can start using your computer instantly.
- the_sleaze_ 4y agoWouldn't even need to be in Haskell. Still a lovely idea.
- advisedwang 4y agoMy own experience is that systemd + SSD got me to 5s boot time (typing in LUKS passphrase takes me as long as the rest!)
- treffer 4y agoThis has been one of my favorite talks, especially "Don't settle for 'make boot faster.' It's the wrong question. The question is 'make boot fast'" The opposite of this was the massive performance improvement that sqlite had a few years back. Many small incremental improvements that add up. These 2 approaches are IMHO what you have to consider if you want to go fast.
- deadfece 4y agoreminds me of this article from 07: https://web.archive.org/web/20070901234027/https://lightningcrash.blogspot.com/2007/08/making-ubuntu-boot-in-19-seconds.html https://web.archive.org/web/20070901234027/https://lightning...