Booting Linux Off of Google Drive

(ersei.net)

180 points | by jandeboevrie 3 days ago

10 comments

  • dveeden2 2 days ago
    Back in the the day it was possible to boot Sun Solaris over HTTP. This was called wanboot. This article reminded me of that.

    This was basically an option of the OpenBoot PROM firmware of the SPARC machines.

    It looked like this (ok is the forth prompt of the firmware):

        ok setenv network-boot-arguments dhcp,hostname=myclient,file=https://192.168.1.1/cgi-bin/wanboot-cgi
        ok boot net
    
    This doesn't only load the initramfs over the (inter)network but also the kernel.

    https://docs.oracle.com/cd/E26505_01/html/E28037/wanboottask...

    https://docs.oracle.com/cd/E19253-01/821-0439/wanboottasks2-...

  • rwmj 2 days ago
    How about booting Linux off bittorrent? https://libguestfs.org/nbdkit-torrent-plugin.1.html#EXAMPLES

    The problem with booting Linux off very high latency devices is the kernel tends to time out I/O requests after too short a time (60 seconds I think) so you have to adjust those timeouts upwards.

  • nemoniac 2 days ago
    Speaking of booting Linux from places, what I would like to be able to do is carry a Linux image around with me on my (Android) smartphone, plug the phone into a USB port on a laptop and boot the Linux image from there on the laptop. Does such a thing exist?
    • franga2000 2 days ago
      This really is nice to have and a sibling comment has already linked to DriveDroid, the solution I'm using for this.

      Back in the CyanogenMod days, I had an even better setup: there was an app that also let you emulate a USB keyboard and mouse, so I could, with some command-line trickery, boot a computer from an ISO on my phone, then use that same phone as a keyboard and mouse/trackpad, including in the BIOS.

    • sambazi 2 days ago
      i used drivedroid [0] on in the 2010's for this purpose. handy but never essential. requires root though.

      [0] https://play.google.com/store/apps/details?id=com.softwareba...

    • stragies 2 days ago
      A magisk module to do just that:

      https://github.com/nitanmarcel/isodrive-magisk

      needs root, and your kernel needs USB Mass storage gadget support module enabled, which, sadly, LineageOS doesn't enable by default.

    • hexmiles 2 days ago
      • senectus1 2 days ago
        Also requires Root access
        • sambazi 2 days ago
          not sure if such a thing can work w/o root
    • sandreas 2 days ago
      Boot linux of a Smartphone would take drive emulation, which is possible, but not easily available.

      To rootless Boot a Linux ON (not from) your phone is possible via tmux APP.

      Search for "rootless kali nethunter" on YouTube. See here: https://m.youtube.com/watch?v=GmfM8VCAu-I

      • ce4 2 days ago
        That is not booting a linux-kernel at all. it is just using the existing kernel which Android is based on (also Linux).
    • ddalex 2 days ago
      Why just not use Samsung's DeX that gets you a linux desktop when you plug your phone in a usb-c monitor/console
      • sambazi 2 days ago
        different use case and requirement for samsung device?
      • Crestwave 2 days ago
        Wasn't Linux on DeX discontinued?
    • 0x1ceb00da 2 days ago
      Glue a bootable usb to your phone.
      • akoboldfrying 2 days ago
        Yes, do this. Don't under any circumstances try to solve a cute technical challenge -- that would only lead to fun, or worse yet, satisfaction.
    • adriancr 2 days ago
      You could set up a PXE boot server on the android phone, then set up computer to boot off it.
    • jstanley 2 days ago
      Why does it need to be on the phone? Carry a normal USB stick.
      • Infinity315 2 days ago
        It doesn't, but consider that the vast majority of us already carry our phones everywhere.

        Would carrying an extra USB stick be that big of a hassle? No, but I can see the need for booting up a ready Linux image being extremely situational so the vast majority of time you're just carrying dead weight.

        • forgotpwd16 2 days ago
          You can have a stick with one boot and one commonly formatted (FAT32/exFAT/ext) partition, Linux image being stored in later. Then it's like a normal stick that can also be used to boot Linux. Ventoy automates this process, allowing you to throw any ISO in a specific directory and boot it.
        • 2OEH8eoCRo0 2 days ago
          Wouldn't it be cool if these general purpose computers in our pockets were useful in novel ways?

          You're only allowed to use it in the prescribed fashion.

      • Medox 2 days ago
        The USB stick will be forgotten or lost much quicker than the phone.
        • lizknope 2 days ago
          I have a few Verbatim "Tuff and Tiny" USB drives. Like this but without the plastic clip part. I can fit them in my wallet because its about the thickness of 2 credit cards which are also in my wallet.

          https://www.amazon.com/Verbatim-8GB-Clip-Flash-Drive/dp/B00N...

        • akoboldfrying 2 days ago
          I glue phones to all my USB sticks for just this reason.
        • diggan 2 days ago
          USB sticks attached to keychains are already widespread in some communities (DJs for example), I'm sure us software people could do it too if we wanted to :)
  • eisbaw 2 days ago
    I wouldn't technically call this "boot" since the kernel has already booted... If get google-drive "mounting" support into grub, then I'll concede. This just places the rootfs on some strange place.

    btw, I have a project in my drawer, to place rootfs of my NixOS on IPFS.

  • prmoustache 3 days ago
    Can you really say you are booting off of something remote when you are really booting a rootfs from a local initramfs of several megabytes?
    • creshal 2 days ago
      Not any worse than 32+ megabytes of UEFI booting off of an iPXE bootrom.
    • omnicognate 2 days ago
      Perhaps that's what this "off of" preposition means. I've often wondered.
    • 01HNNWZ0MV43FF 3 days ago
      That's what I'm saying about hard drives and ROMs
      • unixhero 2 days ago
        Yeah we didn't need those silly hardrives with their crufty filesystems.
    • russdill 3 days ago
      To close the loop, they really need an EFI stub that loads a combined kernel image/ramfs from Drive.
  • jvdvegt 2 days ago
    He casually mentions he boots of S3 as well. Changing S3 for Google Drive mostly adds latency, apparently.

    But still, nicely done!

    • _flux 2 days ago
      Redundant S3 is easy-ish to selfhost, though, so that could actually be a decent way to setup reliable diskless workstations.
  • amelius 2 days ago
    What people really want is sub-second booting, especially in embedded. It is a hard problem but somehow nobody seems interested in doing the hard CS research to solve it.
    • rwmj 2 days ago
      There's tons of work on millisecond boot times going on, in kata-containers, confidential computing, and various "serverless" implementations. I wrote a paper about it nearly a decade ago too[1].

      [1] http://git.annexia.org/?p=libguestfs-talks.git;a=tree;f=2016...

      • amelius 2 days ago
        And I still can't boot my Linux system in a reasonable time. Perhaps the true problem that needs to be solved is that everybody is somehow (forced at) reinventing the wheel every time.
    • dataflow 2 days ago
      > hard CS research

      I'm surprised to see this, in what way does it require hard CS research? Isn't it just debugging and implementation pain?

      • amelius 2 days ago
        I can only guess here. But remember that software package management was a pain too and it took someone to do a Ph.D. on the topic to give us NiX (and it still isn't perfect).
        • dataflow 2 days ago
          Ah I see where you're coming from. I don't see any reason to expect that's the case here though. Package management has some fairly obvious tough CS problems inherent in it -- dependency resolution with version upgrades inherently feels NP-hard, for example. Whereas booting is about making hardware that initializes quickly and then making software that abstracts over a variety of hardware well... within the development budget you have. And then you're stuck with backward compatibility as everything changes. I could be wrong here but it feels like a costly engineering problem more than anything else.

          (Note I'm not saying you can't do a PhD in it and improve the situation -- you could probably do that for any problem, honestly. Just saying that I think you could get most of the way there by just paying the engineering cost.)

          • akoboldfrying 2 days ago
            Dependency resolution with versions is indeed NP-hard, if versions "conflict" (2 versions of the same package can't be installed at the same time). What if they don't conflict, and you just wanna install the fewest possible package versions to satisfy all dependencies? That's NP-hard too.
          • amelius 2 days ago
            I'm just seeing that this is a forever lingering problem and I think if only engineering costs were involved the problem would have been solved by now.
  • fsckboy 3 days ago
    mid 90's, a friend of mine installed Windows NT to, and booted it from, a DAT tape
    • kotaKat 2 days ago
      While not booted from, wimlib's support for pipable WIMs means through some shenanigans, you can install modern Windows from tape. I had a bootstrap ISO that would fire up Windows PE, mount my USB DAT tape drive, rewind it, prep the onboard storage, then image direct from tape to disk and make it bootable.

      I posit that because wimlib supports pipable WIMs that we could pipe an endless stream of QR codes to it (thus making the "installing Windows from QR codes" possible)...

    • raffraffraff 2 days ago
      That must have been fun.

      In the late 90s I worked in the server support line for DEC, and the number of times we had to talk people through the "invisible F6 prompt" was nuts.

      • tryauuum 2 days ago
        can you explain?
        • sjsdaiuasgdia 2 days ago
          If your intended system volume was going to require drivers that weren't built into WinNT, you needed to press F6 at a specific point during installation. This would allow you to load a driver that makes the volume visible / usable.

          This process was specific to installing storage drivers needed for the system volume. All other driver installation happened elsewhere.

          My memory says there was actually a "Press F6 to load system storage drivers" prompt or something displayed by the installer, but it wasn't displayed for all that long a time and I imagine it was effectively invisible for many people. I recall spamming F6 to make sure I wouldn't miss the prompt.

    • Maakuth 3 days ago
      How long did it take? Seek times for tapes can be minutes, so fragmentation matters a great deal here.
    • brnt 2 days ago
      I got PTSD from installing Windows 95 from floppy and after 40 floppies getting read errors...
      • raesene9 2 days ago
        My first IT job involved installing a lot of Windows 95 from floppy disk. Luckily each PC I bought came with a set, so I'd build up some "good sets" over time after discarding all the disks that had read errors.
      • beAbU 2 days ago
        Somewhere in my parents' house there is a massive box with floppies for office 95 (or whatever it was called back then). Not 40 floppies massive, but still a large number.

        I think we managed to only ever install it once successfully without error.

        Also, fun semi-related fact: In my country we called 8" and 5.25" floppies "floppies", and the smaller 3.5" ones were called "stiffies" - because the larger ones were floppy, and the smaller were, well, stiffer. Do with this information as you please.

        • exe34 2 days ago
          i need to know which country this is, please!
  • pjmlp 3 days ago
    Tfpt boot gets rediscovered.
    • kvdveer 2 days ago
      But now with some one else's computer (aka, "the cloud")
      • pjmlp 2 days ago
        It was always with someone else computer, we used to call it timesharing and thin clients. :)
        • throwaway984393 2 days ago
          It was especially fun when you used someone's entire computer lab during night hours ;)
    • INTPenis 2 days ago
      You meant to say tftp right? I'm just checking if there is some long lost technology called Tfpt that I have never heard of.
  • throwaway984393 2 days ago
    Considering how slow and buggy it is to use as a rootfs, you can instead put an initrd on Google Drive and just boot that. You'll need to make it by hand to get it to a reasonably small size, so picking up a copy of Linux From Scratch, and using libmusl or libuclibc along with BusyBox, will go a long way towards a functional system in a small size.

    If you want a fuller system you could try 1) convert the filesystem to tmpfs after boot and install packages to RAM, or 2) mount a remote disk image as your roofs rather than keeping individual files remote. The former will be blazing fast but you're limited by your RAM. The latter will be faster than fuse, benefit from io caching, and not have the bugs mentioned.