Introduction: The Challenge of Root and OTA Updates
Maintaining root access on an Android device has become significantly easier thanks to Magisk, the universal systemless interface. However, a common challenge users face is how to apply Over-The-Air (OTA) system updates without losing root or, worse, soft-bricking their device. Traditionally, rooted devices struggled with OTA updates, often requiring a full reflash or complex manual steps. Magisk, particularly on devices with A/B (seamless) partitions, offers an elegant solution to this dilemma, allowing you to update your Android system while seamlessly retaining root.
This guide will walk you through the process of safely applying an Android OTA update while ensuring your Magisk root persists. We’ll primarily focus on the recommended method for A/B partitioned devices, which leverages Magisk’s ability to patch the inactive slot. We’ll also touch upon an alternative method for devices without A/B partitions or in cases where the primary method isn’t feasible.
Understanding A/B (Seamless) Updates and Magisk
Before diving into the steps, it’s crucial to understand how modern Android devices handle updates, especially those with A/B partitions. A/B partitioning (also known as seamless updates) means your device has two complete sets of system partitions (e.g., `slot_a` and `slot_b`). While you’re running Android from `slot_a`, an OTA update can be downloaded and installed to `slot_b` in the background. Once the installation is complete, you simply reboot, and the device switches to `slot_b` as the active partition, running the updated system.
Magisk leverages this mechanism. Instead of patching the currently active boot image (which would be overwritten by the OTA), Magisk patches the boot image on the *inactive* slot (the one the OTA just wrote to). When you reboot, your device boots into the newly updated system, which is already rooted by Magisk.
Prerequisites
- Your device must be rooted with Magisk.
- Your device should ideally support A/B (seamless) updates for the easiest method.
- Basic familiarity with ADB and Fastboot commands (useful for troubleshooting, though not strictly required for the main process).
- A stable internet connection for downloading the OTA update.
- (Optional but recommended) Disable or uninstall Magisk modules that might interfere with the update process.
Method 1: Magisk’s “Install to Inactive Slot (After OTA)” (Recommended for A/B devices)
This is the safest and most straightforward method for devices supporting A/B updates.
Step 1: Prepare for the Update (Optional but Recommended)
While Magisk is designed to be systemless, some modules might cause issues during an update. It’s a good practice to temporarily disable or uninstall them before proceeding.
- Open the Magisk app.
- Navigate to the “Modules” section.
- Toggle off or uninstall any modules you suspect might cause conflicts. You can re-enable them after the update.
- If you’ve previously installed Magisk by flashing a patched boot image and modified the boot partition manually, ensure you haven’t restored the stock boot image. Magisk handles the stock boot image internally.
Step 2: Download and Install the OTA Update
Proceed with the standard OTA update process as you normally would.
- Go to your device’s System Settings.
- Navigate to “System” > “System Update” (or similar path depending on your Android version/OEM).
- Download the available OTA update.
- Once the download is complete, initiate the installation. Your device will install the update to the inactive A/B slot in the background.
- IMPORTANT: When prompted to reboot, DO NOT REBOOT YET! Instead, select an option to finish later or simply ignore the reboot prompt.
Step 3: Patch the Inactive Slot with Magisk
Now that the OTA is installed to the inactive slot, you need to tell Magisk to patch it.
- Open the Magisk app again.
- On the main screen, you should see the “Install” button next to “Magisk” (if not, Magisk might need an update or you missed a step). Tap “Install”.
- From the options, select “Install to Inactive Slot (After OTA)”.
- Magisk will begin patching the boot image of the inactive (newly updated) slot. This process usually takes only a few seconds.
- Wait for Magisk to confirm “All done!” or “Done!”
- Copying image to cache
- Flashing new boot image to slot B
- Done!
Step 4: Reboot and Verify Root
With the inactive slot patched, it’s safe to reboot.
- Tap the “Reboot” button within the Magisk app or manually reboot your device.
- Your device will now boot into the newly updated and Magisk-rooted system.
- Once the device has fully booted, open the Magisk app. The “Magisk” status should show “Installed” with the latest version.
Step 5: Re-enable Modules (If Disabled)
If you disabled modules in Step 1, you can now safely re-enable them.
- Go to the “Modules” section in the Magisk app.
- Toggle on or reinstall your desired modules.
- Reboot your device if prompted by any module.
Troubleshooting Common Issues
Bootloop After Reboot
If your device gets stuck in a bootloop after rebooting, it usually means the patched boot image is corrupted or incompatible. You’ll need to flash a working boot image via Fastboot.
- Recovery for A/B devices: Reboot to fastboot (`adb reboot bootloader` or power + volume down). If you have access to the original, unpatched boot.img for your *new* Android version, you can flash it: `fastboot flash boot_a boot.img` (or `boot_b` depending on your active slot). Then, try patching again or flashing a previously working patched boot image.
- Magisk Uninstall: If you’re completely stuck, you can use the Magisk uninstaller ZIP via custom recovery (if available) or the Magisk app’s “Uninstall Magisk” feature before attempting the OTA again.
“Install to Inactive Slot” Option Not Appearing
- Device might not be A/B: This option only appears on devices with A/B partitions. If your device doesn’t have A/B, you’ll need to use Method 2.
- Magisk App Outdated: Ensure your Magisk app is updated to the latest stable version.
- OTA Not Fully Installed: Make sure the OTA update has fully finished installing to the inactive slot before opening Magisk.
OTA Fails to Install
If the OTA itself fails to install before you even get to Magisk, it typically indicates system modifications beyond Magisk (e.g., custom kernel, modified system partitions not managed by Magisk). In such cases, you might need to:
- Temporarily restore your device to a completely stock state (flash stock firmware).
- Use Magisk’s “Restore Stock Boot Image” option and then try the OTA.
Method 2: Flashing a Patched Boot Image (Alternative for Non-A/B devices or advanced users)
This method involves manually patching the new stock boot image and flashing it using Fastboot. It’s more involved and carries a slightly higher risk if not done correctly, but it’s the go-to for non-A/B devices.
Step 1: Obtain the Stock Boot Image for the New Android Version
You need the exact `boot.img` that corresponds to the OTA update you’ve just installed or are about to install.
- From Factory Images: The safest way is to download the full factory image for your device’s new Android version from the manufacturer’s website. Extract the `boot.img` from this package.
- From Full OTA Package: For some devices, you can extract `payload.bin` from the OTA zip, then use tools like `payload-dumper-go` (available on GitHub) to extract the `boot.img` from `payload.bin`.
Step 2: Patch the Stock Boot Image with Magisk
- Copy the obtained stock `boot.img` to your Android device’s internal storage (e.g., your `Downloads` folder).
- Open the Magisk app.
- Tap “Install” next to Magisk.
- Choose “Select and Patch a File”.
- Navigate to where you saved the `boot.img` file and select it.
- Magisk will patch the image and save a new file named `magisk_patched-XXXXX.img` in your `Downloads` folder.
- Copy this `magisk_patched-XXXXX.img` file from your phone to your computer.
Step 3: Flash the Patched Boot Image
- Enable USB Debugging on your device (Settings > Developer options).
- Connect your device to your computer via USB.
- Open a command prompt or terminal on your computer.
- Reboot your device into Fastboot mode:
adb reboot bootloader - Once in Fastboot, flash the patched boot image:
fastboot flash boot magisk_patched-XXXXX.img - After successful flashing, reboot your device:
fastboot reboot - Verify root with the Magisk app upon boot.
Conclusion
Magisk has revolutionized Android rooting, making it more accessible and resilient to system updates. For A/B devices, the “Install to Inactive Slot (After OTA)” method provides an almost effortless way to keep your root access intact, ensuring a smooth transition to the latest Android versions. Even for devices without seamless updates, the ability to easily patch and flash boot images means staying rooted no longer requires sacrificing system updates. By following these steps, you can enjoy the benefits of a rooted device without the fear of breaking it with every new Android release.
Android Mobile Specs & Compare Directory
Are you researching mobile hardware properties, processor SoCs, GPU chipsets, or RAM configurations? Access our complete specs catalog to compare up to 5 devices side-by-side!
Compare Devices Specs →