July 2nd, 2024

Booting Linux Off of Google Drive

The author successfully booted Linux from a Google Drive root independently, using FUSE programs and custom initramfs on Arch Linux. Challenges with networking, permissions, and dependencies were addressed through manual solutions.

Read original articleLink Icon
Booting Linux Off of Google Drive

The author embarked on a project to boot Linux off a Google Drive root, aiming for a self-contained setup without a second machine's assistance. They utilized FUSE programs in the Linux kernel initramfs to achieve this, along with configuring networking. The process involved building a custom initramfs using Dracut on Arch Linux, installing necessary packages, and writing a module script. Despite encountering challenges like DNS issues and slow performance, they managed to mount Google Drive using google-drive-ocamlfuse. However, they faced various problems with symlinks, hardlinks, and permissions, leading to manual workarounds. The author detailed their troubleshooting steps, including adding token files and SSL certificates to the initramfs. Ultimately, they encountered a "File not found" error due to missing library dependencies when attempting to boot, highlighting the complexities of the Linux system.

Link Icon 21 comments
By @eisbaw - 5 months
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.

By @rwmj - 5 months
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.

By @dveeden2 - 5 months
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-...

By @prmoustache - 5 months
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?
By @amelius - 5 months
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.
By @jvdvegt - 5 months
He casually mentions he boots of S3 as well. Changing S3 for Google Drive mostly adds latency, apparently.

But still, nicely done!

By @hcfman - 5 months
Love the one up manship!

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.

By @nemoniac - 5 months
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?
By @fsckboy - 5 months
mid 90's, a friend of mine installed Windows NT to, and booted it from, a DAT tape
By @Vogtinator - 5 months
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.

By @peter_d_sherman - 5 months
Any current or future OS should have its filesystem completely decoupled from the OS itself -- thus allowing booting/running the OS off of any kind of plain or esoteric storage device, local or network, present or remote, physical or cloud-based, interrupt/DMA based or API/protocol based, block-based or file-based, real or virtualized, encrypted or not encrypted, tunnelled or not tunnelled, over another protocol or not over another protocol, using TCP/IP or UDP or even just raw 1's and 0's over whatever electronic communication channel someone invents next, etc., etc.

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

By @timonoko - 5 months
This inspired me to study the possibility of booting on one linux and then chrooting to another linux. Reason being that I cannot update the first one, it being too old, but it has important janitorial purposes. With the help of ChatGPT I made this script, where everything seems to work including x-windowed programs.

    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 /mnt
By @sirjaz - 5 months
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
By @coisasdavida - 5 months
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...
By @iamleppert - 5 months
Can you boot Google off a Linux drive?
By @whartung - 5 months
I remember first getting my cable modem at the house, and I was able to install BSD over the network using a boot floppy.

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

By @mason_mpls - 5 months
> On the brink of insanity, my tattered mind unable to comprehend the twisted interplay of millennia of arcane programmer-time and the ragged screech of madness, I reached into the Mass and steeled myself to the ground lest I be pulled in, and found my magnum opus.

pulitzer prize nomination material

By @sharpshadow - 5 months
“…booting Linux off of a Git repository and tracking every change in Git using gitfs.”

That sounds cool!

By @fargle - 5 months
i keep parsing this headline as "kicking Linux off google drive". huh?

oh.

By @pjmlp - 5 months
Tfpt boot gets rediscovered.
By @throwaway984393 - 5 months
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.