Self-Hosting A Cluster On Old Phones

The phones most of us carry around in our pockets every day hold a surprising amount of computing power. It’s somewhat taken for granted now that we can get broadband in our hands in most places; so much so that when one of these devices has reached the end of its life it’s often just tossed in a junk drawer even though its capabilities would have been miraculous only 20 years ago. But those old phones can still be put to good use though, and [Denys] puts a few of them back to work running a computing cluster.

Perhaps the most significant flaw of smartphones, though, is that most of them are locked down so much by their manufacturers that it’s impossible to load new operating systems on them. For this project you’ll need to be lucky enough (or informed enough) to have a phone with an unlockable bootloader so that a smartphone-oriented Linux distribution called postmarketOS can be installed. With this nearly full-fledged Linux distribution to work from, the phones can be accessed by ssh and then used to run Kubernetes for the computing cluster. [Denys] has three phones in his cluster that run a few self-hosted services for him.

[Denys] also points out in his guide that having a phone that can run postmarketOS might save some money when compared to buying a Raspberry Pi to run the same service, and the phones themselves can often be more powerful as well. This is actually something that a few others have noted in the past as well. He’s gone into a considerable amount of detail on how to set this up, so if you have a few old smartphones gathering dust, or even those with broken screens or other physical problems where the underlying computing resources are still usable, it’s a great way to put these machines back to work.

Thanks to [mastro Gippo] for the tip!

34 thoughts on “Self-Hosting A Cluster On Old Phones

  1. Try proot-docker under Termux, you can spin docker images without being root.

    Working on adding skopeo to Termux.

    With proot it fakes the root, but you can run a lot of stuff.

    I am sure i could run a simple scheduler with a busybox webserver and stack many old phones.

    1. Hey Ben, the places we meet (like recently at FOSDEM) :)

      As a NUT maintainer, I love TermUX for the sufficiently capable Linux environment in my pocket that I can take with me on commute or vacation, where whipping out the laptop would be prohibitive (e.g. prohibited by family, time slot, or by baggage weight). Heck, for the fun of it, one release was made from the ocean just to prove to myself that it is that sufficient, and maintainer guide too.

      Didn’t realize docker is a thing here, will take a look. Found TermUX-X11 recently though, to test/fix the GUI clients – works decently with split-screen on MIUI.

      Back to the original topic, I remember clusters of PlayStations were popular when we were young, to study the concept of multi-core multi-box setups. I guess our kids can indeed get newer toys… collecting dust in a drawer so far.

      1. “Didn’t realize docker is a thing here”

        chroot is 45 years old, but you need to be root, which is mostly not the case on Android.

        proot allows users to spin a container by faking root, which works in most cases.

        I have a piled of “old” Android hdmi sticks, tablets and phones that could be used for something without changing the linux kernel, which is really painful.

        “the places we meet (like recently at FOSDEM) :)”

        Never missed an edition since it exists, even when I had fever :-)

  2. But what about the spicy pillow situation? I’ve considered it, but even leaving phones in a storable state of charge I worry. Then there’s ‘having them plugged in constantly unattended’ to add some anxiety… Maybe it’s unfounded and battery chemistry/charge controllers are safer than I think

    1. you can flash a custom rom with charge control ability and set charge state at something in 20 to 30 percent it won’t pass over that amount and the voltage is totally safe

    1. In the TL;DR sense, a cluster takes a large computing task, breaks it down into job chunks, and distributes each job to members of a cluster. parallel computing, as it were. There are many ways to accomplish this feat.

    1. hard to interpret but fwiw i had a moto x running the stock OS and if it was left plugged in constantly (which it was, i used it as an alarmclock), it would stop charging and then deep-discharge its battery, causing it to puff up. that was from the brief moment when google owned moto. there is no easy way to guarantee against obviously stupid faults

  3. This is a great idea, but I think the project needs to shift resources from niche phones to mainline USDM/EUDM phones and basic functionality. It’s great that SMS and USB-OTG work on the Xiaomi POCO X3, but the most recent flagship phone from a major manufacturer on the supported devices list is the Pixel 3a, and even on that, Wifi functionality is “Partial”. Forget anything in the Galaxy S or modern Pixel families. How can I repurpose an old S20 if Wifi is “Broken” and Screen is “Partial”?

    1. yeah if you want to repurpose any old phone it’s usually a lot easier to write (or find) an android app to do what you want rather than to replace android with an alternative OS. sometimes it’s handy to jailbreak it so that you can uninstall the bloatware that makes it unfit for use too…

    2. I have successfully used a bluetooth mouse and keyboard on a phone with a bad touchscreen. The screen displayed fully but lost touch sensitivity in some large areas.

  4. Probably the biggest downside of smartphones is lackluster disk i/o performance, even in new models still. RAM is also not great though that is improving with newer 16GB-24GB phones.

    1. the point of these sorts of projects is reuse not performance, if performance is your concern you are already paying out the nose for the latest and greatest silicon that needs datacenter HVAC, writing your own baremetal code, etc.

      1. this exchange exactly highlights why i just don’t see the point of this kind of reuse.

        if you’re turning an old phone into a ‘compute server’….why?? typical PCs have so much performance leftover, what do you need more compute for? if you’re using it for a task where performance doesn’t matter, why do you need a separate computer for it?

        there are specific answers to this question but none of them call out for ‘clustering’ ?? the whole point of a cluster, i thought, was to get over performance or reliability limitations of a single unit. but that would mean that you care about performance or reliability, and if you cared about either of those you generally wouldn’t touch a used phone.

        1. you’d be surprised how long a phone sans battery can be servicable, the oldest in my fleet is from 2012, and redundancy is often achievable especially when the battery is still good for a few years, I have loads of them performing tasks around the house, displaying metrics, running all manner of low priority processing jobs, they net boot so if the phone fails, no biggy, the process gets migrated to another from the last snapshot.

          sure I could do that with a PC, then I’d need to buy displays, extension cords, more graphics cards, UPS, costs adds up, on the other hand I can ask around at work for spare phones and boom easy self contained hardware that can be powered off a small solar panel, that with a few days of tinkering running my custom kernel and registered on the grid.

          this specific case was the guy feeling that the RPi4s they were using didn’t have the grunt needed and wanted to extend their k8s homelabs, and phones often come with pretty good if poorly documented hardware.

          homelabs are frequently used for learning, you can’t simulate every operating mode of a cluster in software.

          1. that sounds awesome i just don’t understand how it’s possible. my old phones pile is so diverse…unless i’m using an android app, i don’t migrate anything..it’s always starting from zero with the unique struggle with the bootloader, and the unique struggle with the kernel, and the unique struggle with the peripherals. it’s even a struggle to get the thing to even turn on without a battery. i have used phones around the house as displays and so on and never found them to be suitable for any length of time.

            i agree it’s possible in principle, but in practice i’m surprised you say you’re having any success. have you accumulated several copies of the same phone or something?

            and for low-priority processing tasks, that’s just a mystery to me. i run all my processing tasks on some giant amd64 supercomputer i bought in 2019 for $300. low-priority, high-priority, i just pile more onto it and it’s nowhere near full.

        2. An old phone is a very handy tool for surveillance & remote monitoring. It has built-in UPS, mic, speaker and cam. It’s inconspicuous, probably will go unnoticed while gathering all kinds of data, the perfect spy. Tailscale with subnet routing or even adb + scrcpy turns it into a gadget worthy of spies. I’d never buy a surveillance cam, I’d just get a second hand phone DIY it.

  5. I have not used termux with docker but can attest to it’s general awesomeness. The Android phone is already running a Linux kernel so this gets a rather bare Linux userland you can then install and run more Linuxey goodness on top of. No special permissions required.

  6. I think the writer of this article doesn’t know much about the state of custom stuff on Android phones.

    Perhaps the most significant flaw of smartphones, though, is that most of them are locked down so much by their manufacturers that it’s impossible to load new operating systems on them.

    no, not really. It’s more like “most of them don’t have functional ports of operating systems, therefore it’s impossible to load new operating systems on them”. Which is a given, since no one cares about even just unlocking their phones’ bootloader, let alone installing even just a custom ROM like LineageOS, so why spend the effort porting things like postmarketOS if no one will appreciate the port(s)?

    For this project you’ll need to be lucky enough (or informed enough) to have a phone with an unlockable bootloader so that a smartphone-oriented Linux distribution called postmarketOS can be installed.

    yeah, um…. you will definitely need a lot more “luck” than being “informed”, since even most bootloader-unlocked Android devices don’t get a postmarketOS port, at all. Then again, you can port postmarketOS to your device by yourself….

    1. Yeah software support is a much much bigger problem than bootloader lock.
      And porting pmos isn’t gonna be fun when your device is on a platform with no existing support.

    2. i agree with the thrust of this but it’s just kind of luck (in my experience) whether bootloader lock is the specific hurdle that matters most to you. my previous phone came from moto and i generally have the feeling they will unlock their bootloaders, but even though i bought it from moto’s website, i got a great deal on it because they were selling me a locked-to-at&t edition of the last year’s phone. and at&t had a policy that they would unlock the bootloader after a year of subscription but that policy was vaporware…called at&t “you need to talk to moto”. called moto “you need to talk to at&t”. it eventually fell to a constant-reboot failure, which i never bothered to figure out if it’s a simple cause or not but is in the category of “unsuitable for reuse.”

      as an aside, the phone before that was unlocked (nexus) but it also fell to a known hardware defect (poor soldering?) after a long enough time that there was no manufacturer support. i have had a run of unsuitable-for-reuse phones.

    3. Ehrm, well … “most of them don’t have functional ports of operating systems, therefore…” — don’t cha think that if the hardware issues were not as they are today that developers on both sides would have far greater chance of producing functional ports?

      I have a box full of bootloader locked Android phones. I know if I were able to obtain the unlock codes via manufacturer or even carrier, I very well could have ported enough of the Linux kernel with regards to the hardware specs of the mobile that by now, it isn’t hard to imagine that I’d have some distro going by now.

      The hardware specs for the various chips n what not for the phone itself is wayyy easier for me to find in comparison. WiFi is the biggest ugh, but even that isn’t impossible w/ the information we have on these phones.

      Anyhow, I hold onto this box, in part in the hopes that some day the bootloader unlock codes do become easily found for me. Or, as time ticks by, I find time to root the phones myself, one by one… but I know that if it is the latter, the hope of having any of this is slim to zero.

      Thoughts?

      Cheers,
      Jeff

  7. You’re a friggin genius bruh … I was thinking about this same thing about a month ago.. thinking it would be cool to run Android Virtualization Framework enabled phones ain a kubernetes or LXD cluster.. however AI assured me it can’t be done..

    Now I run across this..thanks! 🕺🏽🕺🏽

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.