Installing Mobian (Android devices)

This guide covers installing Mobian on all supported Android phones. See the devices page for the full list of supported devices.

Obtain the Image

Pre-built Images

We recommend downloading pre-built images for installation. They are released weekly, normally on Sundays. The image files for your device will be packed in a file named mobian-<processor>-phosh-YYYYMMDD.tar.gz and can be found here:

  • SDM845 (OnePlus 6/6T, Pocophone F1, SHIFT 6mq, Xiaomi Mi Mix 2S): since 2023-01-15 only Audio is broken (older versions: known as broken (no Wifi, sometimes no Bluetooth): 20221120, 20221127; known as ok: 20221002)
  • SM7225 (Fairphone 4)

Building from Debos Recipes

You can build the image yourself using the debos recipes. If you build the image yourself, the produced image file will be not be zipped (i.e. named mobian-<processor>-phosh-YYYYMMDD.*.img) and there is no need to unzip the archive.

Preparing the Device

As you would do before installing a custom Android ROM, the bootloader needs to be unlocked. The exact procedure varies depending on the device you own, so we suggest you search the Internet for an unlock guide aimed at your specific device.

We also recommend that you upgrade Android to the latest available version and install all system updates before installing Mobian.

See postmarketOS' installation guide for unlocking bootloader of OnePlus 6 or OnePlus 6T

Flashing the Image to the Target Device

WARNING: Flashing Mobian to your device will wipe your Android installation! Please install a recovery software such as TWRP and make sure you understand how to recover your system before proceeding.

Those devices being Android smartphones in the first place, they have secure boot enabled, meaning we can't replace their bootloader and need to rely on Android tools in order to flash Mobian.

In practice, this means we can't flash a single image file, and the downloaded tarball will contain:

  • an Android bootimg containing the kernel, device-tree and initramfs named mobian-<processor>-phosh-YYYYMMDD.boot-<model>.img
  • an image for the system partition (new since 2023) named mobian-<processor>-phosh-YYYYMMDD.boot.img
  • an Ext4-formatted rootfs (using Android's sparse image format) named mobian-<processor>-phosh-YYYYMMDD.rootfs.img

As these devices have several variants, which differ only by the device-tree they need, and the DT being part of the bootimg, we provide one bootimg for each variant. You have to flash the one matching your device:

  • SDM845:
    • OnePlus 6: enchilada
    • OnePlus 6T: fajita
    • Pocophone F1: use the beryllium-tianma variant first; if the touchscreen doesn't react to swipes, then switch to the beryllium-ebbg variant. If you know your display variant, you can pick this directly.
    • SHIFT 6mq: axolotl
    • Xiaomi Mi Mix 2S: polaris
  • SM7225:
    • Fairphone 4: fp4

Once you have extracted those files from the tarball, boot your device into Fastboot mode, connect it to your computer using a USB cable and run the following commands to install Mobian:

fastboot flash boot mobian-<processor>-phosh-YYYYMMDD.boot-<model>.img
fastboot flash system mobian-<processor>-phosh-YYYYMMDD.boot.img
fastboot -S 100M flash userdata mobian-<processor>-phosh-YYYYMMDD.rootfs.img
fastboot erase dtbo

If all steps above succeeded, reboot your phone

Notes:

  • For the Fairphone 4, it is not possible to flash the boot partition to system, use fastboot flash rawdump … instead of fastboot flash system …
  • If the device becomes unresponsive after a fastboot command succeeded, power it off and boot into fastboot mode again, then execute the remaining commands.
  • The OnePlus 6/6T has an A/B partition scheme. In order to select which slot you want to flash Mobian to, you can run the following command before any other fastboot command:
fastboot --set-active=[a|b]
  • It looks like the Fairphone 4 also has an A/B scheme, at least in part (perhaps some partitions and not others) and so setting A or B before starting is probably a good idea, so you are sure which partition is in use.
  • On the Fairphone 4 (I cannot speak for other phones), on booting, the phone vibrates once, and then comes to a black screen (the screen is active, but black). Mobian *is* active now, but it is not displaying anything. To get to the Mobian login page, you must repeatedly press and release the power key - I think five times in all. Each time the screen will power up, then power down, remaining black, but in the end, the Mobian login screen will appear, and you can log in.
  • On Fairphone 4 (I cannot speak for other phones) be aware that Mobian really is experimental. As of 2023-08-10, it's based on Trixie (“testing”, which will become Debian 13), not Bookworm, and last night, having installed system updates on the phone, the phone now cannot boot - it cannot get past the bootloader. Either updates cannot be used, or you must keep a backup image of your phone, so you can restore if this happens.

Installing to an SD Card

The installation above is to the internal memory (UFS). There can be many reasons why you want to install to an SD card (if you have a Pocophone F1):

  • You want to swap an installation between different phones.
  • The installation to internal memory might be broken. This was the case for the Pocophone F1 in the past.
  • For old versions: The UFS implementation might be broken for your combination of kernel and device and lead to IO errors.

Before proceeding you must have installed the same version to the internal memory, as described above, but flashing the rootfs.img should be left out (can lead to confusion with the root image that will be installed to the SD card). The steps for installing to an SD card (recommended at least 16 GB):

  • On a PC, add a partition number 1 with filesystem ext4 to your SD card.
  • Convert the root image from sparse to non-sparse format: simg2img mobian-<processor>-phosh-YYYYMMDD.rootfs.img mobian-<processor>-phosh-YYYYMMDD.rootfs.raw
  • Write the .raw file to partition 1, determine which letter you should use as N in sdN1 to access the mentioned SD card: sudo dd if=mobian-<processor>-phosh-YYYYMMDD.rootfs.raw of=/dev/sdN1 bs=1M status=progress
  • Move the SD card from the PC to the phone.
  • Start the phone.