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
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.