Modern smartphones based on Android have computing power that surpasses many budget laptops from ten years ago. However, the architecture ARM and closed nature of the system often limit the capabilities of enthusiasts who want to launch full-fledged desktop applications. The solution to this problem is to run the kernel Linux on top of the mobile operating system.
There are several ways to implement this task: from using terminal emulators to deep flashing the device. The choice of a specific method depends on your goals: whether you need a temporary console for scripts or a full-fledged graphical work environment with office apps. In this article, we will look at the most secure and effective integration options.
It is important to understand that running Linux on Android does not instantly turn your phone into a laptop. Touchscreen controls in desktop interfaces can be awkward, and performance in graphics applications is often limited by drivers. However, for programming tasks, server administration or training, this is an ideal testing ground.
Preparing the device and choosing an installation method
Before starting any manipulations, you need to evaluate the capabilities of your gadget. The key parameter is the presence of root access (superuser). Without them, you'll be limited to user-space methods like Termux. If you are ready to gain full access to the system, you will be able to use Linux Deploy or direct installation via chroot.
It is also critical to check the amount of free memory. Distributions like Ubuntu or Debian with a graphical environment can take up from 2 to 8 GB of space. Make sure that your storage is not full, as lack of space during the recording process can lead to damage to the file system.
โ ๏ธ Attention: Obtaining root access (rutting) will void the warranty on the device and can lead to the smartphone being turned into a โbrickโ if done incorrectly. Always make a complete backup of your data before starting work.
There are two main installation approaches. The first one is without root access, using proxy and emulation mechanisms (PRoot). It is safe, but has restrictions on access to hardware. The second is with root access, which allows you to run native daemons and gain direct access to the hardware, which significantly improves performance.
Installing Linux without root access via Termux
The most accessible way to launch a Linux environment is to use an application Termux. It is a powerful terminal emulator that provides a Linux-like environment without the need for system modification. To install a graphical interface, a script Andronix or package Proot-distro.
is often used in conjunction with it. The process begins with installing the application itself. Please note that the version from Google Play Store is outdated and not updated. You need to download the current build from F-Droid or GitHub. After installation, update the packages by entering the command pkg update && pkg upgrade in the terminal.
Next, the required distribution is installed. For example, to install Ubuntu use the command pkg install proot-distrofollowed by proot-distro install ubuntu. After installation, you can log in with the command proot-distro login ubuntu. This will give you a full-fledged Linux console.
For comfortable work with code in Termux, install the nano or vim editor with the pkg install nano command. This will allow you to edit configs directly in the terminal.
If a graphical interface is required, you will need to install a VNC server. In the environment Termux this is done by installing packages tigervnc and selecting a desktop environment, for example XFCE. After starting the server, the connection is made through a third-party application VNC Viewer on the same device.
โ ๏ธ Attention: Android versions below 7.0 may not support some Termux functions due to changes in the file system access policy. In such cases, the functionality will be strictly limited.
โ๏ธ Preparing Termux
Method with root access: Linux Deploy and Chroot
For users with an unlocked bootloader and received root access a more powerful tool is available - Linux Deploy. This application creates an image file or partition onto which a full-fledged distribution package is deployed. Unlike PRoot, it uses a mechanism chrootthat provides native code execution speed.
Setting up Linux Deploy requires care. In the settings menu, you need to select the architecture (usually armhf or arm64), installation source (for example, Debian or Kali Linux) and installation type (file, partition or directory). It is recommended to use an image file of at least 4 GB in size for comfortable work with the GUI.
An important step is setting up the graphics subsystem. In the parameters Linux Deploy you need to enable installation GUI and select an environment, for example LXDE or MATE. The connection method is also indicated: usually this is VNC. After setting all the parameters, click the "Install" button in the lower right corner of the screen.
sulinuxdeploy
Next follow the instructions of the setup wizard in the application interface
The installation process may take from 15 minutes to an hour depending on the recording speed of your drive and the Internet speed. When finished, the "Start" button will appear. Clicking on it will launch the Linux environment and you can connect to it via a VNC client by entering the address localhost:5900.
Why is Linux Deploy faster than Termux?
Linux Deploy uses the native Android kernel (which is based on Linux) directly via chroot, avoiding the system call emulation overhead that is present in PRoot mode (Termux).
Comparison of popular distributions for mobile devices
The choice of operating system depends on the tasks. Not all desktop distributions are optimized for architecture ARM and touch controls. Some projects, such as PostmarketOS or Ubuntu Touch, are created specifically for phones, but require complex installation instead of simple launch in the application.
Classic distributions remain the most universal for working in Android applications. Debian famous for their stability and minimal consumption resources. Ubuntu offers more recent software and a wide knowledge base, but may be heavier for older smartphones. Kali Linux popular among cybersecurity specialists due to a pre-installed set of utilities for pentesting.
| Distribution | Complexity | RAM requirements | Best use |
|---|---|---|---|
| Debian | Average | 512 MB+ | Servers, stable work |
| Ubuntu | Low | 1 GB+ | Desktop, training, development |
| Kali Linux | High | 2 GB+ | Testing security |
| Arch Linux | Very high | 512 MB+ | Advanced users, customization |
It is worth noting that The architecture of the smartphone processor (ARMv7 or ARM64) determines the compatibility of packages. Trying to install a package compiled for x86 (regular PCs) in an ARM environment without an emulator (like Box64) will result in a runtime error. Always check the repositories for versions for arm64.
Configuring the graphical interface and peripherals
Running a โbareโ console is often not enough for full operation. Installing a graphical shell (Desktop Environment) turns the smartphone into a kind of tablet with windows and menus. The most lightweight and responsive option for mobile screens is considered XFCE or LXQt.
To control the mouse and keyboard, Android usually does not require additional drivers when connected via OTG. However, in a Linux environment, layout problems may occur. This can be solved by installing the package x11-xkb-utils and setting up the configuration file X11. Touch input is emulated as mouse clicks, which can be inconvenient for dragging windows.
Sound is often missing in the default emulated Linux environment because applications try to access a sound server that doesn't exist in the sandboxed environment. To solve the problem, you need to forward the audio device or use PulseAudio over TCP/IP, which requires additional configuration in the configuration files /etc/pulse/client.conf.
โ ๏ธ Attention: VNC interfaces do not encrypt traffic by default. Do not use open Wi-Fi networks to connect to your Linux environment to avoid data interception. Use SSH tunnels for security.
The XFCE graphical environment is the golden mean between functionality and resource consumption on mobile devices, ensuring smooth operation even on 2-3 GB of RAM.
Typical errors and how to resolve them
When installing, beginners often encounter the "Permission denied" error when trying to execute a script. This is due to the fact that the Android file system (especially on new versions) is mounted with the noexecflag. The solution is to move the executable files to the internal Termux directory ($HOME) or use the command chmod +x where it is allowed.
Another common problem is a โblack screenโ when connecting via VNC. This often means that the graphics server has not started or is on the wrong port. Check the logs in the terminal (tail -f /tmp/*.log) and make sure that port 5900 is not occupied by another process. Sometimes restarting the service helps vncserver with an explicit indication of the color depth, for example, vncserver -geometry 1280x720 -depth 24.
Problems with the Internet inside the container may arise due to incorrect DNS settings. If the ping goes to IP addresses, but the domains are not resolved, write in the file public DNS servers, such as Google or Cloudflare. This will restore access to the repositories. /etc/resolv.conf public DNS servers such as 8.8.8.8 from Google or 1.1.1.1 from Cloudflare. This will restore access to the repositories.
If the application Linux Deploy freezes at the "Configuring" stage, try disabling the GUI installation at the first stage. Deploy a clean system, make sure it boots, and only then install the graphical shell manually through the console. This simplifies diagnostics.
What to do if the phone overheats?
Running a heavy Linux distribution creates a high load on the CPU. Close background Android apps, lower screen brightness, and remove the case for better cooling. In Termux, you can limit the number of compilation threads.
Alternatives: Complete Android replacement
For owners of devices with an unlocked bootloader, there is a radical option - a complete replacement of Android with mobile Linux, such as PostmarketOS, Ubuntu Touch or Sailfish OS. This gives you true native Linux, but makes it impossible to run apps from Google Play without complex emulators.
Hardware support on such systems varies. On some models (for example, old OnePlus or Pixeleven calls and a camera work. On others, only Wi-Fi and the console function. Before such an installation, be sure to study the device status (Device Status) on the official wiki resource of the selected distribution.
This path requires skills in working with fastboot i adb. The process includes unlocking the bootloader, installing a custom recovery (for example TWRP) and flashing system images. This irreversibly deletes all data and is more difficult to roll back than installing an emulator application.
Is it possible to run Windows apps on Linux inside Android?
Yes, this is possible using a compatibility layer Wine or an emulator Box64 in conjunction with Wine. However, performance will be low, and only old or lightweight applications (for example, Notepad++, old games) will be able to run. Heavy software like modern versions of Photoshop will not work.
Do you need a computer to install Linux on your phone?
No, most methods (Termux, Linux Deploy) work completely autonomously on the smartphone itself. A computer may only be needed to unlock the bootloader (via ADB/Fastboot) or to completely flash the device to an alternative OS.
Is it safe to enter passwords for banking applications in a Linux environment?
Absolutely not. The Linux environment running on top of Android does not have the security and isolation certificates of the original OS. Entering confidential data in an emulated environment can lead to its compromise.
How to remove installed Linux?
When using Termux or Linux Deploy, just uninstall the application or erase the distribution image file in the app settings. The data does not affect the main Android partition. When completely flashing (PostmarketOS), you need to return the stock firmware via Fastboot.
Why doesn't sound work in Linux on Android?
This is a common emulation problem. Android uses its own audio subsystem (AudioFlinger), which is not directly visible from the chroot container. Installation and configuration of PulseAudio or the use of special audio forwarding scripts is required (for example, in projects like KeX or specific Termux configs).