• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE] Rooting OOS with TWRP

Search This thread

BillGoss

Senior Member
Sep 2, 2010
4,799
4,240
Sydney
OnePlus 3T
OnePlus 8T
I keep seeing posts that say you can't root OOS after an OTA unless you have a full image installation zip. That's just not true these days (September 2021).


You can use @osm0sis' method in https://forum.xda-developers.com/t/...ices-platforms.2239421/page-149#post-84764713
And @g96818 suggests using "Install to inactive slot" but this doesn't work for everybody (it doesn't for me) which works provided you do it properly - see https://forum.xda-developers.com/t/...00-kb2001-kb2003-kb2005.4178675/post-85801253.

And here's how to do it using TWRP.
What you'll need:
• TWRP image (.img) and (optionally) installer zip from https://forum.xda-developers.com/t/recovery-11-alpha-teamwin-recovery-project-8t-kebab.4302449/
• Magisk apk - I'm using v23.0 stable from https://github.com/topjohnwu/Magisk/releases/
I'm also assuming you have an unlocked bootloader, know how to use fastboot, how to use TWRP, and how to use Magisk.


I'll go through rooting a currently unrooted version of OOS and then doing an incremental update OTA.


Root unrooted OOS
1. Install the Magisk APK. I find that this works nicer than letting the stub download the full app the first time you use it.
2. Boot into bootloader mode
3. Boot TWRP using fastboot boot x.img where x.img is the TWRP image file
4. Take a backup of the current boot and recovery partitions as you'll need them for successfully updating when the next incremental OTA becomes available
5. Install the Magisk APK, just like you would install any zip file in TWRP. Note: the APK must be named Magisk-*.apk otherwise TWRP won't list it.
6. If you want to keep TWRP then install the TWRP installer zip.
7. Reboot


Keeping Root on an incremental OTA update
Note: you do NOT need to follow this process if you're installing a full OTA. You only need to install the full OTA and then install Magisk to the inactive slot and reboot from Magisk when it prompts you

If your phone tells you you have an update:
1. If you have TWRP installed, then boot into TWRP and restore the stock recovery and reboot
2. In Magisk tap on "Uninstall Magisk" and select "restore images". Or, if you're like using terminal commands, restore the stock boot image (you backed it up with TWRP) to the current slot using dd
3. Install the OTA update but don't reboot yet.
4. Turn on airplane mode so that apps can't call SafetyNet when you reboot the phone without root
5. Reboot
6. When the phone has successfully rebooted the updated system, boot into bootloader mode
7. Boot TWRP using fastboot boot x.img where x.img is the TWRP image file
8. Take a backup of the current boot and recovery partitions as you'll need them for successfully updating when the next incremental OTA becomes available
9. Clean up old Magisk backup copies of stock boot images by using File Manager to delete /data/magisk_backup_* directories
10. Install the Magisk APK, just like you would any zip file in TWRP. Note: the APK file name must start with Magisk- otherwise TWRP won't list it. Your existing Magisk settings, modules, and [hidden] Magisk app will be preserved.
11. If you want to keep TWRP then flash the TWRP installer zip.
12. Reboot and disable airplane mode
 
Last edited:

morphius88

Senior Member
Dec 12, 2010
206
38
OnePlus 8T
Sony Xperia 1 III
I keep seeing posts that say you can't root OOS after an OTA unless you have a full image installation zip. That's just not true these days (September 2021).


You can use @osm0sis' method in https://forum.xda-developers.com/t/...ices-platforms.2239421/page-149#post-84764713
And @g96818 suggest this method (https://forum.xda-developers.com/t/...1-kb2003-kb2005.4178675/page-25#post-85386145) but this doesn't work for everybody (it doesn't for me).


And here's how to do it using TWRP.
What you'll need:
• TWRP image (.img) and (optionally) installer zip from https://forum.xda-developers.com/t/recovery-11-alpha-teamwin-recovery-project-8t-kebab.4302449/
• Magisk apk - I'm using v23.0 stable from https://github.com/topjohnwu/Magisk/releases/
I'm also assuming you have an unlocked bootloader, know how to use fastboot, how to use TWRP, and how to use Magisk.


I'll go through rooting a currently unrooted version of OOS and then doing an incremental update OTA.


Root unrooted OOS
1. Install the Magisk APK. I find that this works nicer than letting the stub download the full app the first time you use it.
2. Boot into bootloader mode
3. Boot TWRP using fastboot boot x.img where x.img is the TWRP image file
4. Take a backup of the current boot and recovery partitions as you'll need them for successfully updating when the next incremental OTA becomes available
5. Install the Magisk APK, just like you would install any zip file in TWRP. Note: the APK must be named Magisk-*.apk otherwise TWRP won't list it.
6. If you want to keep TWRP then install the TWRP installer zip.
7. Reboot


Keeping Root on an OTA update
If your phone tells you you have an update:
1. If you have TWRP installed, then boot into TWRP and restore the stock recovery and reboot
2. In Magisk tap on "Uninstall Magisk" and select "restore images". Or, if you're like using terminal commands, restore the stock boot image (you backed it up with TWRP) to the current slot using dd
3. Install the OTA update but don't reboot yet.
4. Turn on airplane mode so that apps can't call SafetyNet when you reboot the phone without root
5. Reboot
6. When the phone has successfully rebooted the updated system, boot into bootloader mode
7. Boot TWRP using fastboot boot x.img where x.img is the TWRP image file
8. Take a backup of the current boot and recovery partitions as you'll need them for successfully updating when the next incremental OTA becomes available
9. Clean up old Magisk backup copies of stock boot images by using File Manager to delete /data/magisk_backup_* directories
10. Install the Magisk APK, just like you would any zip file in TWRP. Note: the APK file name must start with Magisk- otherwise TWRP won't list it. Your existing Magisk settings, modules, and [hidden] Magisk app will be preserved.
11. If you want to keep TWRP then flash the TWRP installer zip.
12. Reboot and disable airplane mode
ctsProfile fails. Is there a way to fix it? Tried stable Magisk and Canary.
 

BillGoss

Senior Member
Sep 2, 2010
4,799
4,240
Sydney
OnePlus 3T
OnePlus 8T
Hi,

Thanks for the guide!
What can i do if i forgot to backup stock boot and recovery?
You have a number of options:

If your update was an incremental OTA:
1. Ask in the Q&A forum or in one of the update threads if someone can share those two partitions with you.
2. If you're on 11.0.10.10kb05aa then you can get boot from a number of the update/rooting threads and the recovery from this thread by @mslezak https://forum.xda-developers.com/t/...-rooted-users-install-from-fastbootd.4316147/
3. Use this tool by @mslezak to create the full partitions from an incremental update https://forum.xda-developers.com/t/...urrently-op8t-11-0-9-9-kb05aa-posted.4314677/

If you updated using a full installation zip:
- use payload dumper to extract the two partitions from payload.bin
 
Last edited:
  • Like
Reactions: galaxys

berthur

Member
Aug 31, 2010
29
4
You have a number of options:

If your update was an incremental OTA:
1. Ask in the Q&A forum or in one of the update threads if someone can share those two partitions with you.
2. If you're on 11.0.10.10kb05aa then you can get boot from a number of the update/rooting threads and the recovery from this thread by @mslezak https://forum.xda-developers.com/t/...-rooted-users-install-from-fastbootd.4316147/
3. Use this tool by @mslezak to create the full partitions from an incremental update https://forum.xda-developers.com/t/...urrently-op8t-11-0-9-9-kb05aa-posted.4314677/

If you updated using a full installation zip:
- use payload dumper to extract the two partitions from payload.bin
Than you!
 

haitower

Senior Member
Jun 27, 2017
65
9
I'm Magisk rooted and I have TWRP installed on my 8T EU model.

The OnePlus updater app registers that I am rooted and wants to download the full OTA.

Do I also have to do all the things you described after "Keeping Root on an OTA update" or is there a simpler way?

If yes, then I have a question regarding this step:
2. In Magisk tap on "Uninstall Magisk" and select "restore images".
Did Magisk automatically backup these images? Because I didn't do it myself. I only have backed up all my partitions (including boot) after I had installed TWRP and before I rooted.

EDIT:

BillGoss has thankfully already replied in another thread (in which I have basically asked the same question because I am an impatient bast***) where I suggested the overly present "easy" update scheme, which he expects to work. So this should be fine for other people in my situation:

1. Let the system download and install full OTA
2. Install TWRP A/B Retention Script
3. Install Magisk to inactive slot and reboot

EDIT2:

I just want to add that before having done the above mentioned steps 1-3, I have disabled all Magisk modules and rebooted the device. So the full procedure is the following:

1. Disable all Magisk modules and reboot
2. Let the system download and install full OTA
3. Install TWRP A/B Retention Script
4. Install Magisk to inactive slot and reboot

Youtube step by step video (he says that he "uninstalls" the Magisk modules but he just deactivates them):
 
Last edited:

BillGoss

Senior Member
Sep 2, 2010
4,799
4,240
Sydney
OnePlus 3T
OnePlus 8T
Thanks @haitower
I've updated the OP to make it clear that the process described there only applies to incremental updates.

Also, to answer your question re Magisk backups: Magisk writes a copy of the installed boot image to /data/Magisk* before patching it. A "restore image" uses that backup.
 
  • Like
Reactions: haitower

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    I'm Magisk rooted and I have TWRP installed on my 8T EU model.

    The OnePlus updater app registers that I am rooted and wants to download the full OTA.

    Do I also have to do all the things you described after "Keeping Root on an OTA update" or is there a simpler way?

    If yes, then I have a question regarding this step:
    2. In Magisk tap on "Uninstall Magisk" and select "restore images".
    Did Magisk automatically backup these images? Because I didn't do it myself. I only have backed up all my partitions (including boot) after I had installed TWRP and before I rooted.

    EDIT:

    BillGoss has thankfully already replied in another thread (in which I have basically asked the same question because I am an impatient bast***) where I suggested the overly present "easy" update scheme, which he expects to work. So this should be fine for other people in my situation:

    1. Let the system download and install full OTA
    2. Install TWRP A/B Retention Script
    3. Install Magisk to inactive slot and reboot

    EDIT2:

    I just want to add that before having done the above mentioned steps 1-3, I have disabled all Magisk modules and rebooted the device. So the full procedure is the following:

    1. Disable all Magisk modules and reboot
    2. Let the system download and install full OTA
    3. Install TWRP A/B Retention Script
    4. Install Magisk to inactive slot and reboot

    Youtube step by step video (he says that he "uninstalls" the Magisk modules but he just deactivates them):
    1
    Thanks @haitower
    I've updated the OP to make it clear that the process described there only applies to incremental updates.

    Also, to answer your question re Magisk backups: Magisk writes a copy of the installed boot image to /data/Magisk* before patching it. A "restore image" uses that backup.
  • 6
    I keep seeing posts that say you can't root OOS after an OTA unless you have a full image installation zip. That's just not true these days (September 2021).


    You can use @osm0sis' method in https://forum.xda-developers.com/t/...ices-platforms.2239421/page-149#post-84764713
    And @g96818 suggests using "Install to inactive slot" but this doesn't work for everybody (it doesn't for me) which works provided you do it properly - see https://forum.xda-developers.com/t/...00-kb2001-kb2003-kb2005.4178675/post-85801253.

    And here's how to do it using TWRP.
    What you'll need:
    • TWRP image (.img) and (optionally) installer zip from https://forum.xda-developers.com/t/recovery-11-alpha-teamwin-recovery-project-8t-kebab.4302449/
    • Magisk apk - I'm using v23.0 stable from https://github.com/topjohnwu/Magisk/releases/
    I'm also assuming you have an unlocked bootloader, know how to use fastboot, how to use TWRP, and how to use Magisk.


    I'll go through rooting a currently unrooted version of OOS and then doing an incremental update OTA.


    Root unrooted OOS
    1. Install the Magisk APK. I find that this works nicer than letting the stub download the full app the first time you use it.
    2. Boot into bootloader mode
    3. Boot TWRP using fastboot boot x.img where x.img is the TWRP image file
    4. Take a backup of the current boot and recovery partitions as you'll need them for successfully updating when the next incremental OTA becomes available
    5. Install the Magisk APK, just like you would install any zip file in TWRP. Note: the APK must be named Magisk-*.apk otherwise TWRP won't list it.
    6. If you want to keep TWRP then install the TWRP installer zip.
    7. Reboot


    Keeping Root on an incremental OTA update
    Note: you do NOT need to follow this process if you're installing a full OTA. You only need to install the full OTA and then install Magisk to the inactive slot and reboot from Magisk when it prompts you

    If your phone tells you you have an update:
    1. If you have TWRP installed, then boot into TWRP and restore the stock recovery and reboot
    2. In Magisk tap on "Uninstall Magisk" and select "restore images". Or, if you're like using terminal commands, restore the stock boot image (you backed it up with TWRP) to the current slot using dd
    3. Install the OTA update but don't reboot yet.
    4. Turn on airplane mode so that apps can't call SafetyNet when you reboot the phone without root
    5. Reboot
    6. When the phone has successfully rebooted the updated system, boot into bootloader mode
    7. Boot TWRP using fastboot boot x.img where x.img is the TWRP image file
    8. Take a backup of the current boot and recovery partitions as you'll need them for successfully updating when the next incremental OTA becomes available
    9. Clean up old Magisk backup copies of stock boot images by using File Manager to delete /data/magisk_backup_* directories
    10. Install the Magisk APK, just like you would any zip file in TWRP. Note: the APK file name must start with Magisk- otherwise TWRP won't list it. Your existing Magisk settings, modules, and [hidden] Magisk app will be preserved.
    11. If you want to keep TWRP then flash the TWRP installer zip.
    12. Reboot and disable airplane mode
    3
    I'm Magisk rooted and I have TWRP installed on my 8T EU model.

    The OnePlus updater app registers that I am rooted and wants to download the full OTA.

    Do I also have to do all the things you described after "Keeping Root on an OTA update" or is there a simpler way?

    If yes, then I have a question regarding this step:
    2. In Magisk tap on "Uninstall Magisk" and select "restore images".
    Did Magisk automatically backup these images? Because I didn't do it myself. I only have backed up all my partitions (including boot) after I had installed TWRP and before I rooted.

    EDIT:

    BillGoss has thankfully already replied in another thread (in which I have basically asked the same question because I am an impatient bast***) where I suggested the overly present "easy" update scheme, which he expects to work. So this should be fine for other people in my situation:

    1. Let the system download and install full OTA
    2. Install TWRP A/B Retention Script
    3. Install Magisk to inactive slot and reboot

    EDIT2:

    I just want to add that before having done the above mentioned steps 1-3, I have disabled all Magisk modules and rebooted the device. So the full procedure is the following:

    1. Disable all Magisk modules and reboot
    2. Let the system download and install full OTA
    3. Install TWRP A/B Retention Script
    4. Install Magisk to inactive slot and reboot

    Youtube step by step video (he says that he "uninstalls" the Magisk modules but he just deactivates them):
    1
    ctsProfile fails. Is there a way to fix it? Tried stable Magisk and Canary.
    Best place for getting support for Magisk is https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/
    1
    Hi,

    Thanks for the guide!
    What can i do if i forgot to backup stock boot and recovery?
    You have a number of options:

    If your update was an incremental OTA:
    1. Ask in the Q&A forum or in one of the update threads if someone can share those two partitions with you.
    2. If you're on 11.0.10.10kb05aa then you can get boot from a number of the update/rooting threads and the recovery from this thread by @mslezak https://forum.xda-developers.com/t/...-rooted-users-install-from-fastbootd.4316147/
    3. Use this tool by @mslezak to create the full partitions from an incremental update https://forum.xda-developers.com/t/...urrently-op8t-11-0-9-9-kb05aa-posted.4314677/

    If you updated using a full installation zip:
    - use payload dumper to extract the two partitions from payload.bin
    1
    Hello!

    Does someone have a backup of the Stock recovery from OOS 11.0.10.10.KB05BA and can share it here?

    Thanks in advance.
    Download the zip from https://forum.xda-developers.com/t/oneplus-8t-rom-ota-oxygen-os-repo-of-oxygen-os-builds.4193183/ and then use payload dumper to extract the files.