[ASUS ZenFone 8] bnsmb:
In the entry How toinstall an OS image using the TWRP binary twrp I describe how to install an OS image in a script using the twrp binary from TWRP with the parameter install.

But the automatic Installation of OS images using the binary twrp from TWRP with the parameter install does not work for all ROM images, e.g. it's not possible to install the Original Android OS from ASUS, LineageOS, or StatiXOS on the ASUS Zenfone 8 using this method.

The sideload function of the twrp binary should therefore be used to install one of these OS images..

Example:

To install the Android OS from ASUS boot the phone from the TWRP image and then issue on the PC:

# optional: retrieve the current active slot
# (1 = _b, 0 = -a)
#
adb shell bootctl get-current-slot

# optional: do a factory reset (this is not necessary for OS updates)
#
adb shell twrp format data

# start the sideload mode of TWRP

adb shell twrp sideload

# sideload the OS image that should be installed
#
adb sideload /data/backup/ASUS_ZENFONE8/ASUS_firmware/Android_13/UL-ASUS_I006D-ASUS-33.0210.0210.296-1.1.26-2305-user.zip

# wait a few seconds until the sideload mode finished on the phone

# change the active boot slot to activate the new installed OS
# (1 = b, 0 = a; _b and _a also works)
#
adb shell bootctl set-active-boot-slot 1

Spoiler content hidden.

Notes:

Before starting the sideload installation you may need to perform a wipe or factory reset - depending on which OS is already installed on the phone. This can also be done via the twrp binary using a script.

I added this functionality now to my script to install the Android OS via TWRP: install_os_via_twrp.sh.sh

There are three new parameter for the script:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/scripts_on_linux ] $ ./install_os_via_twrp.sh -h
install_os_via_twrp.sh version - v2.0.0.0 - install an OS image via the TWRP command twrp

install_os_via_twrp.sh [-h|help|-H] [--reboot|--noreboot] [force] [wipe|wipeall] [wipe_cache] [wipe_data] [wipe_dalvik] [wipe_all] [format_data] [format_metadata] [factory_reset] [sideload] [nosideload|install] [auto] [os_image_file]

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/scripts_on_linux ] $

The script parameter sideload forces the script to install the operating system image with "twrp sideload"; if the script parameter auto is used, the script decides which method to use for the installation depending on the name of the image that should be installed.

The script parameter nosideload or install forces the script to install the image using "twrp install" - this is also the default method if neither the parameter sideload nor the parameter auto is used.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Test Environment

I succesfully tested the installation of the Android OS via twrp sideload on the ASUS Zenfone 8 with these ROMs:

Original Android 13 for the ASUS Zenfone 8

LineageOS 19

LineageOS 20

LineageOS 21 (in-official image from https://github.com/mikooomich/android_device_asus_sake/releases)

StatiXOS 14 (7.x) (https://xdaforums.com/t/rom-upsidedowncake-sake-14-statixos-v7-5.4500497/)

OmniROM 13 (this OS can also be installed using twrp install)

OmniROM 14 (this OS can also be installed using twrp install)

Trouble Shooting

The binary bootctl is not included in the newest TWRP versions anymore -- see How to compile the image for TWRP 3.7.0.12-1 w/ the bootctl binary for how to fix that.

Please note that the official TWRP image for the ASUS Zenfone 8 can be not be used to boot the phone if the LineageOS 20 or newer or the current version of the StatiXOS is installed on the phone. See the entry How to use TWRP if LineageOS_20.x is installed for how to create a TWRP image for the LineageOS 20 or newer (the instructions are also valid to create a working TWRP image for the current version of the StatiXOS).

Downgrading the installed operating system (e.g. from LineageOS 21 to ASUS Android 13) with this method may or may not work. If it does not work, install the raw image for the target OS version before installing the new OS image.

For unkown reason the command "adb sideload" must sometimes be executed by the user root in my environment - I don't know why yet. In case the command fails in your environment also with the error message "insufficient permissions for device" just kill the adb daemon and execute adb sideload as user root.

Download

The script can be downloaded from my homepage:

install_os_via_twrp.sh

The script needs the helper script boot_phone_from_twrp.sh

(see also boot_phone_from_twrp.sh)