Install Linux on a Phone: Full Step-by-Step Guide
In this article
Installing Linux on a phone replaces or dual-boots the Android operating system with a desktop-oriented Linux distribution, giving you a fully functional pocket computer with a traditional desktop environment. This is a complex process that requires unlocking the bootloader, flashing a custom recovery, and installing a Linux image. You will need a compatible phone, a PC, and about an hour of time. The exact steps vary by device and distribution, but the general process is consistent.
What You'll Need
- A compatible smartphone (check the distribution's supported devices list; common options include the PinePhone, Librem 5, or certain Xiaomi/OnePlus devices)
- A PC running Windows, macOS, or Linux
- A USB data cable that supports file transfer
- ADB and Fastboot tools installed on your PC (Android Debug Bridge and Fastboot)
- A Linux distribution image for your phone (e.g., Ubuntu Touch, postmarketOS, Mobian, or Manjaro ARM)
- A microSD card (optional, for dual-boot or booting from SD)
- Backup of all phone data (this process will erase everything)
Step-by-Step
- Check compatibility. Visit the official website of the Linux distribution you want to install and confirm your phone model is listed as supported. If it's not, stop here—installing on an unsupported device can brick it.
- Back up your data. Copy all photos, contacts, messages, and files to your PC or cloud storage. This process will wipe the phone completely.
- Enable Developer Options on your phone. Go to Settings > About Phone and tap the “Build Number” seven times. You'll see a message that developer mode is enabled.
- Enable USB debugging and OEM unlocking. Go to Settings > Developer Options and turn on “USB Debugging” and “OEM Unlocking” (if available). The latter may be hidden or unavailable on some carriers.
- Install ADB and Fastboot on your PC. Download the official platform-tools from the Android developer website, or install via your package manager (e.g.,
sudo apt install adb fastbooton Debian/Ubuntu). Extract the files to a folder you can access from the command line. - Connect your phone to the PC. Use a good USB cable. On the phone, when prompted, allow USB debugging. Verify the connection by opening a terminal/command prompt in the platform-tools folder and running
adb devices. Your phone should appear as an authorized device. - Unlock the bootloader. Run
adb reboot bootloader. The phone will reboot into fastboot mode. Then runfastboot flashing unlock(orfastboot oem unlockon older devices). Follow the on-screen prompts on the phone to confirm. This will wipe the phone and re-lock the bootloader after the process—note that unlocking voids warranty and may break some features like Widevine DRM. - Download the Linux image and recovery. From the distribution's official site, download the correct image file for your phone (usually a .img or .zip) and a compatible recovery image (like TWRP or a custom recovery). Verify checksums if provided.
- Flash a custom recovery. With the phone still in fastboot mode, run
fastboot flash recovery recovery.img(replacerecovery.imgwith your downloaded recovery file). Then reboot into recovery usingfastboot reboot recovery. - Wipe the phone (factory reset). In the recovery menu, select “Wipe” and then “Factory Reset” or “Format Data”. This clears the Android data partition. Confirm when prompted.
- Install the Linux image. In the recovery, select “Install” or “Apply Update”, then choose the Linux image file from your internal storage or SD card. If the image is a .zip, select it and swipe to confirm flash. If it's a .img, you may need to flash it to the system partition using
adb sideloador a dedicated installer script provided by the distribution. - Reboot into Linux. After flashing, go back to the main recovery menu and select “Reboot” then “System”. The phone should boot into the Linux desktop. The first boot may take several minutes.
- Set up your Linux environment. You'll be greeted by the desktop. Create a user account, connect to Wi-Fi, and update the system using the package manager (e.g.,
sudo apt update && sudo apt upgrade).
Common Mistakes
- Using the wrong image file for your exact phone model—always download from the official source and double-check the model number.
- Forgetting to unlock the bootloader before flashing—this will cause the flash to fail or soft-brick the device.
- Skipping the backup—data loss is irreversible.
- Using a low-quality USB cable that disconnects mid-flash, corrupting the system.
- Not enabling OEM unlocking in developer options—without it, fastboot commands will fail.
Tips
- Keep the phone charged above 50% during the entire process to avoid power loss.
- Use a microSD card to store the Linux image and boot from it first to test compatibility before committing to an internal flash.
- Join the distribution's community forum or IRC channel—they often have device-specific guides and troubleshooting threads.
- Write down your current Android version and build number before starting; you may need it to restore the phone later.
- If you plan to dual-boot, install the Linux image on the SD card and keep Android on internal storage, then use a boot manager like the one provided by postmarketOS.
Troubleshooting
If the phone does not boot into Linux, try the following in order:
- Check the bootloader status. Reboot into fastboot and run
fastboot getvar allto see if the bootloader is unlocked. If it shows “locked”, redo step 7. - Re-flash the recovery. Sometimes the recovery image doesn't stick. Flash it again and reboot into recovery immediately.
- Wipe data and cache again. A dirty flash can cause boot loops. In recovery, wipe the data and cache partitions, then reinstall the Linux image.
- Check the image integrity. Re-download the image and verify the SHA256 checksum against the official one. A corrupted download is a common cause of boot failure.
- Try a different distribution. If your phone is supported but the specific distro won't boot, try another one (e.g., switch from Ubuntu Touch to Mobian).
- Restore Android. If all else fails, download the stock firmware from the phone manufacturer's support page and flash it using fastboot or the manufacturer's tool (like Mi Flash Tool for Xiaomi). This will reinstall Android and restore normal functionality.
Frequently Asked Questions
Will installing Linux void my warranty?
Yes, unlocking the bootloader and flashing custom software typically voids the manufacturer's warranty. Some devices can be relocked, but the warranty is usually still voided.
Can I still make phone calls and use mobile data?
It depends on the distribution and your phone model. Many Linux phone distributions support cellular calls, SMS, and mobile data, but not all. Check the distribution's feature list for your device. Some may have limited support or require additional configuration.
Can I dual-boot Linux and Android?
Yes, some distributions support dual-booting by installing Linux on a microSD card or a separate partition. You can then choose which OS to boot at startup. The exact method varies—check the distribution's documentation.
Is it possible to go back to Android after installing Linux?
Yes, you can restore Android by flashing the stock firmware from the manufacturer's official support page. This will erase all data and reinstall the original system, but it will also re-lock the bootloader if you choose to do so.
Will Google Play Store apps work on Linux?
No, Linux distributions do not run Android apps natively. You can use an Android compatibility layer like Anbox or Waydroid, but performance and compatibility vary. Most Linux phones use native Linux apps instead.
Is it safe to install Linux on my daily driver phone?
It's risky. The process can brick your device if done incorrectly, and some features (like banking apps, secure video playback, or certain camera functions) may not work. It's best to use a spare phone or a device you're willing to lose.