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?
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-...
Booting over HTTP would be interesting for device like Raspberry. Then you could run without memory card and have less things to break.
I would also prefer HTTP, but Pis can use PXE boot and mount their root filesystem over NFS already:) Official docs are https://www.raspberrypi.com/documentation/computers/raspberr... and they have a tutorial at https://www.raspberrypi.com/documentation/computers/remote-a...
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.
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)
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.
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.
I'd say sd card failures are the most common rPI failures.
https://www.google.com/search?q=raspberry%20pi%20pxe%20booti...
There was an article recent for somebody doing it on an Orange Pi [1]. IIUC, you can have one RasPi with an SD Card (I use USB drives but w/e) to be the PXE server and then the rest can all network boot.
"The network is the computer." It was a shortlived thing.
I guess Chromebook’s is the resurrection of the idea
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.
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)
Thanks to Crostini, Chromebooks are also excellent local computing devices.
"Short-lived" depends on your perspective. Cloudflare owns the rights to that trademark now; because they believe their mission furthers that vision: https://en.wikipedia.org/wiki/The_Network_is_the_Computer (and John Cage, the Sun employee who coined the phrase, said he was fine with Cloudflare picking it up: https://spectrum.ieee.org/does-repurposing-of-sun-microsyste...)
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.
Modern UEFI can do that too!
First thing I disable on a new PC.
I was going to say, booting from a random website image sounds like a terrible idea.
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.
Ideally it would be possible to just specify an image url and a hash.
Or, even better, a magnet link.
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.
It is more flexible than a hash, but it's also more complicated.
I remember the glorious AIX machines we had which could book from tape backups made with a simple "mksysbk" command. :)
How slow was that?
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.
Grub can boot a kernel from http too.
I remember doing this to install Solaris while resurrecting an old sparcstation. Fun times!
mid 90's, a friend of mine installed Windows NT to, and booted it from, a DAT tape
I got PTSD from installing Windows 95 from floppy and after 40 floppies getting read errors...
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.
i need to know which country this is, please!
I'm going to wager South Africa based on this blog post: https://jasonelk.com/2015/12/who-knew-that-the-rest-of-the-w...
Happened also in Finland. It was "lerppu" (floppy) for the flexible ones and "korppu" (hard biscuit) for the hard ones.
Certainly not the UK where inserting your stiffie in to something has rather a different connotation….
South Africa!
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..
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.
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.
can you explain?
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.
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)...
How long did it take? Seek times for tapes can be minutes, so fragmentation matters a great deal here.
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.
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?
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).
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.)
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.
I suppose you could use a generic SAT solver for that.
EDIT: https://hal.science/hal-00870846/file/W5_PX_Le_Berre_On_SAT_...
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.
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...
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.
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.
Well, in many cases people __can__ get a kernel to have decent boot times if they pour sufficient time and energy into it.
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.
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.
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?
To close the loop, they really need an EFI stub that loads a combined kernel image/ramfs from Drive.
iPXE can already boot from a web server: https://ipxe.org/
Should be possible then, if you "share" the initrd and Linux image?
https://stackoverflow.com/questions/37453841/download-a-file...
That's what I'm saying about hard drives and ROMs
Yeah we didn't need those silly hardrives with their crufty filesystems.
Perhaps that's what this "off of" preposition means. I've often wondered.
Not any worse than 32+ megabytes of UEFI booting off of an iPXE bootrom.
Tfpt boot gets rediscovered.
But now with some one else's computer (aka, "the cloud")
It was always with someone else computer, we used to call it timesharing and thin clients. :)
It was especially fun when you used someone's entire computer lab during night hours ;)
Yep, I had some fun with PVM, for the audience, somehow the alternative that lost to MPI.
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.
Typo.
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.
He casually mentions he boots of S3 as well. Changing S3 for Google Drive mostly adds latency, apparently.
But still, nicely done!
Redundant S3 is easy-ish to selfhost, though, so that could actually be a decent way to setup reliable diskless workstations.
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.
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).
By the time you add the word "redundant" in the mix, nothing is really easy anymore.
His S3-compatible bucket was locally hosted, did not go over the internet.
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.
How do you load the initrd?
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.
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.
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.
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
“…booting Linux off of a Git repository and tracking every change in Git using gitfs.”
That sounds cool!
Can you boot Google off a Linux drive?
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.
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...
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.
Why does it need to be on the phone? Carry a normal USB stick.
The USB stick will be forgotten or lost much quicker than the phone.
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 :)
I leave my keychain at the door when I get home. This is probably a common practice.
That makes sense. I once got falsely identified as a DJ, but it was just a YubiKey.
Also attach an USB killer for extra thrill
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...
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
I glue phones to all my USB sticks for just this reason.
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.
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.
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.
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.
I have used this many times on my phone running LineageOS. Did not have to enable any kernel features.
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
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.
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
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.
Why just not use Samsung's DeX that gets you a linux desktop when you plug your phone in a usb-c monitor/console
Wasn't Linux on DeX discontinued?
Yes it was.
different use case and requirement for samsung device?
https://play.google.com/store/apps/details?id=com.softwareba....
It dosen't work on all smartphone
Also requires Root access
not sure if such a thing can work w/o root
Glue a bootable usb to your phone.
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.
It sounds to me like software enlightenment:
https://xkcd.com/1988/
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...
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
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
That is not booting a linux-kernel at all. it is just using the existing kernel which Android is based on (also Linux).
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...
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.
You could set up a PXE boot server on the android phone, then set up computer to boot off it.