An OTA update has arrived, but you cannot install it because your Android device is rooted? Well, that’s a known downside of rooting Android. In this guide, you will learn how to install OTA updates on rooted Android devices using Magisk. By using the method provided in this guide, you will also be able to retain root and TWRP after installing the OTA update.
Before we get any further, let us take a quick look at what OTA updates are and how they work.
- 1 What is an OTA Update?
- 2 Why You Can’t Install OTA Updates on Rooted Android Devices Automatically?
- 3 Magisk Root, A/B Partitions, and OTA Updates
- 4 How to Install OTA Updates on Rooted Android Devices?
What is an OTA Update?
An OTA Update a.k.a an Over-the-Air Update is a wireless method of receiving and installing updates to an Android device’s software.
It is remotely pushed by the device manufacturer (Also known as the ‘OEM’) and is the easiest and most effective way to update an Android device’s software to the latest available version. Once an OTA update arrives, it is either automatically installed or prompts the user to manually download and install it.
So, how does one install an OTA update on a rooted Android device? You will know more about it in the next section. Read ahead.
Why You Can’t Install OTA Updates on Rooted Android Devices Automatically?
Rooting an Android device is great, it gives the user tremendous control over the device’s software and allows making any sort of modifications to it. However, it comes with its own drawbacks. The biggest one is losing the ability to take automatic OTA (over-the-air) updates. And users (Generally who are new to the scene) often tend to overlook this factor when they root their Android device.
In Android 5.0 and above, Google introduced the concept of block-based OTAs. This new mechanism does certain pre-OTA block checks to verify the integrity of the device’s software. In layman terms, once the installation begins, the device partitions (like system, boot, vendor, dtbo, etc) are checked for modifications like Root, TWRP, etc. And if detected, the OTA update will fail to install.
Magisk Root, A/B Partitions, and OTA Updates
But thanks to Magisk, you can easily install OTA updates on rooted Android devices without losing root. For those who don’t know, Magisk is a Universal Systemless Interface that allows you to make modifications to your Android device’s software systemless-ly, that is, without altering the /system partition.
Not just that, it has also developed to be the most prominent modern-day rooting solution for Android using MagiskSU. Want to know more about how it came into existence? Then there’s no better way but to hear out the story directly from its creator – topjohnwu.
The developer devised two different methods to install Magisk and root Android devices:
- The first method follows the traditional process of installing a custom recovery (TWRP, OrangeFox, etc) and then using it to flash the Magisk installer zip (root package). But since you will install a custom recovery during this method, it makes it even harder to take OTA updates.So, to regain the ability to take automatic OTA updates or install them manually, you would require to first uninstall/remove root and other modifications applied to the software. And further, restore the stock Android recovery on your device.
- The second method was introduced when Google first released the Google Pixel devices in 2016. These devices came with dual A/B partition system to support seamless updates and removed the recovery partition from the devices completely. So, the first method failed rigorously.This new method involves patching the stock boot image using Magisk and then flashing the patched boot image via fastboot.
The best part about rooting your Android device with Magisk is that it gives you the ability to install OTA updates easily. So, follow the instructions below on how to do it.
How to Install OTA Updates on Rooted Android Devices?
Now, since most new OEM Android devices come with the A/B partition scheme, OTA updates are seamlessly installed to the inactive slot. When you root using Magisk, it is only installed to the currently active slot of your Android device. And thus, the inactive slot/partitions stay untouched.
When an OTA arrives, you can simply restore the stock boot image from within Magisk Manager, then install the OTA update to the inactive slot. And finally, right before you reboot your phone, you can install Magisk to the inactive slot to preserve root after the update.
Still sounds a bit confusing? Don’t worry, the instructions below will take you through the complete process in detail. For your convenience, we have split the instructions into 5 different steps so that you can understand exactly what you’re doing.
Step 1: Disable Automatic System Updates in Settings
In Android 8.0 Oreo (and above), Google introduced a new automatic updates policy that downloads and installs OTA updates as soon as they are available.
Although this is great for an average Android user, but not for those who have rooted their devices. In order to update your rooted Android phone, you must first prevent the system from automatically installing updates without your acknowledgment.
Simply follow the steps below to disable Automatic System Updates in Android:
- Go to the Settings menu on your Android device.
- Navigate through the settings and select the About phone menu.
- Scroll down to the bottom and find the Build number section.
- Note: In the case of some OEM devices, the Build Number section could be nested further in the Settings menu. For example, in Samsung Galaxy devices, you will need to go to Settings → About phone → Software information.
- Now, continuously tap on the ‘Build number’ section for five (5) times to enable ‘Developer options‘ on your device.
- Once enabled, go to Settings → System → Developer options.
- Scroll down and turn off the Automatic system updates toggle.
If you have rooted your Android device using Method 1 and have TWRP installed, then it 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 Retention module
Step 2: Restore Stock Boot Image When an OTA is Available
Now your Android device is rooted and an OTA update notification has arrived. When an OTA update is available, you will need to restore the stock boot image (and dtbo, if applicable) and uninstall Magisk from the current slot.
To do so, go to the app drawer and launch the ‘Magisk Manager‘ app. Then tap on the UNINSTALL button and select the RESTORE IMAGES option. You should now see the “Restoration done!” message on the screen.
Do not! Absolutely do not reboot your phone now, or else Magisk will be uninstalled completely.
Step 3: Install the OTA Update
Now, with the stock boot image restored, you can freely install the OTA update on your rooted Android device. Simply go to the device Settings → System → System update, and press the ‘Download and Install‘ button.
Once the installation finishes, you shall be prompted to reboot your phone. DO NOT REBOOT YOUR DEVICE YET! Simply move ahead to the next step.
Step 4 [Optional]: Retain TWRP Recovery after OTA Installation
This is an optional step and only to followed if you installed Magisk using TWRP recovery (Method 1). It will allow you to retain TWRP recovery after installing the OTA update.
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:
- Go to the app drawer and launch the Magisk Manager app.
- Tap on the menu icon (3-horizontal lines) on the top-left of the app’s window.
- Select ‘Downloads‘.
- Now search the modules repository for “TWRP A/B Retention Script“.
- Next, tap on the download icon and select the Install option.
The script should now be installed on your phone. There’s nothing more you’d need to do for this now. The script will do its job and preserve TWRP after the OTA installation finishes.
Step 5: Preserve Magisk Root after OTA Installation
The final step to install Magisk to the inactive slot. This will preserve root after the OTA installation is finished and the device is rebooted into the updated OS.
- Open Magisk Manager.
- Tap on the ‘INSTALL‘ button and select the ‘INSTALL‘ option.
- Select ‘Install to Inactive Slot (After OTA)‘ when prompted to choose the installation method.
- Finally, tap on ‘YES‘ to confirm when the warning message appears on the screen.
- Magisk will now be installed to the inactive slot.
- Once the process finishes, tap on the ‘Reboot‘ button.
Magisk Manager will now force-switch your Android device to the inactive slot where the OTA update was installed. This will help prevent any post-OTA verifications that the system might have carried.
That’s it! You have just successfully installed an OTA update on your Android device rooted with Magisk. So when the next time an OTA update arrives, you can follow the same instructions to upgrade your device, and that too without losing root.
If you have any questions regarding the instructions/procedure listed here, feel free to let us know. We shall try to help you to the best of our knowledge.
(Source: Official Magisk documentation)