- How to Install OTA Updates on Rooted Android Devices using Magisk [Without Losing Root]
- What is an OTA Update?
- Why You Can’t Install OTA Updates on Rooted Android Devices Automatically?
- Magisk Root, A/B Partitions, and OTA Updates
- How to Install OTA Updates on Rooted Android Devices?
- Step 1: Disable Automatic System Updates in Settings
- Step 2: Restore Stock Boot Image When an OTA is Available
- Step 3: Install the OTA Update on your Rooted Android Device
- Step 4 [Optional]: Retain TWRP Recovery after OTA Installation
- Step 5: Preserve Magisk Root after OTA Installation
- How to Root your Android smartphone: Google, OnePlus, Samsung, Xiaomi, and others too!
- What is Root?
- How to root a popular Android smartphone
- Motorola
- OnePlus
- Samsung
- Xiaomi
- How to root any Android device
- Step 1: Identifying the type of the boot image
- Step 2: Locating the boot image
- Step 3: Patching the boot image
- Step 4: Verification
- One-Click Root Methods in 2021: Kingroot, KingoRoot, and others
How to Install OTA Updates on Rooted Android Devices using Magisk [Without Losing Root]
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.
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.
Note: If you’re upgrading from Android 10 to Android 11, make sure that you update to Magisk 21.0 or the latest Magisk Canary release. v20.4 and lower do not support Android 11.
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.
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 on your Rooted Android Device
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 on 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. Make sure that you mention your device’s name (model number if applicable) and the software build number installed. This will allow us to help you quickly and more efficiently.
Источник
How to Root your Android smartphone: Google, OnePlus, Samsung, Xiaomi, and others too!
Welcome to the XDA-Developers Root Directory. Here, you can find root tutorials for most devices that are on the XDA Forums. Learn how to root any Android device, even the best Android phones! If you don’t see your device listed or you see a misplaced link, send a message to Skanda Hazarika (SkandaH on the forums) with the device details.
Table of Contents:
What is Root?
For those new to the world of rooting, acquiring root access essentially grants you elevated permissions. With root access, you are able to alter or replace system applications and settings, run specialized apps that require administrator-level permissions or perform other operations that are otherwise inaccessible to a normal Android user. And by proxy, you may also be able to access certain “hidden” device features or use existing features in new ways.
DISCLAIMER: Rooting a device may void the warranty on the device. It may also make the device unstable or if not done properly, may completely brick the device. XDA-Developers or the author does not take any responsibility for your device. Root at your own risk and only if you understand what you are doing!
How to root a popular Android smartphone
We can go on about the virtues of root access ad infinitum, but we’ll stop for now because we can sense you’re salivating at the prospect of root access and what you can do with your device once root is achieved. Head to the following section to begin the journey. You should find device-specific root guides for latest flagship models from every major OEM below.
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | ASUS ROG Phone 5 | I005D | Click Here |
2. | ASUS ZenFone 8 | I006D | Click Here |
For other ASUS devices, kindly check out the ASUS section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | Google Pixel 5 | redfin | Click Here |
2. | Google Pixel 5a | barbet | Click Here |
For other Google devices, kindly check out the Google section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
Motorola
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | Motorola G100 / Edge S | nio | Click Here |
2. | Motorola Edge 20 Pro / Edge S Pro | pstar | Click Here |
For other Motorola devices, kindly check out the Motorola section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
OnePlus
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | OnePlus 9 | lemonade | Click Here |
2. | OnePlus 9 Pro | lemonadep | Click Here |
3. | OnePlus 9R | lemonades | Click Here |
4. | OnePlus Nord 2 | denniz | Click Here |
For other OnePlus devices, kindly check out the OnePlus section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
Samsung
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | Galaxy S21 | unboundm1(q) | Click Here |
2. | Galaxy S21 Plus | unboundn2(q) | Click Here |
3. | Galaxy S21 Ultra | unboundo3(q) | Click Here |
4. | Galaxy Z Flip 3 | b2q | Click Here |
5. | Galaxy Z Fold 3 | q2q | Click Here |
For other Samsung devices, kindly check out the Samsung section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | Sony Xperia 1 III | pdx215 | Click Here |
2. | Sony Xperia 5 III | pdx214 | Click Here |
3. | Sony Xperia 10 III | pdx213 | Click Here |
For other Sony Xperia devices, kindly check out the Sony section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
Xiaomi
Sr. No. | Device | Codename and Device Forum | Root Guide |
---|---|---|---|
1. | Xiaomi Mi 11 | venus | Click Here |
2. | Xiaomi Mi 11 Pro/Ultra | star/mars | Click Here |
3. | Xiaomi Mi 11i/11X Pro/Redmi K40 Pro+ | haydn | Click Here |
4. | Xiaomi Mi 11X/POCO F3/Redmi K40 | alioth | Click Here |
For other Mi, Redmi, and POCO branded devices, kindly check out the Xiaomi section of our forums. You should be able to find similar fine-tuned guides for your device under the device sub-forums. You can also follow the generic rooting guide from this tutorial.
How to root any Android device
Nowadays, Magisk is the de-facto rooting solution that lets you have root access by leaving the system partition untouched and modifying the boot partition. This is why it’s referred to as a “systemless” root method.
Before getting started with Magisk, make sure that:
- You have access to a PC/Mac with adb and fastboot installed.
- The bootloader of the target Android device is unlocked.
- For Samsung devices, unlocking the bootloader will trip KNOX.
Step 1: Identifying the type of the boot image
Download the latest version of the Magisk app from the project’s GitHub repository. Since the APK of Magisk is hosted outside of the Google Play Store, you may need to allow sideloading apps from unknown sources first and then manually install the downloaded package.
After installing, open the Magisk app. You should see a screen like this:
Now, we need to note down the values of the following parameters:
Step 2: Locating the boot image
In order to patch the boot image for your device, you need to extract it from the official firmware packages. In case you’re using a custom ROM like LineageOS, then the flashable ZIP file contains the boot image.
Case I: You have access to the recovery-flashable ZIP file
If you have a device that still uses the A-only partition scheme, then you can find the boot.img right inside the recovery-flashable ZIP file. Just extract it using a suitable archiver program.
Notice the boot.img file inside POCO M3’s recovery ZIP
However, if your device utilizes the A/B partition scheme, then the boot image and other partition images are further packed inside a file named payload.bin as shown below.
The recovery ZIP of the Google Pixel 5 contains a payload.bin file
In that case, you have to extract the payload.bin file first, then use one of the community-developed payload.bin unpackers to get the boot.img out of it. We strongly suggest you opt for the extractor written in GoВ as it is cross-platform and has been actively developed.
Known as “payload-dumper-go”, this fork even allows end-users to extract a single partition image without unpacking the whole payload.bin, which is particularly useful for this usage scenario.
- First, use the -l parameter to list the partition images inside the payload.bin.
- Then use the -p parameter with the name of the boot image (commonly stored as “boot”) to extract it.
Extracting the boot.img of the ASUS ROG Phone 5 from its payload.bin
Case II: You have access to the Fastboot-flashable image
A handful of OEMs like Google and Xiaomi provide Fastboot-flashable factory images for their devices. If you managed to grab such a package, then the raw boot.img can easily be extracted from the archive.
The location of the boot.img inside the Google Pixel 5’s Fastboot firmware
Special Case: Samsung
Samsung Galaxy devices don’t a traditional Fastboot interface, hence their factory images are packed differently.
- Use Samsung Firmware Downloader to download the factory image for your model.
- Unzip the decrypted package and locate the AP tar file to your device. It is normally named as AP_[device_model_sw_ver].tar.md5.
Step 3: Patching the boot image
Now that we have the boot image in hand, we should proceed with the patching part.
Case I: The value of the “Ramdisk” parameter is “Yes”
- Copy the boot image to your device. In fact, you can patch it on a different Android device than the target one, but you need to install the Magisk app on the secondary device as well.
- Press the Install button in the Magisk card.
- Choose Select and Patch a File in Method, and select the stock boot image.
- The Magisk app will patch the image to [Internal Storage]/Download/magisk_patched_[random_strings].img.
- Copy the patched image to your PC with ADB:
- Flash the patched boot image to your device. For most devices, reboot into Fastboot mode and flash with the following command:
- Reboot and enjoy root access!
Keep in mind that it is possible to patch the boot image on the fly on legacy devices having boot ramdisk through a custom recovery like TWRP, but the method is no longer recommended on modern devices. Having said that, if you have an old phone and want to stick with the custom recovery route, the steps are as follows:
- Download the Magisk APK.
- Rename the .APK file extension to .ZIP (e.g. Magisk-v23.0.APK в†’ Magisk-v23.0.ZIP).
- Flash the ZIP file just like any other ordinary flashable ZIP.
- Note that the sepolicy.rule file of modules may be stored in the cache partition, so don’t clear it.
- Check whether the Magisk app is installed. If it isn’t installed automatically, manually install the APK.
Case II: The value of the “Ramdisk” parameter is “No”
In this case, you need to locate the recovery.img file from the factory image of your device instead of boot.img file. This is because Magisk needs to be installed in the recovery partition, which means you will have to reboot to the recovery mode every time you want root access.
- Copy the recovery image to your device (or a secondary device with the Magisk app installed).
- Press the Install button on the Magisk card.
- Choose “Select and Patch a File” in method, and select the stock recovery image.
- The Magisk app will patch the image to [Internal Storage]/Download/magisk_patched_[random_strings].img.
- Copy the patched image to your PC with ADB:
- Flash the patched recovery image to your device. For most devices, reboot into Fastboot mode and flash with the following command:
- Reboot.
At this stage, there are three possible scenarios:
- Power up normally: You’ll end up with no Magisk, i.e. no root access.
- Recovery Key Combo в†’ Splash screen в†’ Release all buttons: The system should boot with Magisk and full root access.
- Recovery Key Combo в†’ Splash screen в†’ Keep pressing volume up: To access the stock recovery mode.
Special Case: Samsung
- Copy the extracted AP tar file to your device.
- Press the Install button on the Magisk card.
- If your device doesn’t have boot ramdisk, make sure Recovery Mode is checked in options.
- Choose Select and Patch a File in Method, and select the AP tar file.
- The Magisk app will patch the whole firmware file to [Internal Storage]/Download/magisk_patched_[random_strings].tar
- Copy the patched tar file to your PC with ADB:
- Don’t try to copy over the MTP interface as it is known to corrupt large files.
- Reboot to download mode. Open Odin on your PC, and flash magisk_patched.tar as AP, together with BL, CP, and CSC from the original firmware.
- Don’t choose HOME_CSC because we want to wipe data.
- Your device should reboot automatically once Odin finished flashing. Agree to do a factory reset if asked.
- If your device doesn’t have boot ramdisk, reboot to recovery now to enable Magisk.
- Install the latest Magisk app and launch the app. It should show a dialog asking for additional setup. Let it do its job and the app will automatically reboot your device.
- Reboot and enjoy root access!
Step 4: Verification
The last step is to verify that everything is working properly. Locate the newly installed Magisk app and open it. We want to see a version number beside the “Installed” parameter. This means you have successfully obtained root. Great job!
One-Click Root Methods in 2021: Kingroot, KingoRoot, and others
A few years back, several generic root methods like Kingroot, KingoRoot, and others gained popularity as “one-click root” methods, promising root and related benefits with minimal steps and knowledge needed by the user. However, as Android has matured, these one-click root methods are no longer valid for modern smartphones and Android devices in 2021.
We strongly dissuade against the use of these generic root methods as they are either ineffective or worse, pack in malware that can greatly compromise your device and cause you losses. Practically all of these methods are no longer recommended. You should follow the steps listed above for an effective root solution for most Android devices.
We hope this guide not only points you to the right threads for rooting your device but also provides general rooting instructions that can be applied for a large majority of Android devices generally. We’ll be updating this guide with links to further guides for specific phones, so check back again in the future.
Источник