a casual's take on Mobile Linux

don’t you want to enjoy your favourite pc apps on the go? don’t you want to type or draw or code without weird storage nonsense and seas of ads? don’t you want to actually have a fully browsable system on your phone? don’t you want actual root access?

putting linux on mobile phones seems like an ideal choice. it’s got a reputation for running better than its competitors on just about anything - even on their own hardware! and as it turns out, there are in fact many projects working on doing so. so, what’s the holdup? why aren’t we all running our favourite flavours of linux on our pocket bricks yet?

they grow on trees

mobile devices usually have cpus with the arm architecture, mostly because it’s way more efficient power drain wise than the standard x86 you’ve got in your average computer. this does mean that it’s necessary to recompile apps for the new architecture, but since most linux apps are open source anyways and projects like box86/64 exist, this problem can be somewhat sidestepped - albeit with a performance penalty.

there’s one more quirk with arm that makes it a lot more annoying to work with. x86 devices are plug-and-play with their components: you can put any cpu and gpu into it, and it’ll detect it. for linux though, that’s not how things happen in arm land; every device needs something called a device tree, which lists the components within it. this means extra legwork to get your device up and running in the first place, even if the components are supported in the kernel.

speaking of; component support in the kernel sucks. the cpus themselves are well supported if they’re snapdragons because of the tireless work of the folks at Linaro, but if it’s a mediatek or any more obscure nonsense you’re out of luck. cameras and modems (yes, your phone has a li’l modem in it for calls and mobile data) are extremely rough in general both in the kernel and userspace. graphics are usually underbaked. other components vary; good luck finding support for anything past 2019 or so, though.

how to do it anyways

there are multiple projects of independent developers trying to put linux on their particular devices (and often similar ones by proxy). you’ll see the term “mainlining” thrown around a lot, which refers to the act of taking code from downstream (unofficial) kernels (if any. you might need to poke at the boards themselves if you’re particularly unlucky) and completely rewriting it to fit the requirements and standards of the upstream linux kernel. you win when your stuff makes it into upstream, but it’s passable to be “close to mainline”, which just means you’re not completely on a downstream android kernel and can run DRM (no, not digital rights management. it’s linux nerd stuff).

just using the downstream kernel is a no-go. you can technically do it, but it’s a hack frowned upon by most, mostly because downstream kernels tend to be massively outdated. there’s a project called halium which straight up loads linux on android’s hardware abstraction layer using hacked together software, but it’s extremely janky.

most of the actual projects for mobile linux apps expect you to be running mainline anyways. the top three mobile window managers - phosh, plasma mobile and gnome’s experimental mobile version - are all exclusive to wayland and require DRM (which still doesn’t stand for digital rights management).

other than that “mainline” means jack shit; just because a device is “close to mainline” doesn’t mean that it has calls or wifi or hardware accelerated rendering. the postmarketOS wiki is a good place to check the support for whatever device you might be interested in, but it probably won’t be pretty.

old devices are surprisingly well supported, but don’t expect good performance out of dinky 2 core 1.2ghz cpus. modern devices, like the OnePlus 6 do exist within this space though - watching this one run so smoothly is like a glimpse into a better world. it brings a tear to my eye.

i daily drive a samsung galaxy s23. nobody’s brave enough to come at it with a hacksaw to get it running, despite the surprisingly passable mainline support for some parts - and that includes me. i’m too much of a casual to get into kernel development, at least with my current level of knowledge; and i kinda don’t want to void my warranty or risk not having phone calls or crucial apps. even if i don’t really call anyone, sms is used in places as a form of 2fa, and don’t get me started on not having a bank app in today’s world.

perhaps my view is a bit skewed; my exposure to mobile linux consists exclusively of two tangentially related linux experiments and my friend who mainlines phones from around 2012, which run poorly due to miscellaneous jank and having been made before the advent of modern opengl respectively.

mobile linux for the noncommital

ok, let’s talk about one of those two tangentially related linux experiments now. these were originally supposed to get their own blog posts, but i might as well bring them into this.

i actually use this one pretty often. you’ve probably heard of termux - it’s a commandline for your android device. you can pair it with an x11 server and proot to run an actual linux distro without the need to root your phone, but it’s going to be a little janky.

An image of XFCE4 running in an Android app, vaguely themed like Gnome. A console window running neofetch is open, but the output is cropped out.
featuring a cut-off neofetch (foreshadowing)

obviously, using an actual mobile shell is a no-go, since they’re all on wayland. there is hardware acceleration using the underlying system, but it’s a bit lackluster as far as performance is concerned, so my choice for a window manager was good old xfce4. the experience is surprisingly fine, using a touchpad-like mode for moving the cursor (despite the lacking “double tap to hold” option in termux:x11).

scaling is awful, though. x11 doesn’t support fractional scaling (or any respected system wide scaling at all), so i settled on lowering the display resolution, which made it blurry - but hey, it probably runs faster at a lower resolution?? even then, most apps just aren’t capable of being squished this far, and the ones that do are usually made in gtk4 (read: run like shit) and/or decide on their own scaling based on dpi. maybe i should just try the kde offerings, who knows.

of course, my main use case for this thing is coding on the go; or at least it would be, if i could just get a working code editor.

  • nano is too minimal, i need at least basic syntax highlighting and jumping to function and variable definitions (if it has it please let me know);
  • helix has full on ide styled syntax highlighting and suggestions/floating docs popups, but it suffers from the problem all non-nano commandline editors suffer from: it’s made by commandline editor nerds who love to press twenty keybinds per second to type in three places at once in increasingly strange ways. this is obviously a no-go on a mobile keyboard, and also damns vim, emacs and derivatives;
  • gnome text editor is made in gtk4 (read: runs like shit), has syntax highlighting at least (but no jumps) and starts to irreversibly crash on startup after being used 10 or so times on every device i’ve tested it on;
  • intellij ides are too heavy;
  • vs code and derivatives don’t start up at all due to jank with the termux proot setup (and neither does github desktop);
  • and lapce sucks so bad it isn’t useable even on non-mobile devices.

this leaves only kate, which is decent for light scripting, but crashes when trying to run code analysis (again, jank with the setup) and qt creator. neither of these fit perfectly in the mobile screen space, but the code is readable and writable enough for them to be somewhat comfortable to use.

this kind of debacle repeats for every app (except for firefox, which is fine with this, except for the “extension wants new permissions” window cutting off at the bottom making it non-interactable). it either doesn’t work, doesn’t fit or runs like shit.

yet, hope blossoms

it’s a closed cycle, really; mobile linux support is rough, linux apps don’t target mobile form factors, nobody wants to use mobile linux. people don’t want to lose out on their bank app. people don’t want their phone to fail to call emergency services in a crucial moment. people don’t want to become low level driver developers just to get their phone working when “on pc it just works”. people just want to play candy crush and chat with their relatives on whatsapp and scroll tiktok and whatever.

but there’s hope. there are people determined enough to make it work. there are people willing to change the system, to make apps and frameworks which target mobile - for all the slack i give gnome and gtk for their performance, their efforts in pushing mobile friendly uis are admirable, and they aren’t the only ones, with kde hot on their heels. companies are taking note, too; arm laptops are officially becoming a trend with snapdragon’s new offering, and much like their mobile chips they are recieving official linux support, including all the fancy stuff like hardware acceleration.

i, for one, accept our new more power-efficient architecture overlords, especially if some of that enthusiasm trickles down to better support for linux on phones and standard issue tablets. here’s to hoping!


Categories: