Trying to install OTA updates on rooted Android and failing? In this guide, we will tell you how you can install OTA updates on rooted Android devices using the Magisk Framework. Installing OTA updates is one of the cons of rooting Android but it is not the case anymore. With this method, you would be able to preserve root and TWRP recovery even after the OTA update is installed on your device.
Why does OTA Update Fail on Rooted Android?
Rooting Android devices gives the user full control. ‘Root’ is sort of like an “administrator” account on Windows operating systems. With root privileges, there is no limit to how you can customize and modify your Android device. But do keep in mind that rooting does come with a few drawbacks and installing OTA updates is one among them. When someone new to the Android rooting scene roots their device, they are not aware of the fact that there are some downsides to rooting Android.
Starting with Android 5.0 Lollipop, Google introduced a few additional checks on the Android system before OTA updates can be installed on an Android device. This new security mechanism, which is part of the block-based OTA method, checks the device partitions such as system, boot, vendor, etc before installing the OTA update to make sure that they are not tampered with. When you root an Android device, you actually modify a few things in some or all of the above-said partitions. And that is why installing OTA update on rooted Android devices fails.
Steps to Install OTA Updates on Rooted Android Devices
Magisk is the most popular and go-to Android rooting solution which comes in the form of an Android flashable zip file. We can simply flash the Magisk flashable zip file via TWRP recovery to root an Android device. It is completely open-source and is also actively developed by the XDA Senior developer topjohnwu. Magisk came into existence in the year 2016 as an alternative way to root Android devices.
One of the best things about rooting your device with Magisk is that you will be able to install OTA updates on rooted Android devices without losing root. Most of the modern Android devices (post-2018) come with the A/B partition scheme which enables seamless OTA updates. Simply put, in the A/B Partition, there are two ‘/system’ partitions. And when you root Android using Magisk, it is only installed to the currently active slot of your Android device. And hence, the other inactive partition stays untouched.
That’s enough of explanation and let us jump right into the guide now:
Step 1: Disable Automatic OTA Updates
Follow the steps below to disable Automatic System Updates in Android:
- Go to the Settings.
- Look for and select the About phone menu.
- Scroll down to the bottom and find the Build number section. Note: Please note that this setting can be buried even further in some Android devices. For example, in Samsung Galaxy devices, you should check here: Settings > About phone > Software information.
- Next, continuously tap on the ‘Build number’ section until you see some sort of toast message like ‘You are now a developer’. ‘Developer options’ is now enabled.
- After that, go to Settings > System > Developer options.
- Scroll down and turn off the Automatic system updates toggle.
Step 2: Restore Stock Boot Image
Next up, you need to restore stock boot images on your Android device. It is fairly simple – follow the below steps:
- Open the ‘Magisk Manager’ app.
- Tap on the UNINSTALL button.
- Select the RESTORE IMAGES option.
- Wait until you see the “Restoration done!” message on the screen.
DO NOT REBOOT YOUR DEVICE AFTER THIS STEP; DOING SO WILL REMOVE MAGISK FROM YOUR PHONE. Go to the next step.
Step 3: Install the OTA Update
Now you have stock boot image restored, you are good to install the OTA update on your rooted Android device.
- Go to the device Settings > System > System update
- Tap on the ‘Download and Install’ button.
Wait for the installation process to complete.
DO NOT REBOOT YOUR DEVICE AFTER THIS STEP; DOING SO WILL REMOVE MAGISK FROM YOUR PHONE. Go to the next step.
Step 4: Retain TWRP Recovery after OTA Installation [Optional]
This step is completely optional and only needs to be followed if you have rooted your Android device by flashing Magisk zip via TWRP recovery. In such a case, TWRP will be removed after you install the OTA update using the instructions below. In order to preserve TWRP after updating, download and install the ‘TWRP A/B Retention Script‘. Didn’t install via TWRP? No problem; move along to the next step!
For this, you will need to download and install “TWRP A/B Retention Script” (by XDA Recognized Developer osm0sis) from within Magisk Manager. To do so, follow the steps below:
- Open the ‘Magisk Manager‘ app.
- Tap on the menu on the top-left corner.
- Select ‘Downloads’.
- Next, search for ‘TWRP A/B Retention Script‘.
- Tap on the download icon and select the Install option.
The Magisk Module (which is a small script, in this case) will now be installed on your phone. On to the next step!
Step 5: Preserve Magisk Root after OTA Installation
The last step to install Magisk to the other inactive slot. This is to make sure that you still have root even after you reboot your device after installing the OTA update.
- Open Magisk Manager.
- Tap on the INSTALL button and then again select the ‘INSTALL‘ option.
- Select ‘Install to Inactive Slot (After OTA)‘ when prompted to choose the installation method.
- Next, tap on ‘YES‘ to confirm.
Magisk will now be installed on the inactive slot. Once the installation completes, tap on the ‘Reboot‘ button. Magisk Manager will reboot your Android device to the inactive slot where the OTA update was installed.
Phew, that was a lengthy process and it is finally over. Now you should have root with Magisk on your Android device even after installing the OTA update.
Questions? That’s why we have the comments section. Hit me up!
1.Is this process eligible for Samsung Galaxy M30 ?
2. Does it wipe my data & Settings ?
Hi, thanks for the tutorial.
In step 3 when I install the update I get the following message:
“root is detected. system will begin downloading the full upgrade package.to ensure your data integrity, please perform a backup. your device will be unrooted once the upgrade is complete”
What should I do?
I am using a OnePlus 8T by the way.
Is this going to remove all the settings and changes to apps that were installed/uninstalled since customizing the device? There is no explicit warning in this article.
Does your android require A/B partition to perform this
Do we have to perform this procedure each time an OTA is to be installed? or does it needed to be done once and then subsequent OTAs will be installed like normally?
Yes. It’s not an one time thing.
Thanks for your guide. When I got to step 3 to check for updates, it still says my system is up to date. I’m on Android 11 on pixel 5a and Android 12 is released. Any ideas why I can’t get the update even after restoring stock boot image? Thanks
How is it possible to avoid the automatic reboot? Installing the OTA update always leads to a reboot.
If like me you do a kneejerk reboot after the OTA, it can be fixed:
get ota zipfile from https://developers.google.com/android/ota and unzip in temporary directory
go to https://zetamods.com/how-to-extract-payload-bin-android-update-file/, and follow the instructions, using payload.bin from where the ota zipfile was unzipped.
push boot.img to phone
in magisk, install via patching using that boot.img
pull the generated magisk_patched-xxxxxxxxx.img
adb reboot bootloader
fastboot flash boot magisk_patched-xxxxxxxxx.img
fastboot reboot
So your device needs to be rooted using Magisk? What if my device is rooted using SuperUser. Can I just install Magisk using TWRP and follow the instructions above or would I need to get my device back to stock and then install Magisk?