Running Linux apps on Android without rooting your phone
Phone as Linux PC
UserLAnd lets you run Linux applications on your Android phone – all without replacing Android OS.
Smartphones are getting more and more powerful. Is it time to start thinking of a smartphone as something more like a tablet or a real computer? Is it possible to set up an Android phone with a full version of Linux – connected to a monitor, keyboard, and mouse?
Android OS is based on a modified version of the Linux kernel. In theory, a hardware-compatible Linux should be able to run on systems that Android OS runs on, but the Android developers at Google have added lots of proprietary drivers and bits. Additionally, the complexity of the communication hardware means that Android has drifted quite a distance from what we think of as a conventional Linux. Still, the power of the GPL means that Android OS is available to the community in source code form [1], and of course, developers all over the world are always tinkering with Linux to make it do useful things. A number of independent distros have evolved to provide mobile alternatives based on both the Linux kernel and the Android kernel (see the box entitled "Linux on Android Distros").
Linux on Android Distros
Several Linux distributions bill themselves as replacements for Android in the mobile space. These distros are all at various stages of completion – some work for certain phones but not others, and some are still in preliminary stages of development. Be sure to check the hardware compatibility list and read as much as you can about these alternatives before you install. Examples include projects such as:
- Ubuntu Touch – a mobile version of Ubuntu. When Canonical backed off on their mobile initiative a few years ago, the UBports community took over the development and maintenance.
- postmarketOS – a mobile OS based on Alpine Linux.
- Sailfish OS – a commercial project that bills itself as "a European alternative to dominating mobile operating systems." Sailfish is based on the code from the old MeeGo mobile OS.
- Mobian – a project promising Debian for mobile devices.
Another class of distros retains the Android base system but removes the proprietary parts, thus creating what is basically an Android-based system that is free of Google. Distros such as LineageOS, Replicant, /e/, and GrapheneOS are examples of open source, non-proprietary systems based on Android.
A full install of a mobile-based Linux on your smartphone provides a complete escape from Google's walled garden and offers access to the wide range of applications provided with Linux. But it also comes with some risks. You'll need to root your phone to replace the factory-installed OS, which will almost certainly void the warranty. If anything goes wrong, you might not be able to restore the original system.
This article describes a less radical alternative for running Linux on your Android. UserLAnd is a compatibility layer for Android OS that lets you run selected Linux distros on Android – all without rooting you phone. Of course, you are not really replacing Android, so if that is your goal, one of the alternative Linux mobile systems would be a better choice. But if you're looking for the Linux desktop, UserLAnd delivers it with minimal disruption. I'll show you what worked and what didn't – and I'll explore how the performance of a UserLAnd Linux smartphone compares to an average home computer.
A note on the hardware used in this study: My smartphone is powered by a 2018 Qualcomm Snapdragon 845 with 8 cores and 4GB RAM, including an Adreno 630 GPU. I also tested my daughter's phone, with the successor Snapdragon 855 and 6GB RAM plus an Adreno 640 GPU.
Monitor
If you want to embark on the adventure of converting your smartphone into a PC, the first step is to equip it with the necessary components. First comes the monitor. An Android smartphone with a USB-C port can output the screen image on a monitor or TV. However, not all recent Androids support this option; some – by Sony, for example – fail to identify the adapter.
But that does not mean you have to give up. If you don't have a working port, you can always fall back on wireless screen sharing with Google Cast or another similar tool. I have also had some good experiences screensharing (also known as screen mirroring) with Miracast on LG and Sony devices. Miracast is a Wi-Fi Alliance standard that connects two devices wirelessly via Wi-Fi Direct and was integrated into Android versions from 4.2 and up to 6.0. Google's Chromecast took the place of Miracast in later Android versions.
Mouse and Keyboard
You can easily connect a mouse or keyboard via Bluetooth or with a suitable adapter. I use a combined USB-C Type-C-to-HDMI-HDTV adapter, which offers one HDMI, one USB-C, and one USB-A 3.0 port. Because the adapter gets very warm, I added a passive heat sink which was available from another project.
I plugged a small dual distributor into the USB-A port, which also has space for a microSD card. I had to make the distributor narrower on the side to make room for the wide HDMI connector. A small extension or a differently designed distributor would also solve the problem if necessary. There are also adapters that offer four independent USB-A ports.
Software
Android 10 comes with a new desktop mode that it enables when an HDMI adapter is connected. Depending on the manufacturer, this feature works more (Samsung, Huawei) or less (LG) well. You can also disable desktop mode in favor of simple screen mirroring. No matter what you decide on, the LG smartphones always output Full HD at 60Hz. Many Android apps still have to be adapted to this new desktop mode (wide format).
In order to run conventional Linux applications on Android, you need to emulate a Linux runtime environment on the smartphone. Luckily, the Linux community has a solution: the UserLAnd project, which is hosted on GitHub [2]. The software is also available on F-Droid and in the Google Play Store, or you could also compile it yourself – more on that later. Rooting is not required, and you do not need Google services.
The display of the smartphone's screen content is handled by a VNC viewer, which also runs on the smartphone and then sends the image to the external monitor (Figure 1). Various viewers are available for this; I can recommend bVNC Free and RealVNC. The VNC session runs in the smartphone on the localhost address 127.0.0.1:5951.
To completely fill the image area of the external monitor, you might have to set the format to 16:9. RealVNC v3.6.1 cannot cope with the Android 10 desktop mode at all, and bVNC always outputs an overly bright image; however, bVNC offers a well-scaled mouse pointer, at least in desktop mode. If the desktop is not completely visible or you want to enlarge a part of it, you can adjust with a two-finger gesture on the smartphone.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.