Updated 220513: rewritten and includes OOS 12
It is up to you to download the update (from whichever source you use).
How I get a copy of the update zip
Note: I'm running the NA version of OOS. If the URL below for the OTA is different for other OOS versions, please let me know via a PM.
Once the phone tells me that there's an update available I do the following in Termux (https://f-droid.org/en/packages/com.termux/):
If you use Terminal then you can install updates without the need of a PC (my preferred option).
Using line commands, at one level, can simplify some processes by avoiding the need to switch out to recovery and back again. On the other hand, they complicate things by requiring knowledge of how to use them.
The commands you need to be familiar with are:
When you use Magisk>Uninstall Magisk>Restore images the backup corresponding to the current patched boot image is used to restore the stock image to the current (active) slot.
Clearly, if you deleted these magisk_backup directories then Magisk will not be able to restore the stock boot image. You must, therefore, always keep the current backup.
If you don't delete these backups you can end up with a lot of obsolete backups. So, how to work out which one is the one you need to keep?
The simplest way is to:
A. First time rooting
This process is common across all optionsA.1 Flashing Magisk patched boot image
Notes:- This can ONLY be used on full update zips, NOT on incremental updates.
- Note: if you use mslezak;s Payload Dumper (see https://forum.xda-developers.com/t/...urrently-op8t-11-0-9-9-kb05aa-posted.4314677/ then you may be able to use it on incremental updates. I personally have not done this.
- You can use the latest stable version of Magisk (my recommendation as of May 2022)
- Do NOT use the "To flash" option in step 11 because this causes issues when you get the next OTA update. Use the the "To Temporarily boot into a rooted system (RECOMMENDED!!)" option.
- Backup both the stock boot (the one extracted from using Payload Dumper) and Magisk patched boot images if you are going to use CLI
A.2 Using TWRP (OOS 11 only)
- Boot bootloader
-
fastboot boot <twrp.img>
- Backup current boot
- Install Magisk-*.apk
- Reboot system
- Uninstall Magisk stub
- Install Magisk-*.apk
- Install the Universal SafetyNet Fix Magisk module to pass SafetyNet with an unlocked bootloader. Use my modified version (attached) that fixes the fingerprint reader not working on rooted OOS 12 until kdrag0n updates his version.
B. Keeping root during an update
B.1 System Update downloads and installs the update
This is using the built-in System Update tool, which you'll find in:- OOS 11: Settings>System settings> System Update
- OOS 12: Settings>About device>Software update
- Restore the current stock boot image using Magisk>Uninstall Magisk>"Restore images" and DO NOT reboot
- Download and Install the update (and DO NOT reboot) using:
OOS 11: Settings>System Settings>System Update>Download and Install
OOS 12: Settings>About device>Software update - Copy the updated boot image as follows:
- On PC: Find the inactive slot suffix:
-
adb shell getprop ro.boot.slot_suffix
Note: on OOS 12 when you connect the phone to the PC you must enable "Transfer files" on the phone for ADB to see the device. - If the result is _a then the inactive slot suffix is _b otherwise it is _a
-
- Take a copy of the boot image:
adb shell su -c dd if=/dev/block/by-name/boot<inactive slot suffix> of=/sdcard/oos-ota-boot.img
replacing <inactive slot suffix> with the value you previously determined (_a or _b). Note: Magisk may prompt you (on your phone) to grant root access to Shell - grant it.
- On PC: Find the inactive slot suffix:
- On phone: Patch the dumped oos-ota-boot.img using Magisk>Magisk Install>"Select and Patch a File"
- Copy /sdcard/Download/magisk_patched*.img to your PC
- Restore root to the current slot using Magisk>Magisk Install>"Direct Install (Recommended)". This is so you keep root in case the update somehow fails and you're returned to the current system.
- Turn on Airplane Mode to prevent Google Play Services detecting that the phone is bootloader unlocked and making your phone uncertified in Google Play.
- Reboot the phone from the System Update dialog; verify that you are now running the updated version
- On PC: Reboot to bootloader using
adb reboot bootloader
- Boot (NOT flash) the patched boot image:
fastboot boot <magisk-patched image>
where <magisk-patched image> is the patched image you transferred to the PC - On phone: Verify that Magisk shows you are rooted
- Make rooting permanent using Magisk>Magisk Install>"Direct Install (Recommended)" and reboot again
- Turn off Airplane Mode
B.2 Manual Install
This involves manually downloading the update zip and then installing it using one of the following options.It is up to you to download the update (from whichever source you use).
How I get a copy of the update zip
Note: I'm running the NA version of OOS. If the URL below for the OTA is different for other OOS versions, please let me know via a PM.
Once the phone tells me that there's an update available I do the following in Termux (https://f-droid.org/en/packages/com.termux/):
-
su -c "logcat -d" | grep -Eo "https://android.googleapis.com/packages/ota-api/package/[a-z0-9]*.zip"
This looks for the the Google OTA server file name in logcat and returns the source address. For example, the KB2005 C.11 full update was https://android.googleapis.com/packages/ota-api/package/435fc808f603bbc8a63ce30fd944676a65a61d6f.zip
Note: You could also useadb shell
to run thelogcat -d | grep ...
commands, though I've never done that because I prefer to do everything on my phone, where possible. -
wget -O /sdcard/oos-ota-update.zip <source address>
This pulls a copy of the file to /sdcard.
Note: You could also just paste the URL into a browser to download the file.
B.2.1 Local Install
This is using:- OOS 11: System Update>Gear icon (local install)
- OOS 12: MyApplication2 app (source: https://oxygenos.oneplus.net/English_20220225101104.apk; see https://forums.oneplus.com/threads/oxygenos-12-for-the-oneplus-8t.1555060/)
- Move the update zip to /sdcard (NOT a subdirectory of /sdcard)
- Magisk>Uninstall Magisk>Restore images - this restores the stock boot image whilst keeping Magisk
- Install the update using the appropriate local installer for your version of OOS and DO NOT reboot
- Restore root to the current slot using Magisk>Magisk Install>"Direct Install (Recommended)". This is so you keep root in case the update somehow fails and you're returned to the current system.
- Root the updated boot image using Magisk>Magisk Install>"Install to inactive slot" and reboot
B.2.2 Using TWRP (OOS 11 updates only; NOT the OOS 11 to 12 update)
There may be a way of using TWRP but I've never tried it. Given that we are now on OOS 12 and TWRP doesn't work on OOS 12, it's rather pointless to talk about using TWRP for incremental updates. Should we get a working TWRP 12 version, then I'll revisit this section.B.2.3 Using CLI
CLI (command line interface) tools, such as Terminal (I use Termux from https://f-droid.org/en/packages/com.termux/) or ADB shell, allows you to manually download delta updates avoiding the need to wait for full updates or for someone to post a copy of the delta update zip.If you use Terminal then you can install updates without the need of a PC (my preferred option).
Using line commands, at one level, can simplify some processes by avoiding the need to switch out to recovery and back again. On the other hand, they complicate things by requiring knowledge of how to use them.
The commands you need to be familiar with are:
-
dd
to read-from/write-to the partitions in /dev/block/by-name -
grep
to scan the output of a logcat -
getprop
to find out which are the active/inactive slots -
logcat
to read the Android logs -
su
to run commands as root
- Get a copy of the update zip
Note: I'm running the NA version of OOS. If the URL below for the OTA is different for other OOS versions, please let me know via a PM.
Once the phone tells me that there's an update available I do the following in Termux:-
su -c "logcat -d" | grep -Eo "https://android.googleapis.com/packages/ota-api/package/[a-z0-9]*.zip"
This looks for the the Google OTA server file name in logcat and returns the source address. For example, the KB2005 C.11 incremental update was https://android.googleapis.com/packages/ota-api/package/435fc808f603bbc8a63ce30fd944676a65a61d6f.zip -
wget -O /sdcard/oos-ota-update.zip <source address>
This pulls a copy of the file to /sdcard
Note: You could also just paste the URL into a browser to download the file
-
- Find the active slot suffix:
getprop ro.boot.slot_suffix
If the result is _a then the inactive slot suffix is _b otherwise it is _a - Restore stock boot/recovery (recovery: only on OOS 11 if TWRP is installed) using
dd if=<copy of stock boot/recovery> of=/dev/block/by-name/<boot/recovery><active slot suffix>
- Install the update using:
- OOS 11: System Update>Gear icon (local install)
- OOS 12: MyApplication2 app (source: https://oxygenos.oneplus.net/English_20220225101104.apk; see https://forums.oneplus.com/threads/oxygenos-12-for-the-oneplus-8t.1555060/)
- Backup the new stock boot/recovery (recovery: only on OOS 11 if TWRP is installed) using
dd if=/dev/block/by-name/<boot/recovery><inactive slot suffix> of=<new boot/recovery img>
- Restore root to the current slot
dd if=<copy of current Magisk patched stock boot/recovery> of=/dev/block/by-name/<boot/recovery><active slot suffix>
. This is so you keep root in case the update somehow fails and you're returned to the current system.
Note: You could also use Magisk>Magisk Install>"Direct Install (Recommended)" - (ONLY if keeping TWRP on OOS 11) Magisk>Modules>Install from storage: Select twrp-installer.zip
- Magisk>Magisk Install>"Install to inactive slot" and DO NOT reboot
- Backup the new Magisk patched stock boot using
dd if=/dev/block/by-name/<boot><inactive slot suffix> of=<new Magisk patched boot img>
- Reboot from Magisk (I'm not sure that you can use the normal system reboot process)
C. A note on Magisk backup folders in /data
When Magisk patches the boot image using either Magisk>Magisk Install>"Direct Install (Recommended)" or Magisk>Magisk Install>"Install to inactive slot" it creates a backup of the original stock boot image in a directory named /data/magisk_backup_<SHA1 of stock image>.When you use Magisk>Uninstall Magisk>Restore images the backup corresponding to the current patched boot image is used to restore the stock image to the current (active) slot.
Clearly, if you deleted these magisk_backup directories then Magisk will not be able to restore the stock boot image. You must, therefore, always keep the current backup.
If you don't delete these backups you can end up with a lot of obsolete backups. So, how to work out which one is the one you need to keep?
The simplest way is to:
- Restore the current stock boot image using Magisk>Uninstall Magisk>Restore images
- Delete all the /data/magisk_backup_* directories
- Restore the rooted boot image using Magisk>Magisk Install>"Direct Install (Recommended)" - this also creates a new magisk_backup directory (no need to reboot)
Attachments
Last edited: