return to table of content

Booting Linux Off of Google Drive

nemoniac
35 replies
11h27m

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?

jstanley
11 replies
11h6m

Why does it need to be on the phone? Carry a normal USB stick.

Medox
7 replies
10h17m

The USB stick will be forgotten or lost much quicker than the phone.

diggan
3 replies
9h25m

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 :)

zamalek
0 replies
1h13m

I leave my keychain at the door when I get home. This is probably a common practice.

felixg3
0 replies
1h47m

That makes sense. I once got falsely identified as a DJ, but it was just a YubiKey.

Perz1val
0 replies
4h4m

Also attach an USB killer for extra thrill

lizknope
1 replies
6h32m

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...

Medox
0 replies
5h21m

Reminds me of the credit card sized (literally [1]) USB stick I still have somewhere but it was too annoying to carry around and hope that next time that cheap stick still works...

Using the phone directly still seems the cleanest and most reliable way. Or maybe a combination of both, like those magnetic plugs [2] but with an integrated USB stick. Bonus points if you don't have to take it out at all (until needed) by either connecting the other magnetic part for data transfer and charging or data through USB OTG and wireless charging. One can dream... but the technology will shrink even further so who knows.

1. https://www.amazon.com/Enfain-Flash-Drives-Memory-Credit/dp/...

2. https://www.adafruit.com/product/5524

akoboldfrying
0 replies
6h20m

I glue phones to all my USB sticks for just this reason.

Infinity315
2 replies
11h5m

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
0 replies
10h31m

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
0 replies
6h10m

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.

stragies
5 replies
9h32m

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.

Timber-6539
4 replies
4h58m

I have used this many times on my phone running LineageOS. Did not have to enable any kernel features.

stragies
3 replies
3h38m

On the phones, where the Vendor kernel has this option enabled, Lineage also enables it, e.g. most LGs.

But Lineage does not enable it on all kernels, even if it could just be enabled. I observe this on all of my Samsungs, for example.

You can use this app to see which USB gadget options are enabled on your kernel: https://github.com/tejado/android-usb-gadget

Timber-6539
2 replies
2h0m

Makes sense. My phone model is a Xiaomi. Don't know why Samsung would ship their kernels without ConfigFS support but I have never had such issues.

stragies
1 replies
1h9m

It's not about `ConfigFS` as a whole, but specifically `CONFIG_USB_CONFIGFS_MASS_STORAGE`, that is left disabled, while lots of other `CONFIG_USB_CONFIGFS_BLA` are enabled.

This and more can be seen in the `device info` screen of the App mentioned above

Timber-6539
0 replies
7m

Should have said *proper ConfigFS support. Anyway, had no prior interest in this kernel feature until you mentioned the anomaly that is specific to certain vendors.

You can also do `zcat /proc/config.gz | grep CONFIGFS_` in a root shell (su) inside termux to get what options are set by the default kernel.

ddalex
3 replies
9h37m

Why just not use Samsung's DeX that gets you a linux desktop when you plug your phone in a usb-c monitor/console

Crestwave
1 replies
9h25m

Wasn't Linux on DeX discontinued?

criddell
0 replies
8h13m

Yes it was.

sambazi
0 replies
5h55m

different use case and requirement for samsung device?

senectus1
1 replies
10h32m

Also requires Root access

sambazi
0 replies
5h56m

not sure if such a thing can work w/o root

0x1ceb00da
2 replies
8h54m

Glue a bootable usb to your phone.

akoboldfrying
1 replies
6h22m

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.

gibspaulding
0 replies
2h34m

It sounds to me like software enlightenment:

https://xkcd.com/1988/

toast0
1 replies
56m

Android stopped exposing USB Mass Storage, because it's problematic for the core use case of letting you grab pictures and what not from your phone, because it requires exclusive access to a filesystem; that wouldn't be a big deal for you, I don't think, you probably just want to create a large file and expose that as a device, but the implications of exposing the sd card (or the virtual sd card) as mass storage are why it went out of style.

I did find this, but it's ancient and may not meet your needs anyway... https://xdaforums.com/t/app-root-usb-mass-storage-enabler-v1...

Aardwolf
0 replies
41m

What do you mean, usb mass storage was much better for the core use case of getting pictures of your phone than the flaky mtp now is

sandreas
1 replies
10h23m

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
0 replies
9h46m

That is not booting a linux-kernel at all. it is just using the existing kernel which Android is based on (also Linux).

franga2000
0 replies
10h21m

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.

adriancr
0 replies
10h18m

You could set up a PXE boot server on the android phone, then set up computer to boot off it.

dveeden2
28 replies
8h52m

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-...

jpalomaki
7 replies
6h36m

Booting over HTTP would be interesting for device like Raspberry. Then you could run without memory card and have less things to break.

wang_li
1 replies
2h4m

Once you have PXE you can do all the things -- NFS boot, HTTP boot, iSCSI boot, and so on. There are several open source projects that support this. I think the most recent iteration is iPXE.

yjftsjthsd-h
0 replies
59m

That's true, though I always have felt that if I needed PXE+TFTP to boot the bootloader I might as well just load a kernel+initrd from the same place and be done with it; I couldn't remove the TFTP requirement so anything else would just be extra things to configure. If UEFI can really do pure HTTP (as discussed upthread) then I may need to reevaluate. (Well, for Raspberry Pis I'll have to keep TFTP, but maybe in other contexts I can drop it)

AnimalMuppet
2 replies
5h36m

Welcome back, diskless workstations! We've missed you... oh, wait, no, we really haven't.

This is technically neat, but... How often does the memory card break on a Raspberry? How often does the network break (either Raspberry hardware or upstream)? There are fewer things to break when you run from local hardware.

ssl-3
0 replies
22m

Amusingly, most of the things I regularly use Raspberry Pi hardware for require a functional network as well as functional storage on that network.

If I were to netboot these things, then I'd have fewer points of failure than I do now.

Semaphor
0 replies
4h11m

I'd say sd card failures are the most common rPI failures.

unixhero
6 replies
8h27m

"The network is the computer." It was a shortlived thing.

msh
3 replies
6h57m

I guess Chromebook’s is the resurrection of the idea

bluGill
1 replies
3h49m

Not really. Chromebooks don't use the LAN. They can run code locally, or on the server in a different timezone. However with Sun if you needed more CPU you could log into all the machines on your local network - all machines shared the same filesystem(NFS) and passwd (I forget this was), so using all the CPUs in the building was easy. It was unencrypted, but generally good enough until the Morris worm.

Of course moderns servers have far more CPU power than even the largest LANs back in 1986. Still those of use who remember when Sun was a big deal miss the power of the network.

toast0
0 replies
1h7m

all machines shared the same filesystem(NFS) and passwd (I forget this was), so using all the CPUs in the building was easy.

Sun did this through NIS, originally Yellow Pages/YP, but name changed for trademarks.

When I worked at Yahoo, corp machines typically participated in an automounter config so your home would follow you around, it was super convenient (well, except when the NFS server, which might be your personal corp dev machine under your desk, went away, and there was no timeout for NFS operations... retry until the server comes back or heat death of the universe). They used a sync script to push passwords out, rather than NIS though --- a properly driven sync script works almost as fast, but has much better availability, as long as you don't hit an edge case (I recall someone having difficulty because they left the company and came back, and were still listed as a former employee in some database, so production access would be removed automatically)

Teckla
0 replies
5h48m

Thanks to Crostini, Chromebooks are also excellent local computing devices.

MisterTea
0 replies
5h3m

That's because Sun just bolted stuff on to Unix. Bell Labs actually achieved that goal in Plan 9 which is still very much alive.

Andrex
5 replies
5h37m

First thing I disable on a new PC.

mywittyname
4 replies
4h1m

I was going to say, booting from a random website image sounds like a terrible idea.

michaelmior
3 replies
3h29m

It's possible to require that any images used be signed using a specific key that is configured in the hardware ahead of time. Even if you don't do that, the same setup can be helpful for provisioning a bunch of machines without accessing any external network. You can configure a small box to act just as a DHCP server and to serve a machine image for network boot. Then you can have all the machines on this subnet automatically load that image as it is updated without the need for any further configuration on each device.

I've seen organizations do something similar to this for trade shows when they want a bunch of machines that visitors can interact with and don't want to have to keep them updated individually. Just update the image once and reboot each machine.

xur17
2 replies
3h3m

Ideally it would be possible to just specify an image url and a hash.

Or, even better, a magnet link.

yjftsjthsd-h
1 replies
1h45m

I dunno, I actually think a public key is better than a hash, because it lets you sign updated images without having to update things on the client. Obviously it should be user-controlled, but this feels like a legitimate use.

xur17
0 replies
1h41m

It is more flexible than a hash, but it's also more complicated.

mrgaro
2 replies
8h15m

I remember the glorious AIX machines we had which could book from tape backups made with a simple "mksysbk" command. :)

bastawhiz
1 replies
5h48m

How slow was that?

dspillett
0 replies
5h1m

If it is pulling a filesystem from tape into memory and booting from that, it could be pretty quick. Reading sequentially from tape, if you are already at the right location which is easy if that location is the start of the tape, isn't particularly slow at all – non-sequential access is where tape storage becomes very slow due to massive latency in the physical mechanisms.

prmoustache
0 replies
7h37m

Grub can boot a kernel from http too.

ktm5j
0 replies
4h15m

I remember doing this to install Solaris while resurrecting an old sparcstation. Fun times!

fsckboy
14 replies
12h25m

mid 90's, a friend of mine installed Windows NT to, and booted it from, a DAT tape

brnt
8 replies
10h46m

I got PTSD from installing Windows 95 from floppy and after 40 floppies getting read errors...

beAbU
5 replies
10h36m

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
4 replies
10h35m

i need to know which country this is, please!

obrix
0 replies
8h58m

Happened also in Finland. It was "lerppu" (floppy) for the flexible ones and "korppu" (hard biscuit) for the hard ones.

cyberpunk
0 replies
10h26m

Certainly not the UK where inserting your stiffie in to something has rather a different connotation….

beAbU
0 replies
8h12m

South Africa!

yencabulator
0 replies
2h49m

The first time I installed SLS Linux (pre-Slackware), it took some 25 1.44MB floppies and I owned ~20 empty ones. I left the installer running overnight and downloaded more floppies the next day at school. It took an extra day because some floppies had bad sectors, and had to be re-downloaded..

raesene9
0 replies
9h50m

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.

raffraffraff
2 replies
9h58m

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
1 replies
8h3m

can you explain?

sjsdaiuasgdia
0 replies
5h54m

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.

kotaKat
0 replies
6h29m

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)...

Maakuth
0 replies
12h2m

How long did it take? Seek times for tapes can be minutes, so fragmentation matters a great deal here.

amelius
12 replies
9h53m

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.

dataflow
5 replies
7h27m

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
4 replies
7h13m

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
3 replies
7h0m

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
1 replies
6h16m

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
0 replies
6h48m

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.

amelius
3 replies
8h16m

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.

bluGill
1 replies
3h41m

The real problem is linux is just a kernel - they cannot force you to have good hardware. If you want fast boot you need to start with the hardware: a lot of hardware has an long init sequence so there is no way the kernel can boot fast as it cannot boot until that hardware is initialized. Then you can look at the kernel, step one is strip out all the drivers for that slow to init hardware you don't have (since those drivers have to insert waits into the boot while they check for the hardware you don't have). If you do this you can save a lot of boot time.

Of course in the real world the people who select your hardware don't talk to the people who care about software. So you are stuck with slow boots just because it is too late to go back and do a fill million dollars each board re-spins now that we know our boot times are too slow.

It gets worse, even if you select fast init hardware that doesn't mean it really is fast. I've seen hardware that claims to not need long inits, but if you don't insert waits in the boot there are bugs.

amelius
0 replies
3h35m

Well, in many cases people __can__ get a kernel to have decent boot times if they pour sufficient time and energy into it.

zokier
0 replies
1h11m

At least on my completely unoptimized desktop, majority of boot time is already spent in UEFI firmware, not in kernel or userspace startup. So realistically there is limited opportunity to optimize the boot times.

yencabulator
0 replies
2h54m

Linux boots to your application in 125 ms. There's no hard problem there, just bloat, general-purpose systems, and hardware not designed to boot fast.

prmoustache
7 replies
12h20m

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?

russdill
2 replies
12h10m

To close the loop, they really need an EFI stub that loads a combined kernel image/ramfs from Drive.

ceving
1 replies
11h47m

iPXE can already boot from a web server: https://ipxe.org/

01HNNWZ0MV43FF
1 replies
11h47m

That's what I'm saying about hard drives and ROMs

unixhero
0 replies
11h33m

Yeah we didn't need those silly hardrives with their crufty filesystems.

omnicognate
0 replies
7h46m

Perhaps that's what this "off of" preposition means. I've often wondered.

creshal
0 replies
11h12m

Not any worse than 32+ megabytes of UEFI booting off of an iPXE bootrom.

pjmlp
7 replies
12h13m

Tfpt boot gets rediscovered.

kvdveer
3 replies
10h49m

But now with some one else's computer (aka, "the cloud")

pjmlp
2 replies
9h37m

It was always with someone else computer, we used to call it timesharing and thin clients. :)

throwaway984393
1 replies
6h56m

It was especially fun when you used someone's entire computer lab during night hours ;)

pjmlp
0 replies
2h51m

Yep, I had some fun with PVM, for the audience, somehow the alternative that lost to MPI.

INTPenis
1 replies
9h53m

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.

pjmlp
0 replies
9h37m

Typo.

yjftsjthsd-h
0 replies
1h27m

I mean,

Competitiveness is a vice of mine. When I heard that a friend got Linux to boot off of NFS, I had to one-up her. I had to prove that I could create something harder, something better, faster, stronger.

sounds like they're well aware of the traditional way to do it, and are deliberately going out of their way to do something different and weird.

jvdvegt
5 replies
11h24m

He casually mentions he boots of S3 as well. Changing S3 for Google Drive mostly adds latency, apparently.

But still, nicely done!

_flux
3 replies
9h59m

Redundant S3 is easy-ish to selfhost, though, so that could actually be a decent way to setup reliable diskless workstations.

yencabulator
2 replies
2h55m

At that point you might as well run Ceph and give your diskless workstations a writable block device via RBD. The overhead of an S3 operation per file is quite high.

_flux
1 replies
2h44m

There are some easier solutions for just S3, like Minio, which I imagine is likely much easier to setup than Ceph (though ceph is not that hard with cephadm).

yencabulator
0 replies
2h42m

By the time you add the word "redundant" in the mix, nothing is really easy anymore.

yencabulator
0 replies
2h57m

His S3-compatible bucket was locally hosted, did not go over the internet.

throwaway984393
2 replies
7h1m

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.

remram
1 replies
4h21m

How do you load the initrd?

yjftsjthsd-h
0 replies
1h21m

UEFI provides a pretty complete environment; it would probably not be too hard to write a .efi program that connected to network and downloads whatever you want from Google Drive (or anywhere else) into RAM and runs it. For that matter, IIRC Linux can already build a combined kernel+initrd into a .efi, so you could make this semi-generic by writing a gdrive.efi that downloaded an arbitrary .efi from gdrive and booted it.

rwmj
1 replies
10h59m

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.

yencabulator
0 replies
3h10m

If that's a huge problem, you can wedge FUSE in there somehow, as far as I know there's no automatic kernel-side timeout to requests sent to FUSE.

sirjaz
0 replies
4h39m

We do this all the time in Windows with Citrix. It is called pvs. It does a small pxe boot and then it streams down the windows server image

sharpshadow
0 replies
5h15m

“…booting Linux off of a Git repository and tracking every change in Git using gitfs.”

That sounds cool!

iamleppert
0 replies
2h43m

Can you boot Google off a Linux drive?

eisbaw
0 replies
8h11m

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.

coisasdavida
0 replies
23m

A few days ago I was able to boot armbian on a tvbox I got from the trash, felt so great, now feels so pedestrian...

Vogtinator
0 replies
4h43m

I did something similar some time ago: Booting from an RPM repository on a Tumbleweed installation DVD.

My initial goal was to write a fuse filesystem for mounting RPM packages, but I wanted to see how far it goes. Turns out, pretty far indeed: https://github.com/Vogtinator/repomount/commit/c751c5aa56897...

The system boots to a working desktop and it appears like all packages available on the DVD are installed.