463 points · by jandeboevrie · 2y ago · 184 comments
btw, I have a project in my drawer, to place rootfs of my NixOS on IPFS.
oh that would be fun! have you made much progress? is there a repo or something I can follow for updates?
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.
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-...
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.
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.
As others have said, you can also use PXE, but http is a bit easier to deal with.
There is a hosting company with something like 44k Raspberry Pis. Are you going to be the guy to update them?
I have no data on this, only anecdata - since I've started being interested in the Home Assistant project, I've seen countless problems with people who've done an upgrade, rebooted their HA Pi and had some kind of Disk IO issue because the card died.
As I understand it, it's the constant logging to disk for logfiles and databases that ends up killing MicroSD cards. It seems to be particularly bad for clones and cheap ones off eBay/Amazon. It's still apparently a problem even for high quality "endurance" MicroSD cards.
If I were to netboot these things, then I'd have fewer points of failure than I do now.
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.
https://stackoverflow.com/questions/37453841/download-a-file...
[1] http://git.annexia.org/?p=libguestfs-talks.git;a=tree;f=2016...
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.
Pretending there is no problem is part of the problem.
I'm surprised to see this, in what way does it require hard CS research? Isn't it just debugging and implementation pain?
(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.)
But still, nicely done!
I read the “How to shrink a file system without a live cd. So here’s my one. How to shrink a file system without a live CD as part of a single command install script of a program.
My sbts-aru sound localizing recorder program does that on the pi.
I’m willing to bet that no other project on the Internet does this, but I’d love to be surprised. Let me know.
It installs the majority of the code, then reboots, shrinks the file system. Creates additional partitions and labels them installing file systems. Then finishes the install and comes up running.
So the procedure goes as follows.
sudo apt install -y git
git clone https://github.com/hcfman/sbts- aru.git
cd sbts-aru
sudo -H ./sbts_install_aru.sh
That’s it. It comes up running a recorder on a system with multiple partitions running an overlayFS on memory on the first one.It will even work on a Raspberry Pi zero (Works on all Pi versions) and it doesn't matter if it's Raspbian or Bookworm.
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.
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.
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
It dosen't work on all smartphone
[0] https://play.google.com/store/apps/details?id=com.softwareba...
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
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...
Fundamentally, accessing files on a live filesystem is a solved problem, and has been since before smart phones. I don't even know how they made such a broken setup.
(I believe the problem with USB mass storage is that it's closer to an IDE/SCSI protocol than a filesystem protocol. You can't have one bit of the system running around "accessing files" while you've got something else "moving the simulated drive head and writing this sector". In principle you could put the work in to make it all work out, but then it would be as flaky as the media access is now, only for a good reason rather than laziness/lockin.)
If the sd card is mounted by your computer, you can't run any apps on the phone that need to use the sd card. That means, apps you moved to the SD card for space reasons, or apps that might save photos to the SD card (such as messengers).
If your computer messes up the filesystem, then you're in a world of hurt.
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're only allowed to use it in the prescribed fashion.
https://www.amazon.com/Verbatim-8GB-Clip-Flash-Drive/dp/B00N...
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)...
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 believe it worked by supplying the recovery software as a bootable ISO image in ROM on the drive and emulating a bootable (USB? SCSI?) CD-ROM drive at boot.
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.
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.
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.
Old time OS programmers typically didn't need to think about these things...
Current and future OS designers might wish to consider these things in their designs, if they desire maximum flexibility in their current or future OS...
Anyway, an excellent article!
Related:
https://en.wikipedia.org/wiki/Coupling_(computer_programming...
https://thenewstack.io/how-decoupling-can-help-you-write-bet...
https://softwareengineering.stackexchange.com/questions/2444...
sudo mount /dev/sdb2 /mnt
sudo xhost +local:
sudo mount --bind /tmp/.X11-unix /mnt/tmp/.X11-unix
sudo cp ~/.Xauthority /mnt/root/.Xauthority
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo mount --bind /dev/pts /mnt/dev/pts
sudo unshare --uts chroot /mnt su -l timonoko
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt/dev/pts
sudo umount -l /mnt/dev
sudo umount -l /mnt/tmp/.X11-unix
sudo umount -l /mntThat was an "amazing" thing to me back in the day. I had the bandwidth to do it, a simple floppy to start the whole process and...there it was! BSD on my machine.
I'm not sure if you can still do that today. Pretty sure the files were FTP hosted somewhere (or even TFTP). I think today it's all ISOs.
pulitzer prize nomination material
That sounds cool!
oh.
> 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.
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.