1

Question (TL;DR)

How can one (manually) sideload a LineageOS zip file that is pushed on the phone using TWRP?

Context

while installing this lineage-17.1-20210430-nightly-FP2-signed.zip, with the following command:

adb sideload lineage-17.1-20210430-nightly-FP2-signed.zip

I observed that the lineageOS hangs in the loading screen for several hours. So first I verified that the zip file is correctly downloaded, using the sha256, which it is. Next, I noticed that the cause might be that the zip is streamed directly from the host to phone. So I learned an alternative option might be to use:

adb push lineage-17.1-20210430-nightly-FP2-signed.zip /sdcard/

Followed by a command to sideload the zip from the phone.

adb sideload method

For completeness, the direct adb sideload lineage-17.1-20210430-nightly-FP2-signed.zip was performed using the following steps:First, I wiped the system using Wipe>Advanced Wipe> select: Dalvik, System, Cache, Data, and swiping right, then manually activated sideload mode by pressing (and swiping): Advanced>ADB Sideload>Swipe to Start Sideload which outputted:

Updating partition details... ... done RescueParty Full SELinux support is present MTP Enabled ? Starting ADB sideload feature...

An observation is made here that the loading indicator keeps on loading without any progress. This might also be a reason the sideload does not yield a successful boot up of LineageOS.

Next, I tried I first tried the CLI approach:

adb sideload /sdcard/lineage-17.1-20210430-nightly-FP2-signed.zip

Which outputs:

Installing zip file /sideload/package.zip Unmounting System Warning: no file_contexts Target: Fairphone/FP2/FP2:6.0.1/FP2-gms-18.04.01/FP2-gms-18.04.01:user/release-keys Patching system image unconditionally Script succeeded: result was [1.000000] Formatting Cache using make_ext4fs... Wiping Cache & Dalvik... Cleaned: /data/dalvik-cache... -- Dalvik Cache Directories Wipe Complete!

And I pressed Reboot System. This results in the (seemingly) endless booting of the LineageOS loading screen.

adb push method

Before I tried other builds for the FP2, I was mainly curious to learn how the sideloading would work using adb push. Hence, I tried:

adb push lineage-17.1-20210430-nightly-FP2-signed.zip /sdcard/

And started looking for ways to sideload that zip from the phone. The first thing I tried was, after starting the sideload mode manually and verifying that the TWRP was in sideload mode with command adb devices:

adb sideload /sdcard/lineage-17.1-20210430-nightly-FP2-signed.zip

Which returns:

adb: failed to stat file /sdcard/lineage-17.1-20210430-nightly-FP2-signed.zip: No such file or directory

Next, I tried exploring the TWRP options manually. One of the options could possibly be: Install>browse to /sdcard> and tap the: lineage-17.1-20210430-nightly-FP2-signed.zip. However that yields a warning:

This operation may install incompatible software and render your device unusable

And I think installing might be something else than sideloading, hence I think this might brick the device/not be what I am looking for.

Note

This is not about the xy-problem of making LineageOS boot on the Fairphone, it is about how to load LineageOS using TWRP from the phone instead of from the host.

3
  • Your comment resolved the xy-problem. From TWRP I first tried adb reboot fastboot and fastboot format userdata which yielded a set of errors starting with: Couldn't parse erase-block-size '0x'.. Then rebooted into TWRP and did a format of: Dalvik, System, Cache, Data then adb sideload ..zip, then pressed back>Wipe>swiped format and then rebooted, and then LineageOS actually booted correctly! I didnt (yet) derive if it was the format, or wiping of data (not userdata) in TWRP after sideloading LineageOS that resolved the error. The instructions don't mention wiping data afterwards. – a.t. May 4 at 18:15
  • Yes, for clarity/completeness, that is to be done before sideloading LineageOS, which I already did, which resulted in the error. Your suggestion was to do that after sideloading LineageOS, which I initially did not do, and after I did it, (along with fastboot format userdata), the issue was resolved. So I think it is valid to indicate that the recommendation to remove userdata after sideloading LineageOS is not included in the instructions you link to. Whereas, from my experience, and your comment, it seems important/essential. – a.t. May 4 at 22:21
  • 1
    order doesn't matter except you are installing zip from internal storage. because /sdcard is bind mount of /data/media/0 (and therefore erased when userdata is formatted) – alecxs May 5 at 6:46
2

To answer the headline only:

only block partition images can be flashed with adb push

  • extract zip file

  • convert sparse file into partition image

    brotli --decompress --in system.new.dat.br --out system.new.dat
    python sdat2img.py system.transfer.list system.new.dat system.img
    
  • flash partition images from adb in TWRP recovery

    adb push boot.img /dev/block/platform/msm_sdcc.1/by-name/boot
    adb push system.img /dev/block/platform/msm_sdcc.1/by-name/system
    

Don't forget to factory reset / format the whole user data

  • can be done from adb shell

    adb shell
    mke2fs -t ext4 /dev/block/platform/msm_sdcc.1/by-name/cache
    mke2fs -t ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata
    

For more alternative methods to manually install OTA flashable zip
Is it possible to flash a custom ROM without a custom recovery image

1
  • Could you perhaps explain why the factory reset is required after pushing the image(s) onto the device? Or share a source that discusses this? – a.t. May 9 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.