Jump to content

Installation from recovery mode

From postmarketOS Wiki

Most Android devices have a "recovery" partition, on which a second kernel and initramfs can be installed. The recovery systems installed there allow overwriting the main OS with a special zip file, and it is possible to generate such a file for postmarketOS.

Preparation

Create the recovery zip image

Follow the pmbootstrap article to build your own image, but add --android-recovery-zip to the install action. If your device supports full disk encryption (see the FDE column in Devices), you can add the --fde argument.

$ pmbootstrap init
$ pmbootstrap install --android-recovery-zip

By default, this will install to the system partition of your Android device. If you want to install to a different partition (e.g. because your system partition is too small), use the --recovery-install-partition parameter. For example, to install to the data partition:

$ pmbootstrap install --android-recovery-zip --recovery-install-partition=data

Modifying for A/B devices

As of 2025-10-01, this doesn't work correctly on devices using an A/B partitioning scheme. This manifests in the install failing and returning this error in the log:

findfs: unable to resolve 'PARTLABEL=boot'

(TODO: Create or find an issue to fix this properly and link here.) In the meantime, you can manually edit the generated zip to work correctly.

First, find out if you're using slot A or B:

fastboot getvar current-slot

(You may also be able to get it from your recovery)

Next, extract the zip into a directory:

mkdir extracted
unzip -d extracted pmos-motorola-channel.zip

Now inside that, you need to edit 2 files, and change "boot" to "boot_a" or "boot_b" and "system" to "system_a" or "system_b" (whichever you got above).

In chroot/bin/pmos_install_functions

                dev=$(findfs PARTLABEL="boot") || \
                        dev=$(readlink -fn "$(get_fstab_device "$fstab_recovery" boot)")

And in chroot/install_options

KERNEL_PARTLABEL='boot'
INSTALL_PARTITION='system'

Then rezip (run this inside the extracted directory)

zip -r ../pmos-patched.zip ./

and proceed to flash.

Sideload

This allows downloading the zip file on the fly directly from your computer. If you don't want to sideload, you can also copy the generated zip file to an SD card.

  • Boot the recovery system
  • Unmount the partitions (Click on "Mount", then deselect all checkboxes)
  • Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
  • Connect your phone to your PC
  • Start the sideloading process from your PC:
$ pmbootstrap flasher --method=adb sideload

Sideload without pmbootstrap

If sideloading with pmbootstrap fails (it was broken in #1638), you can do it without pmbootstrap as a workaround. Install adb on your host Linux distribution (usually in an android-tools package that you can install with your distribution's package manager), then run the following commands. The special cd is necessary, because adb can't resolve the symlink on its own.

$ pmbootstrap export
[07:48:04] NOTE: To export the rootfs image, run 'pmbootstrap install' first (without the 'sdcard' parameter).
[07:48:07] Export symlinks to: /tmp/postmarketOS-export
[07:48:07]  * initramfs-lg-mako (Initramfs)
[07:48:07]  * boot.img-lg-mako (Fastboot compatible boot.img file, contains initramfs and kernel)
[07:48:07]  * vmlinuz-lg-mako (Linux kernel)
[07:48:07]  * pmos-lg-mako.zip (Android recovery flashable zip)
[07:48:07] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[07:48:07] Done
$ cd $(dirname $(readlink /tmp/postmarketOS-export/pmos-*.zip))
$ adb sideload pmos-lg-mako.zip
loading: 'pmos-lg-mako.zip'...
connecting...
Total xfer: 1.08x

Photos

See also