_ __ __ _
(_)__ / /_________ / /________ _______(_)
/ / _ \/ __/ ___/ _ \/ __/ ___/ / / / ___/ /
/ / __/ /_(__ ) __/ /_/ / / /_/ / / / /
__/ /\___/\__/____/\___/\__/_/ \__,_/_/ /_/
/___/
(Originally posted to Cohost on Fri, Sep 29, 2023, 5:29 PM)
EDIT: Image links are dead because they depended on Discord for image hosting. I think a lot of my older blogs have this problem. I'll get to it soon...
Pictured above is my 2010 Motorola Droid Pro running Debian 8 via chroot, running under a rooted CyanogenMod 7 install. The first picture is an IceWM desktop. The second picture is the Droid Pro hosting a Mono-based Minecraft Classic server (fcraft) to the rest of my LAN.
This blog post will also dive into non-root solutions for modern phones.
If you're an iOS user, you also have UTM and iSH! Though they're based on emulation, and the blog won't cover those.
Last blog post then I'm gonna take a break again. This one's gonna be surprisingly more in-depth than usual.
I feel like people should talk about Linux on Android much more often. Many of us known that Android is based on the Linux kernel, but what we don't know is that it remains close enough to the upstream kernel that you can run most Linux programs on there, with a little help, turning your phone or tablet into a low-power pocket PC.
So, here are the several ways I've been able to run Linux programs on Android.
(Note: If you don't have a custom ROM, I do recommend debloating for performance, and getting a per-app firewall for privacy. I have all system and user apps blocked from the internet by default except for a few.)
(This is my low-end Moto running IceWM via proot-distro Debian, using Termux-X11 to display the desktop. XFCE works too, but I've yet to test LXDE, MATE, KDE, or GNOME.)
For the ones out there who love to tinker, Termux turns your "consumption slab" into a fully-blown workstation. It's an app that implements a Linux environment within itself, without any form of emulation. It's built up an unfortunate reputation as a "hacking app", which the Termux wiki warns against. In reality it's much more than that.
(And for the ones who don't, you could probably get by with AnLinux.)
Anyway, once you start it up for the first time, you'll be welcomed
with a terminal. Termux uses an apt-based package manager
(pkg
), and most command-line tools are available. Classic
UNIX tools, Python and pip, NodeJS, what have you.
You can enable the X11 repository and run a desktop environment, either by hosting a VNC server from your Android and connecting to it (either on the same Android or a remote computer), or by using the experimental Termux-X11 standard (my favorite feature being the dynamic resolution that adapts depending on how much screen space you have).
Last but not least, proot-distro (similar to "chroot" if you're familiar with it) can be installed from Termux's repo, letting you run other distros and their packages, like Debian (my preference), Arch, Void, etc. with little overhead.
Someone used it to run Blender and other workstation software on their phone. Someone else used it in place of their aging laptop (with their laptop connecting to their phone) due to their phone having better hardware. If you're interested, this old guide might help you set it up.
And if you care about x86 emulation, you can also compile and run box86/box64, whether it be manually or with the help of projects like Box64Droid. That's how the Dwarf Fortress Android post was able to exist.
I have a recording from November 2022 of me running Freedom Planet -- and another of Momodora: RutM -- on my budget Galaxy phone this way, but the framerate was too sluggish to be considered playable (possibly thanks to missing OpenGL/hardware rendering). Freedom Planet was recorded from my crappy camera, and Momodora was recorded via scrcpy.
I might revisit it sometime soon since a blog post has been made on how to use hardware acceleration (see here).
Termux hasn't been updated on Google Play in a while, so it's generally recommended to get it from F-Droid or GitHub. The latest stable release (2022-01-11) supports Android 7.0+, but they've brought back support for Android 5.0+ devices in development builds (see here).
Important note: Android 12+ has a "phantom process killer" which will result in your desktop environment and programs being terminated. You'll need to use adb to disable this limit.
(This is my 2013 Kindle Fire HDX running XFCE, browsing Firefox and running GIMP all at once.)
I don't touch upon this one often, but it's saved my bacon before. I was able to repurpose my older tablet into a Minecraft server (which Termux can do) or Pi-Hole (as non-root Termux can't open the needed Pi-Hole ports to the rest of the network, only 1024 or higher), and even turn my 2010 Android phone into a lightweight Linux PC with 512MB of RAM (though the old kernel meant I could go up to Debian 8). This is a near-universal solution for Linux-based operating systems, as I even recall running Windows XP on my AsteroidOS smartwatch.
With a rooted Android install, you can actually chroot into
a Linux filesystem. It's not a "full" system (so no init, no services,
no hardware acceleration), but it's really close to one, and is said to
be more performant than proot-distro. You can do it manually via
Android's terminal (I do it through adb
), or you can use an
application that makes the installation seamless, like Linux Deploy.
Similar to Termux, you can choose to install a distro, a window
manager or desktop environment, and install and run a VNC server (for
Debian it's tigervnc-standalone-server
), to connect to on
the same phone it's hosted on (my favorite VNC client being either MultiVNC
or bVNC
Free, as I mentioned earlier).
I admit I used it at one point as a stand-in for my desktop PC when it was unavailable. I was able to run MAME (recall it being slow), edit files in Audacity, and edit images in GIMP.
(The keyboard is Hacker's Keyboard from F-Droid. Unexpected Keyboard is another great keyboard for power users.)
Linux Deploy can only be found on GitHub, and it hasn't been updated in two years, so it's been forked into Linux Deploy Pro, with up-to-date distributions. Both of them may have their fair share of problems as I've touched upon in an earlier blog post outside of Cohost. Though Linux Deploy Pro's might've been fixed by now:
Important note: I find myself having to use
/data/data/ru.meefik.linuxdeploy/files/bin/linuxdeploy shell
through adb or Termux as a root user to access the chroot environment
after starting it through Linux Deploy. Maybe I'm doing it wrong?
This is pretty much the most masochistic option (since emulating a full system is going to be slow), but also the most fun in my experience. You can run an operating system (e.g. Windows, Linux, *BSD, etc) of your chosen architecture (x86 is the easiest to set up, but ARM and RISC-V might have slightly better performance), and thus you have more control over what goes into the system. Windows XP has been emulated this way dozens of times by now.
QEMU is available on Android via Termux's native repository, proot-distro repositories, and the Limbo PC Emulator app (which hasn't been updated in over a year).
I talked about QEMU via Termux in an earlier blog post, too.
I think I'm about done with this post. Hope you've enjoyed this one!