Many Android users eventually encounter limitations of the mobile operating system. Closed source code, intrusive advertising, telemetry collection and the inability to fully control the hardware force enthusiasts to look for alternatives. Linux offers the very freedom that is lacking in the world of Google. Installing a full-fledged distribution kit on a smartphone turns it into a powerful pocket computer capable of running desktop apps.
However, the path from the familiar interface to the command line or a new graphical shell is thorny. The procedure requires a deep understanding of the architecture of mobile devices. You must be aware of the risks: loss of warranty, the possibility of turning the phone into a โbrickโ and losing all data is just the beginning of the list. However, for those who are ready to experiment, the reward in the form of complete independence from corporations is worth it.
In this guide, we will look at two main approaches: secure installation through emulation in the Android environment and radical system replacement with a complete flashing. The choice of method depends on your device model and purpose of use. Take your time, carefully study the requirements before starting any manipulations with the software.
Preparing the device and choosing a distribution
The first step is to assess the compatibility of your smartphone. Not every device is capable of running full-fledged Linux. The key factor here is bootloader. If the manufacturer has blocked it, installing a native system will be impossible without complex workarounds that are often unstable. You will need to unlock the bootloader through official tools or third-party utilities.
Next you need to select the appropriate distribution. The world of mobile Linux is diverse, but not all systems are optimized for touch screens and the specific hardware of smartphones. Popular options include Ubuntu Touch, PostmarketOS and Manjaro ARM. Each of them has its own requirements for the amount of RAM and processor architecture.
- ๐ฑ Ubuntu Touch: Ideal for everyday use, has a convenient gesture-oriented interface.
- ๐ง PostmarketOS: Based on Alpine Linux, very lightweight, suitable for older devices, but requires terminal skills.
- ๐ก๏ธ Kali NetHunter: Specialized distribution for testing on penetration and security, runs on top of Android.
- โ๏ธ LineageOS with Linux Deploy: A hybrid option that allows you to run Linux applications inside custom Android firmware.
Before downloading the system image, be sure to check the wiki page of the selected distribution for support for your specific phone model. The community often creates ports for popular devices such as OnePlus, Xiaomi or Google Pixel. For less common models, the chance of finding a ready-made assembly is much lower.
โ ๏ธ Attention: Unlocking the bootloader on many devices (for example, Huawei or American versions of Samsung) may be technically impossible or irreversible. Check the blocking status in the developer settings before starting work.
Emulation method: Install without uninstalling Android
The safest way to get acquainted with Linux on a smartphone is to use emulator applications or containers. This method does not require unlocking the bootloader and saving data. You run a Linux environment in parallel with the main Android system, using the kernel of the current OS. This is an ideal option for running servers, scripts or desktop applications.
The most popular tool for these purposes is Termux in conjunction with Andronix or LXQt. Termux provides a terminal emulator and Linux environment, allowing you to install packages through a manager pkg or apt. Using special scripts, you can deploy a full-fledged graphical interface and connect to it via a VNC client.
The installation process is as follows: first, you install Termux from a reliable source (it is better to use F-Droid rather than Google Play, since the version in the store is outdated). Then the repositories are updated within the application and the necessary dependencies for the graphics subsystem are installed.
pkg update && pkg upgrade
pkg install x11-repo
pkg install tigervnc viewer
After setting up the VNC server, you can connect to the Linux desktop directly from your phone screen. Performance in this mode will be lower than in a native installation because resources are shared between the two systems. However, for programming or administration tasks this is quite enough.
Use an external keyboard and mouse connected via an OTG cable. This will dramatically improve the Linux GUI experience inside Android.
Native Installation: Complete Operating System Replacement
If your goal is to completely ditch Android and use your phone as a Linux-based device, a clean install procedure will be required. This process is similar to flashing a smartphone, but instead of custom Android, you install an image PostmarketOS or Ubuntu Touch. Your data will be permanently deleted, so make sure to back up anything important.
To get started, you'll need a Linux computer (or virtual machine), a USB cable, and command line tools. The main utility for flashing firmware is often fastboot or device-specific bootloaders, such as Heimdall for Samsung. The process begins by putting the phone into bootloader mode, usually by holding down the volume and power button combination.
The command to unlock the bootloader looks different for different vendors. For pure Android devices, it can be as follows:
fastboot flashing unlock
After unlocking, you need to flash a custom recovery (for example, TWRP), if it is supported by the selected distribution. Through recovery, a ZIP archive with the system is installed or the installation script is directly launched from a PC. Be extremely careful when choosing a partition to write to, an error can lead to damage to the partition table.
โ๏ธ Checklist before flashing
โ ๏ธ Attention: During a native installation, drivers for the camera, modem and Bluetooth may not work correctly or may be missing altogether. The Linux community has not yet reached parity with Android in supporting specific mobile hardware.
Setting up the environment and drivers
After successfully booting the system, you will be faced with the need for basic setup. Unlike Android, there is no initial setup wizard with pretty pictures. You will have to configure the network, time zone and user through the terminal or a minimalist menu. The command nmcli or the NetworkManager graphical applet will help you connect to Wi-Fi.
One โโof the main problems remains energy management. The Linux kernel on smartphones often lacks the optimizations found in Android, which results in rapid battery drain. You may need to install processor frequency management utilities such as cpufrequtilsto find a balance between performance and autonomy.
| Component | Status in Linux | Recommended action |
|---|---|---|
| Touch screen | Works great | Setting sensitivity in X11 |
| Mobile communications | Partial support | Checking modem compatibility |
| Camera | Limited | Using simple applications |
| GPS | Working | Installing positioning daemons |
| Audio | Stable | Setting up PulseAudio/PipeWire |
To install additional software, use native package managers. In Ubuntu Touch this is a store OpenStore, in PostmarketOS - apk. Avoid trying to run Android apps directly unless you are using a compatibility layer Anbox or Waydroidwhich also requires additional configuration.
What is Waydroid?
Waydroid is a container solution that allows you to run Android apps inside a Linux system almost native performance. It uses the same kernel as the host system, which makes it more efficient than classic emulators.
Solving common problems and system rollback
During operation, you may encounter freezes, lack of sound, or a non-working sensor. Often the problem lies in an incompatible kernel version or the absence of proprietary proprietary drivers (blobs). The developer community is constantly releasing updates, so regularly updating the system through the terminal can solve many problems.
If the system is unstable or you decide to return to Android, you will need to restore the factory image. To do this, download the stock firmware from the website of your smartphone manufacturer. The return process is similar to installing Linux: entering fastboot mode and flashing the partitions boot, system, recovery and userdata.
Make sure you have access to a Google or manufacturer account, which may be required to verify the device after returning to stock.
โ ๏ธ Attention: Returning to factory firmware does not always guarantee restoration of the "as from" state store." Some sections responsible for calibrating the screen or modem may be overwritten. Always look for complete firmware dumps for your model.
Native Linux on a phone is an excellent tool for learning and specific tasks, but cannot yet completely replace Android for the mass user due to problems with application compatibility.
Prospects for the development of mobile Linux
The mobile Linux industry is in a state of constant development. Projects like PinePhone i Librem 5 encourage developers to create systems designed for open source software from the very beginning. However, porting these developments to mainstream Android smartphones remains a challenge due to driver fragmentation.
Nevertheless, the opportunity to have a device in your pocket that is completely yours is becoming more and more real. With the growing popularity of containerization and improved support for graphics accelerators in the Linux kernel, the usability gap between Android and Linux is gradually closing. For enthusiasts, this is the best time to start experimenting.
Don't be afraid to make mistakes and try new distributions. Each installed system brings invaluable insight into how your device works at a low level. Perhaps you will find a way to make the camera work on a popular smartphone running PostmarketOS and share it with the community.
Where to look for support?
The main knowledge hubs are on the XDA Developers forum, in the GitLab repositories of the PostmarketOS and Ubuntu Touch projects, as well as in Telegram chats dedicated to specific models devices.
Is it possible to install Linux on a phone without unlocking the bootloader?
You cannot install a full-fledged native system. However, you can use emulation methods such as Termux, UserLAnd, or apps like Linux Deploy, which run inside Android and don't require root privileges or an unlocked bootloader.
Will banking apps work on Linux?
Native Android banking apps don't work on Linux. You can try to run them through an Android emulator (Waydroid), but due to security checks (SafetyNet/Play Integrity), most banking apps will refuse to function in such an environment.
Which phone is best for installing Linux?
Google Pixel, OnePlus and some Xiaomi models have the best support. There are also phones natively designed for Linux, such as the PinePhone Pro or Librem 5, where all the drivers are open source and work out of the box.
Will installing Linux delete all my data?
With the native installation method (Android replacement), all data will be permanently deleted. When using emulators (Termux and analogs), your data in Android will remain safe, since Linux works like a regular application.
Is it difficult to return Android back after installing Linux?
It is possible, but requires technical knowledge. You need to find the stock firmware for your model, download the flashing tools (Fastboot/Odin) and flash all the partitions manually. The process is risky and can take several hours.