[MAGISK][ROOT][BOOT.IMG] How to patch the Oneplus 8, 8T and 8 Pro stock Boot Image (boot.img) from the currently installed Stock ROM - Android General

Quick and concise how to for obtaining a Stock Boot Image from your Oneplus 8, 8T or 8 Pro device and patching with Magisk to create a fastboot flashable patched boot.img.
DISCLAIMER:
Code:
#include <std_disclaimer.h>
/*
*
* We are not responsible for bricked, broken or dead devices. This is a high-level
* how to for users with a basic knowledge of ADB and Fastboot. YOU alone are
* choosing to make these modifications, and you are solely responsible for your
* device's fit for use and wellbeing.
*
* Backup your data!
*
*/
PREREQUISITS:
An unpatched Stock Boot.img running on your device
General knowledge and understanding of ADB and Fastboot
Download latest op8, op8p, or op8t Horizon Kernel img from [e.g., op8p_7.img]:
https://dl.akr-developers.com/?dir=oneplus/horizon_kernel/R/images
Download latest Magisk Canary build from Github [e.g., app-debug.apk]:
https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk
DEVICE/PC OPERATIONS:
→ ADB
Enumerate devices
Code:
adb devices
Boot into Fastboot
Code:
reboot bootloader
→ FASTBOOT
Enumerate devices
Code:
fastboot devices
Determine the current slot (A/B), whichever slot you're on should be the "good" img
Code:
fastboot getvar current-slot
Boot with the custom kernel downloaded from Horizon to use root [NOTE: Include the full path of the img if not in the same directory]
e.g., fastboot boot "C:\Users\User\Downloads\op8p_R7.img"​
Code:
fastboot boot xxxxxxx.img
→ ADB
Copy the boot.img from each slot to the root of the device
Code:
adb shell
su
dd if=/dev/block/sde11 of=/sdcard/boot_a.img
dd if=/dev/block/sde35 of=/sdcard/boot_b.img
→ Android Device [NOTE: Some Android 11 devices experience patching issues on the Beta Channel like bootloop] [NOTE: Some users experience issues on Canary like no SIM detected; if so switch to Beta]
Install Magisk app-debug.apk (Canary)
Go to Settings → Update Channel → Canary
Go to Home → Install → Install → Select and Patch A File
Navigate to internal storage and select the stock boot.img [choose the img from whichever slot you're on]
When it’s done patching copy the file, named magisk_patched.img, from the root → Downloads of your device to PC
→ ADB
Code:
reboot bootloader
→ FASTBOOT
Test to ensure it boots before flashing; if not you'll need to patch the other img
Code:
fastboot boot magisk_patched.img
→ Android Device
If the device boots and you have root in the Magisk Manager app, reboot the device into Fastboot then flash the active slot [NOTE: Both slots do not need to be flashed; just the current active slot]
→ FASTBOOT
Flash the patched image file [NOTE: Include the full path of the img if not in the same directory]
e.g., fastboot flash boot_b "C:\Users\User\Downloads\magisk_patched.img"
Code:
fastboot flash boot magisk_patched.img
fastboot reboot
- OR -​
Code:
fastboot flash boot_a magisk_patched.img
fastboot reboot
- OR -​
Code:
fastboot flash boot_b magisk_patched.img
fastboot reboot
ADDITIONAL RESOURSES:
→ FASTBOOT
If you need to set the other slot to be the active slot use:
Code:
fastboot --set-active=a
- OR -​
Code:
fastboot --set-active=b
→ ADB
ADB Magisk Bootloop Fix
Code:
adb shell
magisk --remove-modules
→ OTA Help
Magisk stock boot.img missing fix [NOTE: Android 11 onwards, the /sbin folder might not exist, so Magisk will randomly create a folder under /dev and use it as the base folder]
Rename to: stock_boot_0.img
Compress with gzip = stock_boot_0.img.gz
Copy stock_boot_0.img.gz file to the root of: /data
Edit the config file: /dev/xxxxxxx/.magisk/config → Change SHA1= to 0
Magisk Manager → Uninstall Magisk → Restore Images
→ ADB
Determine the random folder name generated by Magisk on Android 11+
Code:
ls -laR /dev | grep '.magisk/rootdir'
→ ADB
Determine the Boot Image partition location [NOTE: Will list all partitions; look for boot_a and boot_b]
Code:
ls /dev/block/bootdevice/by-name/ -all

Tried some other way on android 11 but failed, so back to android 10.
maybe i won't get android 11 until TWRP is work.
can't easily backup data without root is very annoying, thanks for the work!

I have followed every step, but root only last until I restart my Oneplus.
What am I doing wrong? Why want the device stay rooted?

mrram said:
I have followed every step, but root only last until I restart my Oneplus.
What am I doing wrong? Why want the device stay rooted?
Click to expand...
Click to collapse
Guessing here, but have a second look at these two commands:
Code:
fastboot boot magisk_patched.img
△ This will NOT flash the rooted image, it will only boot up once so you can test it or use it for temporary root
verses
Code:
fastboot flash boot magisk_patched.img
▲ This will flash the rooted image and is used after you've tested the patched image to be sure it doesn't bootloop and to have persistent root

If I use this Horizon kernel to boot with root on 11.0.4.4, could I use directly Magisk 22.0 to root the device permanently? Thanks in advance.

MagikGab said:
If I use this Horizon kernel to boot with root on 11.0.4.4, could I use directly Magisk 22.0 to root the device permanently? Thanks in advance.
Click to expand...
Click to collapse
I only use the Horizon to boot then grab my kernel to patch with Magisk. You could use the Horizon kernel, but you would have to flash it, not just boot it. So, root device, backup stock dtbo, flash Horizon & dtbo, re-root if lost during flash. I would recommend against that until there's a custom recovery available in case there were any issues. Additionally, you must backup your stock dtbo if you ever want to return to stock. You should visit the Horizon thread for more details, but again if you're not familiar with kennel mods you might not want to start learning on a device without a custom recovery.

CarvedArt said:
I only use the Horizon to boot then grab my kernel to patch with Magisk. You could use the Horizon kernel, but you would have to flash it, not just boot it. So, root device, backup stock dtbo, flash Horizon & dtbo, re-root if lost during flash. I would recommend against that until there's a custom recovery available in case there were any issues. Additionally, you must backup your stock dtbo if you ever want to return to stock. You should visit the Horizon thread for more details, but again if you're not familiar with kennel mods you might not want to start learning on a device without a custom recovery.
Click to expand...
Click to collapse
I'd like only to root my device, remaining as more stock as possible, for now. If I want to avoid using a custom kernel (also for the rooting process), should I extract the boot.img with Python, then patch it with Magisk 22? Thanks in advance for your reply, but I'm coming from a Xiaomi that was quite easier to root

MagikGab said:
I'd like only to root my device, remaining as more stock as possible, for now. If I want to avoid using a custom kernel (also for the rooting process), should I extract the boot.img with Python, then patch it with Magisk 22? Thanks in advance for your reply, but I'm coming from a Xiaomi that was quite easier to root
Click to expand...
Click to collapse
Just follow the steps above -- that'll get you a stock kernel (your current kernel) patched with Magisk and permanently rooted. The above process is only using the Horizon kernel to boot your device with root so that you can extract your kernel and patch it. The final result will be as stock as you can get with root.

Hey everyone. OP8 Pro user here. Just took OTA going from 11.0.9.9 running Magisk Canary 23 to the newest 11.0.10.10. I restored images before taking the OTA and reinstalled magisk to the other slot like I always do to retain root. Ive now lost root and am trying to boot the last two versions of the Horizon kernel. Ive tried the two latest ones (r9.2 and r9.2.1 from February 2021) and while they do boot my phone, I cant get SU access to extract the stock images.
Anything else that anyone things I should try? All i want from Christmas is root.

Isn't there a more easy way to obtain root?
That's strange. I use OnePlus smartphones with LineageOS for years now and cannot remember to execute such a complicated procedure. Just now I got a OnrPlus 8, installed LineageOS and Magisk and restored my apps with Titanium. So, it definitely worked.
Now, after a Lineage system update, root is gone.
Unfortunately I cannot tell exactly how I installed Magisk. I have a very poor memory. Think I just installed the app and said either just "install" or patched the zip with TRWP
But I definitely never downloaded or extracted any boot image manually.
Has anyone an explanation for this?
Even more strange: I just tried to flash magisk.zip again with TRWP. Now it tells me
"Magisk patched boot image detected"
and later:
"Failed to mount '/system_root' (Device or resource busy)"
After reboot the Magisk app now offers me three choices in the install tab:
- choose a file and patch (only this one existed before)
- direct installation (recommended)
- install into inactive slot (after OTA)
I don't understand the last one and tried the recommendet one.
Now, root is there again. Do I have to do this after each update? With my OnePlus5 I didn't.

Unfortunately I have another problem with my OnePlus8 and Lineage:
I'm using AdAway which replaces the hosts file, but on my OP8 it cannot.
"Unable to cppy the hosts file to /System partition. Please check if the Magisk Systemless module is active"
What does it mean? The Magisk app says: "ramdisk yes"

tosho1 said:
Unfortunately I have another problem with my OnePlus8 and Lineage:
I'm using AdAway which replaces the hosts file, but on my OP8 it cannot.
"Unable to cppy the hosts file to /System partition. Please check if the Magisk Systemless module is active"
What does it mean? The Magisk app says: "ramdisk yes"
Click to expand...
Click to collapse
Magisk → Settings (Gear icon) → Systemless hosts ← Click it

tosho1 said:
Isn't there a more easy way to obtain root?
That's strange. I use OnePlus smartphones with LineageOS for years now and cannot remember to execute such a complicated procedure. Just now I got a OnrPlus 8, installed LineageOS and Magisk and restored my apps with Titanium. So, it definitely worked.
Now, after a Lineage system update, root is gone.
Unfortunately I cannot tell exactly how I installed Magisk. I have a very poor memory. Think I just installed the app and said either just "install" or patched the zip with TRWP
But I definitely never downloaded or extracted any boot image manually.
Has anyone an explanation for this?
Even more strange: I just tried to flash magisk.zip again with TRWP. Now it tells me
"Magisk patched boot image detected"
and later:
"Failed to mount '/system_root' (Device or resource busy)"
After reboot the Magisk app now offers me three choices in the install tab:
- choose a file and patch (only this one existed before)
- direct installation (recommended)
- install into inactive slot (after OTA)
I don't understand the last one and tried the recommendet one.
Now, root is there again. Do I have to do this after each update? With my OnePlus5 I didn't.
Click to expand...
Click to collapse
LineageOS is not the stock ROM so it's slightly different and not covered in this thread.

Thank you, CarvedArt. I wasn't aware of this.

Does anyone have the latest stable Android 13 patched boot image for the IN2015 that they can share with me ?

Related

[GUIDE] Install Magisk with proper support for OTA updates

Code:
* I'm not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed.
* Please do some research if you have any concerns about features included in the products you find here before flashing it!
* YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
* Your warranty could be void if you tamper with any part of your device / software.
* Same statement for XDA.
Here's an alternative method to install Magisk that support OTA updates (copied from the Mi A1 forum and expanded )
You need a PC with Android platform tools (they exist also for MacOS and Linux). When using Windows, you should also install MiFlash tool to get the required drivers to recognize the device.
BOOTLOADER UNLOCK
First thing to do: unlock the bootloader (if you didn't already do this, obviously). Smartphones with Android One are much easier to unlock compared to other Xiaomi phones with MIUI (where you have to ask for authorization and wait for weeks).
CAUTION: when you unlock the bootloader, the phone will reset, erasing all your saved data. Backup your data before unlocking.
1. Go to Settings > System > About phone > and tap many times on "Build number" until you unlock "Developer options" (on Andoird 9 "About phone" is right at the top of the Settings app).​2. Go back to the previous page (i.e. Settings > System), where you can find now "Developer options". Go there and enable the "OEM unlocking" option (and it's better to never disable this).​3. Now you can shutdown your phone, then turn it on while holding the "Volume down" button pressed. Release it when you see the Fastboot screen You can also use the command "adb reboot-bootloader" if you already connected the phone to the PC.​4. Now connect the phone with your PC via USB cable, open an administrative command prompt, move to the directory where the Android platform tools are placed and unlock the bootloader with the following command:
Code:
fastboot oem unlock
The phone will reboot, erasing all the data.​
Now you unlocked your phone's bootloader and can continue to the next section.
MAGISK INSTALLATION
5. Download and install on the smartphone the latest version of Magisk Manager's apk available.
You need the smartphone to be connected to the internet, because Magisk won't install and won't work properly without a connection.​
6. Now you can easily download an already patched boot.img from the following list and jump straight to point 10 of this guide, or you can continue to the next point and learn to patch yourself an original boot.img
If you choose the short way, be sure that you select the patched_boot.img with the same "Build number" currently installed on your phone (see point 1 of this guide), and don't flash the file directly on the phone memory, because Magisk will not work properly (do exactly what this guide says, and you will not find problems, hopefully).
For our convenience, extract the patched_boot.img file in the same directory where Android platform tools are located.
patched_boot 9.6.4.0 (2018 July update) - patched with Magisk 17.1
patched_boot 9.6.6.0 (2018 August update) - patched with Magisk 17.1
patched_boot 9.6.8.0 (2018 September update) - patched with Magisk 17.1
patched_boot 9.6.9.0 (2018 October update) - patched with Magisk 17.1
patched_boot 9.6.10.0 (2018 November 1st update) - patched with Magisk 17.1
patched_boot 9.6.11.0 (2018 November 2nd update) - patched with Magisk 17.1
patched_boot 10.0.2.0 (2018 December upgrade to Android 9.0 Pie) - patched with Magisk 18.0
patched_boot 10.0.3.0 (2019 January update) - patched with Magisk 18.0
In case you erroneously flash those patched files directly on the phone, flash back the original boot.img via fastboot and follow the guide:
original boot.img 9.6.4.0 (2018 July update) - taken from fastboot ROM
original boot.img 9.6.6.0 (2018 August update) - taken from OTA update
original boot.img 9.6.8.0 (2018 September update) - taken from OTA update
original boot.img 9.6.9.0 (2018 October update) - taken from OTA update
original boot.img 9.6.10.0 (2018 November 1st update) - taken from OTA update
original boot.img 9.6.11.0 (2018 November 2nd update) - taken from OTA update
original boot.img 10.0.2.0 (2018 December upgrade to Android 9.0 Pie) - taken from fastboot ROM
original boot.img 10.0.3.0 (2019 January update) - taken from fastboot ROM
7. You need the original boot.img to patch. You can find it inside the official fastboot ROM zip for daisy. Check that the downloaded ROM version is the same as the "Build number" currently installed on your phone (see point 1 of this guide). If the versions are different, update (or downgrade if possible) your phone to that version. You can also download original boot.img elsewhere (for example at the point 6 of this guide), but always pick the same "Build number" of your phone.
After you get the boot.img, copy it to the phone memory (via USB or microSD, or download directly from the phone browser, as you prefer).​
8. Open the Magisk Manager app installed previously, it will ask if you want to install Magisk. Accept by tapping on "Install" > "Patch Boot Image File" and select the boot.img file that you get on the point 7 of this guide.​
9. Wait until the process completes (about 1 minute), then tap on "Close". Now in the phone memory, inside the Download directory, you should have a patched_boot.img file. Copy that file to the PC, inside the same folder where the Android platform tools are located, for our convenience.​
10. Reboot the phone in fastboot mode (as already explained in point 3 of this guide), open an administrative command prompt, move to the Android platform tools directory and then write the following command:
Code:
fastboot boot patched_boot.img
If everything works the phone should boot normally. Open Magisk Manager and it should ask to install Magisk, if not you must tap on the "Install" button. Then choose "Install" > "Direct Install (Recommended)" to install Magisk on the phone, and reboot when finished.​
11. Last step to stay safe when a new OTA update arrives: go to "Settings" > "System" > "Developer options" > and disable "Automatic system updates". From now on, you should check manually if a new OTA update is available.​
Now the installation is finished, you can use Magisk Manager to install modules and manage root permissions.
HOW TO APPLY OTA UPDATES
UPDATE 9 February 2019 It seems that with the latest Magisk (v18.1) and Magisk Manager (v7.0.0) the following procedure is working fine again. I didn't test it personally, but some users gave positive feedback.
WARNING! January 2019 Since the arrival of Android 9 Pie, the OTA update with Magisk as described in the following section, doesn't seem to work anymore. It could work, but you could also get a bootloop with the risk of losing your data.
Before upgrading from Android 8 to 9, or doing an OTA update after Android 9 you should:
- backup your data;
- remove any lockscreen password or fingerprint;
- uninstall totally Magisk and reboot.
If after doing this you get a bootloop, you could try to manually flash the vanilla boot.img via fastboot on the current slot (the same version as the last installed OTA). If you managed to fix the bootloop you can then install Magisk anew, from step 5 of this guide.
If the phone wants your PIN or password to proceed after the OTA update or after fixing the bootloop, and your PINs or passwords doesn't work, then you could have to reset the phone (or erasing the data partition, that should be the same thing), losing all your data.
Last chance if everything fails, you can flash the latest fastboot ROM from the official Xiaomi site and the phone will be working again.
IMPORTANT: OTA updates will work only if all the partitions on the smartphone are untouched. Magisk Manager can restore the original boot.img following this section of the guide, but if you tampered directly with the system partition (e.g. manually editing build.prop) or other partitions, OTA will refuse to install.
You can try to fix OTA updates without the need to flash the whole original fastboot ROM, by flashing only the tampered partitions (usually only "system") with the corresponding img file found inside the fastboot ROM zip. Check the "Troubleshooting" section of this guide for details.
12. When you know that a new OTA update is available and you want to install it, open Magisk Manager, and tap on "Uninstall" > "Restore Images" but very important: absolutely don't reboot the phone now!
Important note: Magisk Manager will restore the boot.img that was found on the phone while installing Magisk. If the boot.img was already non-vanilla (for example you flashed the boot.img with TWRP before installing Magisk), Magisk Manager will backup that modified version of boot.img, and when restored the OTA will not work, as that's not a vanilla boot.img.​
13. Close Magisk Manager and go to "Settings" > "System" > "System update" and install the OTA update. After the update is downloaded, a two-stages update will begin.​
14. When both stages of the update process completed, it will ask to restart: DON'T DO IT!. Open Magisk Manager again and tap on "Install" > "Install" > "Install to Inactive Slot (After OTA)" and after that you can tap on "Reboot".​
After the reboot you will have the updated Android version with Magisk already working.
Thanks to user @jashancheema for the Mi A1 guide and a bigger thanks to @topjohnwu for the OTA part and above all for developing Magisk.
TROUBLESHOOTING
WARNING: before attempting any of the following operations, you must disable any screen lock, PIN or password, because you risk to not get back your data (encryption issues). It is recommended to take a backup, too (as every time a custom modding is involved).
You can get errors when installing OTA updates if you didn't follow meticulously the guide.
Check this list to try to find where the problem lies:
- when a new version is found, the updater will check if all the partitions on the device are untouched. If there is a partition that has been modified, the OTA updater will not proceed with the installation;​- typically, the two partitions commonly modified by user modding are the boot partition (that's where Magisk and TWRP are installed) and the system partition (when you change a config file, add or remove a system app, etc.);​- a system partition modified only by using Magisk modules is effectively untouched, because Magisk register all changes to /system in a file in the /data partition and then trick Android to believe those changes are really applied to /system;​- boot partition instead is really modified, but if you install Magisk following this guide, Magisk will save a copy of the untouched boot partition, and restoring it before applying OTA update will make the update work.​
Now, if you didn't follow this guide to install Magisk and you installed it in other ways, Magisk could alert you that he cannot restore the original boot.img (the boot partition) when you try to apply the OTA update.
To fix this, you can flash directly the vanilla (original, unmodified, untouched) boot.img taken from the point 6 of this guide, using those commands:
Code:
fastboot getvar current-slot
fastboot flash boot_? boot.img
the first command will tell you what is the current slot in use (a or b), the second command will flash the original boot into the phone, but you have to change the "?" in the command with a or b (i.e. the current slot that the first command provided).
Remember that the boot.img file version must correspond to the Android build version currently running in your phone.
If the OTA update will still refuse to apply, probably you changed something directly in the /system partition (for example you changed something in the build.prop without using a Magisk module to do this).
In this case you have to flash the original system.img in the phone with those commands:
Code:
fastboot getvar current-slot
fastboot flash system_? system.img
and as before, the first command will tell you the right slot to use instead of the "?" in the second command.
Here you can find the system.img extracted from the OTA updates zip (along with every other .img file inside that):
9.6.6.0 (August 2018) OTA update dump as .img files
9.6.8.0 (September 2018) OTA update dump as .img files
9.6.9.0 (October 2018) OTA update dump as .img files
9.6.10.0 (November 2018) full fastboot ROM
9.6.11.0 (November 2018) OTA update dump as .img files
If you want to obtain the system.img by yourself, you can find it inside the fastboot images but usually they are not updated monthly like OTA updates. But you can extract the system.img directly from the OTA update zips found in this thread (as I did above with my dumps), using the Python scripts found here.
To make the Python scripts work in Debian/Ubuntu and derivatives, you have to download both "extract_android_ota_payload.py" and "update_metadata_pb2.py", give them execution property and then install the package "python-protobuf". After this you can give this command to unpack the payload.bin file (that you must extract from the OTA update zip):
Code:
./extract_android_ota_payload.py /path/to/payload.bin
This will extract in the current directory all the .img files inside payload.bin, including the system.img
I don't know how to proceed in Windows, probably you only need to install the latest Python2 release and the script will work.​
As the last resort, you can flash directly with MiFlash the latest fastboot image available (even if older than your current version). Use the "flash_all.bat" script but before take a backup of your data, because the phone will be fully reset.
If you don't want to take the risk of not doing a backup, use the script "flash_all_except_storage.bat" when flashing, so you will keep all your data, but be warned that sometimes you will not be able to access the data anymore, because of encryption problems.
Right after the flash, you can start following the guide from point 5 or 6.
It should not be a problem downgrading the build version via fastboot, as long as the Android main version remain the same (Oreo 8.1 at the moment).
Thx, nice work :good:
Thanks to the OP. Great post! Totally noob friendly guide. Nice work.
It should also work on mi a2, thanks!
Lione2 said:
It should also work on mi a2, thanks!
Click to expand...
Click to collapse
Sure, but you can't use the posted patched_boot.img, because they're designed for Mi A2 Lite (daisy) and not for Mi A2 (jasmine).
EDIT: I posted the patched and original boot files for Mi A2 jasmine in the second post. I don't know if I can make a thread in the Mi A2 forum section with an adapted copy of my guide, there are already two guides there (even if not polished like this) and I don't want to create more confusion with a third guide about the same argument...
i've installed magisk from previous guide - what steps should I take to apply OTA update? - 12 to 14?
Now magisk informs me that there is 17.1 version - how to update it?
krzygaj said:
i've installed magisk from previous guide - what steps should I take to apply OTA update? - 12 to 14?
Now magisk informs me that there is 17.1 version - how to update it?
Click to expand...
Click to collapse
If you flashed directly the patched_boot.img via fastboot in both slots A and B as the other guide said previously, you must flash the original boot.img to both slots, then start the guide from point 10.
BubuXP said:
If you flashed directly the patched_boot.img via fastboot in both slots A and B as the other guide said previously, you must flash the original boot.img to both slots, then start the guide from point 10.
Click to expand...
Click to collapse
I did as you wrote but still can't install August update - is there any log?
- extracted boot.img from rom: http://en.miui.com/download-354.html
- did fastboot flash boot_a boot.img and fastboot flash boot_b boot.img and rebooted
- next rebooted and did fastboot boot patched_boot.img with patched_boot 9.6.4.0 (July update) - patched with Magisk 17.1
later did steps in guide - but when i do system update it stops on first stage
Any ideas?
krzygaj said:
I did as you wrote but still can't install August update - is there any log?
- extracted boot.img from rom: http://en.miui.com/download-354.html
- did fastboot flash boot_a boot.img and fastboot flash boot_b boot.img and rebooted
- next rebooted and did fastboot boot patched_boot.img with patched_boot 9.6.4.0 (July update) - patched with Magisk 17.1
later did steps in guide - but when i do system update it stops on first stage
Any ideas?
Click to expand...
Click to collapse
You tampered the system partition? Try flashing also the system.img in that case.
Another case could be that you made an OTA update from the June build to July: in this case the partitions on the other slot (probably only the boot partition) where lost when overwrited with fastboot (and cannot be restored, as we don't have any June build ROM or OTA).
If everything fails, do a full fastboot flash with MiFlash tool, but using the flash_all_except_storage.bat script, that should keep your data intact, restore all partitions (A and B) to stock versions and you can then apply OTA (before or after installing Magisk, but I suggest after installing Magisk so you can test if the guide works fine).
BubuXP said:
If everything fails, do a full fastboot flash with MiFlash tool, but using the flash_all_except_storage.bat script, that should keep your data intact, restore all partitions (A and B) to stock versions and you can then apply OTA (before or after installing Magisk).
Click to expand...
Click to collapse
Thanks above worked :good:
Hope the next update will go smoothly

			
				
September?
When booting comes a warning message because of the unlocked boot loader. How can I disable this message?
PC295 said:
When booting comes a warning message because of the unlocked boot loader. How can I disable this message?
Click to expand...
Click to collapse
you can't turn that off with open bootloader
Guys, after i have unlocked bootloader i cannot charge my phone when is off because he go on when I insert the plug, it's normal?
proton242 said:
Guys, after i have unlocked bootloader i cannot charge my phone when is off because he go on when I insert the plug, it's normal?
Click to expand...
Click to collapse
No
ConradB said:
No
Click to expand...
Click to collapse
ConradB you have some suggestion? Thank you
proton242 said:
ConradB you have some suggestion? Thank you
Click to expand...
Click to collapse
Same problem on mine, I don't know if it's a ROM bug or it's caused by unlocked bootloader or Magisk.
The only solution at the moment is charging while the phone is switched on.
BubuXP said:
Same problem on mine, I don't know if it's a ROM bug or it's caused by unlocked bootloader or Magisk.
The only solution at the moment is charging while the phone is switched on.
Click to expand...
Click to collapse
Ciao BubuXP, provando a rimuovere Magisk (lasciando il bootloader sbloccato) tutto torna alla normalità, cosa dici, crea casino quando patcha il boot.img?

Advanced OTA keeping Magisk and TWRP (needs a computer)

History...
I originally wrote this guide to upgrade from 10.0.4.0 to 10.0.7.0.
I have also used this same guide to install every OTA from 10.0.7.0 to 11.0.11.0.
This guide assumes you have both Magisk and TWRP, that Magisk cannot "uninstall" (because of TWRP installation) and that you want to keep both Magisk and TWRP after installation. Parts of this guide may still be useful if you aren't in this exact situation.
If you only have Magisk, you should be able to follow these much simpler instructions: https://forum.xda-developers.com/mi-a2-lite/how-to/guide-install-magisk-proper-support-ota-t3836952
Things to have on hand:
- vanilla_boot.img (for the version you currently have)
- patched_boot.img (your current boot image with Magisk)
- TWRP img and zip (see version info below)
I think that TWRP also causes the vendor partition to be modified. It may also touch system but I have a modified bootanimation.zip which modifies system, so I can't be sure. In any case, I also have a backup of system.img and vendor.img.
Because Magisk is installed after TWRP, Magisk's "backup" of the "stock boot image" is not vanilla. This means that in order to take the OTA, I have to flash the vanilla boot image.
0 - Update your patched_boot.img
If you don't have a patched_boot.img for your current Magisk (eg. my patched_boot.img was old, since I had installed several Magisk updates), you should build a new patched_boot.img so that when you boot it, the system will continue to work.
Push the vanilla image to the phone.
Code:
adb push vanilla_boot.img /sdcard
Then get Magisk to install using the "Select and Patch a File" method, select the file you uploaded. Then pull down the patched image.
Code:
adb pull /sdcard/Download/magisk_patched.img patched_boot.img
1 - Prepare to OTA
For some reason, my carrier does not like the OTA process so I always turn on Airplane mode + Wifi.
Get to fastboot and check the current slot.
Code:
adb reboot bootloader
fastboot getvar current-slot
My current slot was b
Flash the system and vendor partitions (if necessary).
Code:
fastboot flash system_b vanilla_system.img
fastboot flash vendor_b vanilla_vendor.img
Flash vanilla and boot the patched image (so that Magisk is active and the OTA can be applied).
Code:
fastboot flash boot_b vanilla_boot.img
fastboot boot patched_boot.img
2 - Do the OTA
Install OTA (DO NOT REBOOT)
If the OTA fails
If the OTA fails, you can find out which partitions it doesn't like from the logcat. If you have a fastboot image, you can reflash the affected partitions. As previously mentioned, I've had to flash all of boot, vendor and system for each OTA.
Code:
adb logcat | grep update_engine
...
07-01 06:52:38.470 E/update_engine(935): [0701/065238.470683:ERROR:delta_performer.cc(990)] The hash of the source data on disk for this operation doesn't match the expected value. This could mean that the delta update payload was targeted for another version, or that the source partition was modified after it was installed, for example, by mounting a filesystem.
07-01 06:52:38.470 E/update_engine(935): [0701/065238.470931:ERROR:delta_performer.cc(995)] Expected: sha256|hex = A4AD686D7BF628486668446221D0089BF5915DBC1158C83D30A06222FE7D2ACB
07-01 06:52:38.471 E/update_engine(935): [0701/065238.471002:ERROR:delta_performer.cc(998)] Calculated: sha256|hex = 4CADBE88EC1C019913A0B416EB9031840D4BA6B2287A3FC814A2B8B7F9871F7D
07-01 06:52:38.473 E/update_engine(935): [0701/065238.471072:ERROR:delta_performer.cc(1009)] Operation source (offset:size) in blocks: 0:5221,5461:405,5869:1,5873:343,6221:589
07-01 06:52:38.473 E/update_engine(935): [0701/065238.473233:ERROR:delta_performer.cc(1191)] ValidateSourceHash(source_hash, operation, source_fd_, error) failed.
07-01 06:52:38.473 E/update_engine(935): [0701/065238.473340:ERROR:delta_performer.cc(298)] Failed to perform BROTLI_BSDIFF operation 187, which is the operation 0 in partition "boot"
07-01 06:52:38.473 E/update_engine(935): [0701/065238.473411:ERROR:download_action.cc(337)] Error ErrorCode::kDownloadStateInitializationError (20) in DeltaPerformer's Write method when processing the received payload -- Terminating processing
07-01 06:52:38.739 E/SystemUpdate(15410): [Execution,NonStreamingAbApplyAction] Installation failed with error code: 20.
3 - Backup the vanilla boot image
Note that you need to pull from the other slot (in my case, a).
Code:
adb shell
su
dd if=/dev/block/by-name/boot_a of=/sdcard/vanilla_boot.img bs=1024k
Backup system.img and vendor.img too (if required).
Code:
dd if=/dev/block/by-name/system_a of=/sdcard/vanilla_system.img bs=1024k
dd if=/dev/block/by-name/vendor_a of=/sdcard/vanilla_vendor.img bs=1024k
4 - Magisk patch the other slot
Use Magisk to "Install to Inactive Slot (After OTA)" (DO NOT REBOOT)
5 - Backup the patched boot image
Note that you need to pull from the other slot (in my case, a).
Code:
dd if=/dev/block/by-name/boot_a of=/sdcard/patched_boot.img bs=1024k
exit
exit
# back on your computer
adb pull /sdcard/vanilla_boot.img
adb pull /sdcard/patched_boot.img
Pull down system and vendor images too (if required).
Code:
adb pull /sdcard/vanilla_system.img
adb pull /sdcard/vanilla_vendor.img
Now you can let Magisk reboot. This is the moment of truth...
At this point you should have an upgraded, Magisk-enabled system and backups of the vanilla and patched boot images. Congratulations on completing the OTA!
If the system fails to boot
There's a few things to try before giving up if the system fails to boot...
1) Boot without Magisk (fastboot boot vanilla_boot.img). Probably indicates that a Magisk module you have is no longer compatible.
2) Boot TWRP (fastboot boot twrp.img) and poke at things. As an example, I used the /sdcard/mm program (part of Magisk Manager for recovery) to disable EdXposed when the OTA to Android 10 failed to boot.
6 - Restore TWRP
It is possible to boot TWRP from fastboot so you don't strictly need to install TWRP. I like to have it available anyway.
Old version info...
I had been using the official TWRP 3.2.3, which worked great up until 10.0.9.0. With 10.0.9.0, I couldn't get to TWRP, I just got the system destroyed screen. I could fastboot boot it, but it couldn't mount /data (a problem it has always had).
I figured out that TWRP 3.3.1-dees_troy (from the official TWRP site) works with 10.0.9.0 and up. What's more, it works (can decrypt /data) if you fastboot boot it, not just after install. So you could in theory simply not install TWRP and fastboot boot if in the event that you actually need it.
I know that people have their own favourite versions, with the offain version being popular (didn't work for me). There's OrangeFox too (also didn't work for me).
In summary, I recommend Official TWRP 3.3.1-dees_troy but if you have a favourite alternative, feel free to use it instead.
TWRP thread: https://forum.xda-developers.com/mi-a2-lite/development/official-twrp-daisy-t3855396
Download link: https://dl.twrp.me/daisy/
Restoring TWRP is the same as installing it the first time. This is the process that I use.
Flash vanilla boot, then install TWRP to it.
Code:
adb reboot bootloader
fastboot boot twrp-3.3.1-dees_troy-daisy.img
Install TWRP
Code:
adb push twrp-installer-3.3.1-dees_troy-daisy.zip /sdcard
Use TWRP to install twrp-installer-3.3.1-dees_troy-daisy.zip
I install my modified bootanimation.zip at this time.
Mount System from TWRP (it is normally already mounted for me).
From a shell:
Code:
adb shell
cd /sdcard
cp bootanimation.zip /system/system/media/bootanimation.zip
Umount System
You must re-install Magisk after installing TWRP.
Code:
adb reboot bootloader
fastboot boot patched_boot.img
Use Magisk to "Direct Install (Recommended)"
Reboot
For some reason, my carrier does not like the OTA process so at this point I normally power off the phone rather than just rebooting. When the phone boots, I can turn off airplane mode and check that a mobile data connection can be made.
7 - Confirm that everything works
Make sure the system comes up and Magisk Manager says that Magisk is installed.
Make sure you can get to TWRP. Boot while holding VOL+ or
Code:
adb reboot recovery
Make sure TWRP can see your files.
Congratulations! You have installed an OTA while keeping Magisk and TWRP!
8 - Backup boot.img with TWRP + Magisk (optional)
If you want a copy of the boot.img with both Magisk and TWRP. This pulls from the now-current slot (in my case, a). I'm not totally sure of the value of this, since I can't get fastboot to boot this image. It may come in handy if you upgrade TWRP and that breaks (since you can flash this back rather than having to install the old TWRP again).
Code:
adb shell
su
cd /sdcard
dd if=/dev/block/by-name/boot_a of=twrp_boot.img bs=1024k
exit
exit
# back on the computer
adb pull /sdcard/twrp_boot.img
Thanks. Could you upload or indicate where we can get the necessary files?
Will i loose all user data and internal storage wiped if i do this?
Thanks for sharing, looks complicated, also i think you should use a fixed twrp, since the official dont have acces to sdcard.
rossarnie said:
Thanks. Could you upload or indicate where we can get the necessary files?
Click to expand...
Click to collapse
If you have Magisk, you should already have the vanilla and patched boot.img files.
Of you don't already have Magisk, just follow the install procedure here. https://forum.xda-developers.com/mi-a2-lite/how-to/guide-install-magisk-proper-support-ota-t3836952
If you're running 10.0.4.0 without magisk and need to extract your vanilla boot.img. Use fastboot to boot into twrp and then you can do the DD command to extract boot. Use adb pull to save it to PC.
I used official TWRP from here.
https://forum.xda-developers.com/mi-a2-lite/development/official-twrp-daisy-t3855396
Apparently there's a different twrp that can access the external SD card. I don't have an external SD card so I don't need it.
dr.bahaeddin said:
Will i loose all user data and internal storage wiped if i do this?
Click to expand...
Click to collapse
I didn't lose any data.
I've never had a problem with Magisk. TWRP does tend to bootloop after install, which is why I install magisk again.
You should be able to flash the patched or vanilla boot if twrp is boot looping to fix it too. Just won't have twrp anymore.
a1291762 said:
I didn't lose any data.
Click to expand...
Click to collapse
Mind you. I have a backup of my apps and data that's off of my phone so even if I do need to factory reset I can get it back. That's a longer and more complicated guide.
Txatxiquesi said:
looks complicated.
Click to expand...
Click to collapse
Before I had twrp the standard Magisk ota process was enough. But that loses twrp and with twrp in my magsik backup, the uninstall didn't work. So extra steps are needed. Plus some extra steps to make backups of important files for the next OTA
a1291762 said:
If you have Magisk, you should already have the vanilla and patched boot.img files.
Click to expand...
Click to collapse
Hmm... This may not be the case. I'm careful to make backups but it's easy to skip this.
If you don't have a patched boot image you can backup your current boot partition from a root shell. You need to find out if you are booting a or b slot. Then
dd if=/dev/block/by-name/boot_a of=/sdcard/patched_boot.img bs=1024k
Magisk puts old stock backups into /data. I had 4 files in there which makes it hard to know what each file is.
That's why I made sure to backup my vanilla boot image immediately.
If you're stuck without a vanilla 10.0.4.0 boot you can't do the OTA. I can upload mine somewhere when I get home tonight if it's not already online.
a1291762 said:
...If you're stuck without a vanilla 10.0.4.0 boot you can't do the OTA. I can upload mine somewhere when I get home tonight if it's not already online.
Click to expand...
Click to collapse
This would be very helpful, please
FunkmasterC said:
This would be very helpful, please
Click to expand...
Click to collapse
Here is the backup I made of the 10.0.4.0 vanilla boot.img. You'll need to decompress this before flashing.
URL REMOVED
What's new on 10.0.7.0 bro? Should me wait for 10.1 update if im on 10.0.4.0 rooted?
10.0.7.0 has the March security patches. I haven't noticed any actual changes.
Thank you, your Linux commands are sick, I never know I can get the vanilla and patched boot.img like that.
Cheer~
is there an update for file version 10.0.8.0??
I only just got the notification this morning. I'll do the upgrade tonight but I expect the same process will work.
I just used the same process to go from 10.0.7.0 to 10.0.8.0. This time I was installing to slot b instead of slot a, but otherwise, things were the same.
A side note... I hadn't got around to installing TWRP 3.3.0 so I did that but it couldn't mount /data. TWRP 3.2.3 can mount /data, so I installed that again.
a1291762 said:
I just used the same process to go from 10.0.7.0 to 10.0.8.0. This time I was installing to slot b instead of slot a, but otherwise, things were the same.
A side note... I hadn't got around to installing TWRP 3.3.0 so I did that but it couldn't mount /data. TWRP 3.2.3 can mount /data, so I installed that again.
Click to expand...
Click to collapse
I have successfully updated to 10.0.8.0 with Magisk 18.1, now on Magisk 19.1, everything is running fine. I'd like to also install TWRP but refrain from doing so because of the problems (bootloops, crashes, etc) the official TWRP 3.2.3 shows with decryption in Pie and mounting external or even internal sdcard. I wonder if the latter is fixed in the inofficial fixed version. I think the benefit of TWRP is not worth the effort of repeating a1291762 wonderful tricky procedure on the monthly OTA update basis.
However the procedure is very smart, a back-to-the-roots approach of former days... great, I like it.
But I don't understand how a patched_boot.img can be created from an empty file (boot_a)?
[dd if=/dev/block/by-name/boot_a of=patched_boot.img bs=1024k] Locating the boot_a in </dev/block/by-name/> reveals a boot_a file with 0 bytes. Moreover, to unzip the zipped stock boot Image in </data/stock_boot*.img> or </sbin/.magisk/mirror/data/> I am looking for a command that just returns the boot file rather than expanding it to the full partition. Weird, can anybody help?
Thanks again to a1291762
grufty47
It appears that it is not possible to add some boot.img as attachment
grufty47 said:
I'd like to also install TWRP but refrain from doing so because of the problems (bootloops, crashes, etc) the official TWRP 3.2.3 shows with decryption in Pie and mounting external or even internal sdcard.
Click to expand...
Click to collapse
I use official TWRP 3.2.3. Only really to fix bootloop problems.
I don't have a SD and no problems mounting data.
Lots of people following the TWRP install guide seem to get bootloop. I solve that by patching boot with Magisk. Some people recommend installing an old about image.
If you have a backup of boot you can at least restore that if you have problems.
grufty47 said:
But I don't understand how a patched_boot.img can be created from an empty file (boot_a)?
Click to expand...
Click to collapse
Welcome to Unix, where nearly everything is a file.
Hard disk? /dev/sda
Partition? /dev/sda1
File? /mnt/sda1/file.txt
In this case, boot_a is a way to access a partition on the phone's flash. Actually a link (shortcut) to /dev/mmcblk0p52. Partition number 53 on flash chip 1. The size can't be seen because it's a device and not a file.
grufty47 said:
I am looking for a command that just returns the boot file rather than expanding it to the full partition.
Click to expand...
Click to collapse
dd is a command to read a device. The partition is 64M big so that's the size of the file. gzip can compress well because the actual image is only 24M big and the rest is empty.
Magisk knows how to do it. A tool called magiskboot but I don't know where it lives or how to run it.
I found this header from magiskboot. It shows how the boot.img is structured.
https://github.com/topjohnwu/Magisk/blob/master/native/jni/magiskboot/bootimg.h
I just did the 10.0.9.0 OTA. I added a section of updating your patched_boot.img (since the Magisk updates I did made my old one useless) and I changed the backup instructions due to changes in Magisk 19. If you know where the stock boot lives before reboot, please let me know.

[Guide][Root Magisk Only][OTA Compatible] Moto G6 Play

* Warranty is void
* I'm not responsible for any damage to your phone in mistaking anything specified here
* This guide requires intermediate knowledge
I'm posting this guide because I haven't found any special thread about it, and had to search multiple threads and websites to get a conclusion in how to root Magisk only (without flashing TWRP or any other custom recovery). Focused in not decrypting the phone, or modify any system partition for a full OTA compatibility.
Requirements:
* ADB/Fastboot & Motorola USB drivers installed - (PC)
* Unlocked bootloader - (Phone)
* Stock rom - (Phone)
* Magisk Manager (latest stable version installed on your phone)
* TWRP (compatible to the Moto G6 Play model) - please refer to this thread for more details. ***(Of course, you won't flash it!)
*** PLEASE! REFER TO THE UPDATES BELOW!!! ***
Tutorial:
1. Reboot to bootloader
2. Boot into downloaded TWRP using Fastboot code:
Code:
fastboot boot twrp_downloaded.img
(on TWRP ignore any password by canceling)
3. Backup stock boot image using:
Code:
adb pull /dev/block/platform/soc/7824900.sdhci/by-name/boot stockboot.img
4. Reboot system using ADB code:
Code:
adb reboot system
5. After rebooted, copy backed up stockboot.img to the phone internal memory
6. Install and open Magisk Manager, click [Instal] > [Install] > [Select and Patch a File] and select stockboot.img on internal memory.
7. After boot image patched, copy magisk_patched.img from phone Download folder to PC
8. Reboot to bootloader and flash magisk_patched.img to phone using Fastboot code:
Code:
fastboot flash boot magisk_patched.img
9. After done, reboot system using fastboot code:
Code:
fastboot reboot
10. All done! Open Magisk Manager and check root! For future OTA updates already rooted with Magisk, I recommend this post: https:// www. the custom droid .com/install-ota-update-rooted-android-device-guide/ - (remove spaces )
[UPDATE 1]
I've noticed that Moto G6 simply forces reboot system before update the device, if we go to restore images in Magisk to try it out tutorial post from 10., it'll simply be removed after that.
Even doing so and going ahead to update the device losing Magisk, and still have to back up once more the new updated boot image and patch it on Magisk following my guide above, I got a bootloop patching the newest OTA with Magisk 20.0 (latest).
After almost losing indefinitely root access, I got it done, downgrading Magisk to 19.3.
For doing so, download Magisk 19.3 zip file from GitHub repository and copy it to the SD Card, boot up into TWRP using fastboot (without flashing) then proceed as read-only, after that, install Magisk 19.3 zip file to patch the OTA updated boot image, then it's done. Root it's working properly without updating Magisk.
I don't know exactly why the latest Magisk it is breaking the OTA updated boot image... Whatever, it's a good approach to get root access back after the recent OTA!
I still need to check if this workaround will be working on new OTA's. That's it.
[UPDATE 2]
After recent update - January 2020, my rooting workaround supporting OTA is working properly as followed solution on UPDATE 1, above.
I didn't test using latest Magisk 20.3 apk due the bootloop when patching boot image in Magisk 20. Don't know if that bug has been fixed...
Updating Magisk after successfully rooted using solution above will not result in a bootloop, but I do recommend downgrade Magisk when new OTA is released.
Hello, thank you for this guide. I'm having trouble with the last step, as I also am having a bootloop with the boot image patched with the latest Magisk. Would you care to elaborate on how do I install Magisk 19.3? Since I boot TWRP, but cant find the Downloads folder from the phone, where I put the Magisk-v19.3.zip file. Cheers!
gabardal said:
Hello, thank you for this guide. I'm having trouble with the last step, as I also am having a bootloop with the boot image patched with the latest Magisk. Would you care to elaborate on how do I install Magisk 19.3? Since I boot TWRP, but cant find the Downloads folder from the phone, where I put the Magisk-v19.3.zip file. Cheers!
Click to expand...
Click to collapse
First, if you have the actual boot backup, you'll need to flash it to fix bootloop.
Remember to boot into TWRP (without flashing) to flash it.
* Follow the samples above for the codes if necessary.
After fixing bootloop all you'll need to do is download the Magisk-v19.3.zip from “Magisk GitHub releases” and place it on the external sd card.
Then boot into TWRP (always without flashing) and flash the zip file using TWRP. (Remember to flash to boot image).
It'll simply patch your boot, after that, reboot, if successfully booted go check Magisk.

Magisk/Twrp for GSI (Won't work on stock)

I have a Twrp backup with the boot img patched with Magisk/Twrp boot to recovery boots GSI with magisk boot to recovery hold volume up while rebooting to recovery will boot twrp for this boot img to work u have to be on the vendor of the boot img which is also in the backup so the phone won't bootloop this vendor is modified to work with GSIs pass the magisk environmental setup and notch fix so swiping down is like swiping down on stock.... to implement notch fix go to developer settings hide display cut and choose the first hide option and your notch will be fixed...
Thanks @Spaceminer for the twrp for without this none would of been possible
please note twrp will only boot with a android 9 vendor and your GSI will only boot with magisk and twrrp with the vendor in the backup cause it matches the boot img, GSIs only boot when the vendor and boot img match
the boot img & vendor img in the backup is from Channel/Retail (PPY29. 105-160-4)
Instructions
If on android 9 stock
1. Boot to bootloader
2. fastboot - w
3. fastboot GSI of your choice
4. fastboot boot twrp.img
5. format data
6. Place the twrp folder you downloaded from the zip into your devices internal storage which will be available after u format data
7.Resize system
8.Flash gapps zip if gapps is needed
9.wipe dalvick
10. go to twrp restore boot and vendor
11. reboot to recovery and phone will boot after boot is complete install magisk manager it will do the environmental setup phone will reboot and u will have magisk.... ( if u want the best experience with magisk on this device I recommend that you use havoc cause with the lineage GSI magisk doesn't play nice but with havoc its stable also when making a backup it's boot, system image, vendor image, data if u chose system instead your backup will bootloop your device upon restoration)
Download (twrp img is in twrp folder remove it and place it in ADB folder)
https://mega.nz/file/7t03DLhL#jjS9vgrJMlDS-_-hsApyx4uJ6L8wXCN8HtjSqJrg2ds
if u wanted to do this manually to install the latest canary or stable version magisk need to patch twrp to the recovery flash phh root boot up install magisk manager give it root permissions with phh superuser from apk mirror now with elevated permissions the option patch directly will be avaliable cause u got root (it's the recommended option ?) chose recovery and leave the other 2 unchecked patch the img and reboot to recovery the phone will reboot os with magisk and u hold up while booting recovery will boot twrp after that backup that boot img in twrrp for future installation of the GSI of your choosing....
Hello,
Already figured it out.
Is there any way to flash a Android 10 ROM (treble) without loosing magisk ?
thanks for your help!
xcode22 said:
Hello,
Already figured it out.
Is there any way to flash a Android 10 ROM (treble) without loosing magisk ?
thanks for your help!
Click to expand...
Click to collapse
Everytime u flash a GSI just use the vendor and boot from the twrp folder and your android 10 GSI Will have magisk and twrp no need for data disabler zip cause my backup already has the vendor and boot patches enabled for decryption so twrp will be accessible via boot to recovery
([emoji88]Havoc GSI[emoji88])
Also have edxposed for Android 10 since the one in the repo won't work cause it needs a custom magisk with merged patches for xposed to work on android 10 this version has the patches in the edxposed so having to use a custom magisk won't be an issue cause as ya know obtaining magisk and twrrp in this device was unknown into this OP was made
([emoji88]Havoc GSI[emoji88])
Thanks so much for the instructions, only way i could install on G7 play.
The only thing is I always have to boot in recovery mode to start the system.
If I boot normal it starts again. Any way to solve this ?
I think somehow I flashed my ROM to the recovery partition ?
thank you!!
xcode22 said:
Thanks so much for the instructions, only way i could install on G7 play.
The only thing is I always have to boot in recovery mode to start the system.
If I boot normal it starts again. Any way to solve this ?
I think somehow I flashed my ROM to the recovery partition ?
thank you!!
Click to expand...
Click to collapse
Your on a GSI go in your system settings and activate advance boot and when u have to reboot just put reboot to recovery and you don't have to worry about manually rebooting to recovery everytime u have to reboot also no way u installed the rom to the recovery partion our device doesn't have a recovery partion the recovery lives within the boot img
([emoji88]Havoc GSI[emoji88])]
thanks, not sure if I can do this with my Treble gsi (phhusson).
The other thing is that some things got messed up after instalation for example I cannot put in a passcode for the phone.
Is there no other way to install magisk on the G7 play ?
Maybe this has to do with the vendor and boot beeing different model than mine wich is XT 1952-2 (latin american model)
thanks
xcode22 said:
thanks, not sure if I can do this with my Treble gsi (phhusson).
The other thing is that some things got messed up after instalation for example I cannot put in a passcode for the phone.
Is there no other way to install magisk on the G7 play ?
Maybe this has to do with the vendor and boot beeing different model than mine wich is XT 1952-2 (latin american model)
thanks
Click to expand...
Click to collapse
The reason the lockscreen doesn't work is cause the device is decrypted which is essential for the device to be able to reboot to twrp my vendor has the decryption patches for the full functionality of twrp however if u don't care about twrp and just want magisk just patch a fresh version of your boot img in magisk manager with the patch a file option and fastboot that boot img to your device install fresh GSI with your vendor so it will boot encrypted since your vendor doesn't have the decryption zip patches in the vendor... However with this method to have full functionality with magisk u will have to remove from vendor/bin/init mimi hab if this file isn't removed your magisk won't pass the environmental setup... U be given root privileges with magisk before u have to do the environmental setup so u can remove that file...
([emoji88]Havoc GSI[emoji88])
PoochyX said:
The reason the lockscreen doesn't work is cause the device is decrypted which is essential for the device to be able to reboot to twrp my vendor has the decryption patches for the full functionality of twrp however if u don't care about twrp and just want magisk just patch a fresh version of your boot img in magisk manager with the patch a file option and fastboot that boot img to your device install fresh GSI with your vendor so it will boot encrypted since your vendor doesn't have the decryption zip patches in the vendor... However with this method to have full functionality with magisk u will have to remove from vendor/bin/init mimi hab if this file isn't removed your magisk won't pass the environmental setup... U be given root privileges with magisk before u have to do the environmental setup so u can remove that file...
([emoji88]Havoc GSI[emoji88])
Click to expand...
Click to collapse
Yes I understand, sounds logic. I tried to follow your guide but it didn't work.
I did the following:
1. Followed your first instructions with restore vendor and boot in the end to have magisk twrp (Now on Android 10).
2. patched the boot.img (stock one Android 9) with magisk and pulled via adb on computer
3. fastboot flash boot boot.img (patched)
4. Fastboot flash system gsi.img (android 10)
After that I get a bootloop if I go via normal boot and recovery doesn?t boot either.
In the end I tried to flash the stock vendor.img but everything stayed the same.
Not sure how to remove the file in the /vendor/bin, with twrp ?
xcode22 said:
Yes I understand, sounds logic. I tried to follow your guide but it didn't work.
I did the following:
1. Followed your first instructions with restore vendor and boot in the end to have magisk twrp (Now on Android 10).
2. patched the boot.img (stock one Android 9) with magisk and pulled via adb on computer
3. fastboot flash boot boot.img (patched)
4. Fastboot flash system gsi.img (android 10)
After that I get a bootloop if I go via normal boot and recovery doesn?t boot either.
In the end I tried to flash the stock vendor.img but everything stayed the same.
Not sure how to remove the file in the /vendor/bin, with twrp ?
Click to expand...
Click to collapse
PoochyX on telegram dm me I walk you threw it
([emoji88]Havoc GSI[emoji88])
xcode22 said:
Yes I understand, sounds logic. I tried to follow your guide but it didn't work.
I did the following:
1. Followed your first instructions with restore vendor and boot in the end to have magisk twrp (Now on Android 10).
2. patched the boot.img (stock one Android 9) with magisk and pulled via adb on computer
3. fastboot flash boot boot.img (patched)
4. Fastboot flash system gsi.img (android 10)
After that I get a bootloop if I go via normal boot and recovery doesn?t boot either.
In the end I tried to flash the stock vendor.img but everything stayed the same.
Not sure how to remove the file in the /vendor/bin, with twrp ?
Click to expand...
Click to collapse
The easiest way I know of is from the stock OS using termux and root.
Code:
su
setenforce 0
mkdir /mnt/x && chmod 0755 /mnt/x
mount -o loop /dev/block/by-name/vendor_a /mnt/x
Now navigate to /mnt/x and everything from vendor will be in there. Find the file and delete it with a root explorer. Then unmount the partition and the changes will be permanent. Doing it this way gets around FEC, which is what prevents you from changing anything in vendor.
Code:
umount /mnt/x
If you need to work on the other vendor partition just change out vendor_a with vendor_b
Any recommendation about what GSI to choice for XT1952-6 variant?
mickem said:
Any recommendation about what GSI to choice for XT1952-6 variant?
Click to expand...
Click to collapse
Chaos GSI Bluetooth works without disabling audio effects (so u can use viper with bluetooth headset) it's clean stock with minimum stuff added to it and works with gravitybox then you got havoc that has the majority of stuff gravity has off the rip so it's not as minimum so more memory usage is needed and Bluetooth only works with the phh disable audio effects work around also magisk works good on both of these lineage is good also if you don't care about magisk working cause with our device magisk has issues on lineage don't know if it was fixed on a recent bulid however if lineage is your preference there is a phh root for it so u can be functional
([emoji88]Havoc GSI[emoji88])
My device is xt1952-4. I downloaded the latest firmware (PPYS29-105-160-4-8), and installed it to both slots. I am currently using Resurection Remix Pie. Is your patched boot.img and vendor compatible with the newer firmware or will I get a downgrade error?

[GUIDE] Pixel 5 "redfin": Unlock Bootloader, Update, Root, Pass SafetyNet

If you are looking for my guide on a different Pixel, find it here:
Pixel 3
Pixel 3XL
Pixel 3a
Pixel 3aXL
Pixel 4
Pixel 4XL
Pixel 4a
Pixel 4a (5G)
Pixel 5a
Pixel 6
Pixel 6 Pro
For best results, use the latest stable Magisk release.
Discussion thread for migration to 24.0+.
Note: Magisk prior to Canary 23016 does not incorporate the necessary fixes for Android 12+.
WARNING: YOU AND YOU ALONE ARE RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOUR DEVICE. THIS GUIDE IS WRITTEN WITH THE EXPRESS ASSUMPTION THAT YOU ARE FAMILIAR WITH ADB, MAGISK, ANDROID, AND ROOT. IT IS YOUR RESPONSIBILITY TO ENSURE YOU KNOW WHAT YOU ARE DOING.
Prerequisites:
Latest SDK Platform Tools - if Platform Tools is out of date, you WILL run into problems!
USB Debugging enabled
Google USB Driver installed
I recommend using Command Prompt for these instructions; some users have difficulty with PowerShell.
Make sure the Command Prompt is running from your Platform Tools directory!
Android Source - Setting up a device for development
Spoiler: Downloads
Pixel OTA Images
Pixel Factory Images
Magisk Stable, Magisk Canary - Magisk GitHub
Spoiler: Unlock Bootloader
Follow these instructions to enable Developer Options and USB Debugging.
Enable OEM Unlocking. If this option is grayed out, unlocking the bootloader is not possible.
Connect your device to your PC, and open a command window in your Platform Tools folder.
Ensure ADB sees your device:
Code:
adb devices
If you don't see a device, make sure USB Debugging is enabled, reconnect the USB cable, or try a different USB cable.
If you see "unauthorized", you need to authorize the connection on your device.
If you see the device without "unauthorized", you're good to go.
Reboot to bootloader:
Code:
adb reboot bootloader
Unlock bootloader: THIS WILL WIPE YOUR DEVICE!
Code:
fastboot flashing unlock
Select Continue on the device screen.
Spoiler: Initial Root / Create Master Root Image
Install Magisk on your device.
Download the factory zip for your build.
Inside the factory zip is the update zip: "device-image-buildnumber.zip". Open this, and extract boot.img
Copy boot.img to your device.
Patch boot.img with Magisk: "Install" > "Select and Patch a File"
Copy the patched image back to your PC. It will be named "magisk_patched-23xxx_xxxxx.img". Rename this to "master root.img" and retain it for future updates.
Reboot your device to bootloader.
Flash the patched image:
Code:
fastboot flash boot <drag and drop master root.img here>
Reboot to Android. Open Magisk to confirm root - under Magisk at the top, you should see "Installed: <Magisk build number>
Spoiler: Update and Root Automatic OTA
Before you download the OTA, open Magisk, tap Uninstall, then Restore Images. If you have any Magisk modules that modify system, uninstall them now.
Take the OTA update when prompted. To check for updates manually, go to Settings > System > System Update > Check for Update
Allow the update to download and install. DO NOT REBOOT WHEN PROMPTED. Open Magisk, tap Install at the top, then Install to inactive slot. Magisk will then reboot your device.
You should now be updated with root.
Spoiler: Update and Root OTA Sideload
Download the OTA.
Reboot to recovery and sideload the OTA:
Code:
adb reboot sideload
Once in recovery:
Code:
adb sideload ota.zip
When the OTA completes, you will be in recovery mode. Select "Reboot to system now".
Allow system to boot and wait for the update to complete. You must let the system do this before proceeding.
Reboot to bootloader.
Boot the master root image (See note 1):
Code:
fastboot boot <drag and drop master root.img here>
Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
Reboot your device. You should now be updated with root.
Note: You can use Payload Dumper to extract the contents of the OTA if you want to manually patch the new boot image. However, I will not cover that in this guide.
Spoiler: Update and Root Factory Image
Please note that the factory update process expects an updated bootloader and radio. If these are not up to date, the update will fail.
Download the factory zip and extract the contents.
Reboot to bootloader.
Spoiler: Update bootloader if necessary
Compare bootloader versions between phone screen and bootloader.img build number
Code:
fastboot flash bootloader <drag and drop new bootloader.img here>
If bootloader is updated, reboot to bootloader.
Spoiler: Update radio if necessary
Compare baseband versions between phone screen and radio.img build number
Code:
fastboot flash radio <drag and drop radio.img here>
If radio is updated, reboot to bootloader.
Apply update:
Code:
fastboot update --skip-reboot image-codename-buildnumber.zip
When the update completes, the device will be in fastbootd. Reboot to bootloader.
Boot the master root image (See note 1):
Code:
fastboot boot <drag and drop master root.img here>
Note: If you prefer, you can manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
Reboot your device. You should now be updated with root.
Note: If you prefer, you can update using the flash-all script included in the factory zip. You will have to copy the script, bootloader image, radio image, and update zip into the Platform Tools folder; you will then have to edit the script to remove the -w option so it doesn't wipe your device.
The scripted commands should look like this:
Code:
fastboot flash bootloader <bootloader image name>
fastboot reboot bootloader
ping -n 5 127.0.0.1 > nul
fastboot flash radio <radio image name>
fastboot reboot bootloader
ping -n 5 127.0.0.1 > nul
fastboot update --skip-reboot <image-device-buildnumber.zip>
Once this completes, you can reboot to bootloader and either boot your master patched image, or if you patched the new image, flash it at this time.
Spoiler: Update and Root using PixelFlasher <<RECOMMENDED FOR NOVICES>>
PixelFlasher by @badabing2003 is an excellent tool that streamlines the update process - it even patches the boot image for you.
The application essentially automates the ADB interface to make updating and rooting much easier. However, it is STRONGLY recommended that you still learn the "basics" of using ADB.
For instructions, downloads, and support, please refer to the PixelFlasher thread.
Spoiler: Update and Root using the Android Flash Tool
Follow the instructions on the Android Flash Tool to update your device. Make sure Lock Bootloader and Wipe Device are UNCHECKED.
When the update completes, the device will be in fastbootd. Reboot to bootloader.
Boot the master root image (See note 1):
Code:
fastboot boot <drag and drop master root.img here>
Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
Reboot your device. You should now be updated with root.
Spoiler: Pass SafetyNet/Play Integrity
SafetyNet has been deprecated for the new Play Integrity API. More information here.
In a nutshell, Play Integrity uses the same mechanisms as SafetyNet for the BASIC and DEVICE verdicts, but uses the Trusted Execution Environment to validate those verdicts. TEE does not function on an unlocked bootloader, so legacy SafetyNet solutions will fail.
However, @Displax has modified the original Universal SafetyNet Fix by kdrag0n; his mod is able to force basic attestation instead of hardware, meaning that the device will pass BASIC and DEVICE integrity.
Mod available here. Do not use MagiskHide Props Config with this mod.
This is my configuration that is passing Safety Net. I will not provide instructions on how to accomplish this. Attempt at your own risk.
Zygisk + DenyList enabled
All subcomponents of these apps hidden under DenyList:
Google Play Store
GPay
Any banking/financial apps
Any DRM media apps
Modules:
Universal SafetyNet Fix 2.3.1 Mod - XDA post
To check SafetyNet status:
YASNAC - GitHub
To check Play Integrity status:
Play Integrity Checker - NOTE: MEETS_STRONG_INTEGRITY will ALWAYS fail on an unlocked bootloader.
I do not provide support for Magisk or modules. If you need help with Magisk, here is the Magisk General Support thread. For support specifically with Magisk v24+, see this thread.
Points of note:
The boot image is NOT the bootloader image. Do not confuse the two - YOU are expected to know the difference. Flashing the wrong image to bootloader could brick your device.
While the Magisk app is used for patching the boot image, the app and the patch are separate. This is what you should see in Magisk for functioning root:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
"Installed" shows the version of patch in the boot image. If this says N/A, you do not have root access - the boot image is not patched, or you have a problem with Magisk.
"App" simply shows the version of the app itself.
If you do not have a patched master boot image, you will need to download the factory zip if you haven't already, extract the system update inside it, then patch boot.img.
If you prefer updating with the factory image, you can also extract and manually patch the boot image if desired.
Some Magisk modules, especially those that modify read only partitions like /system, may cause a boot loop after updating. As a general rule, disable these modules before updating. You are responsible for knowing what you have installed, and what modules to disable.
Credits:
Thanks to @badabing2003 , @pndwal , @Displax , @Az Biker , @ipdev , @kdrag0n , @Didgeridoohan , and last but not least, @topjohnwu for all their hard work!
V0latyle said:
As many of you know by now, in order to run a patched boot image on Android 12 requires disabling Android Boot Verification.
On Android 12, disabling verity and verification will require a data wipe if it hasn't been done before. What seems to "lock" the state of boot verification is booting into system; so, if you perform an update, or flash vbmeta without the disable flags, then reboot into Android, you have essentially enabled boot verification and will require a wipe to disable it again. Confusing, I know.
Here is the appropriate update process. DO NOT take the automatic OTA if you are rooted. If you allow the phone to reboot after an update without disabling boot verification, you will have to wipe in order to disable it again, as you would need to for a patched boot image.
***Note***: The boot image doesn't have to be patched before you perform the update. Some have found it works better to update, THEN patch the boot image.
OTA Sideload:
1. Download both the OTA and the factory zip.
2. Extract vbmeta.img and boot.img from the factory zip.
3. Patch the boot image and copy it back to your computer.
4. Reboot to recovery and sideload the OTA: select Apply Update via ADB, then on your PC:
Code:
adb sideload ota.zip
5. When the OTA completes, you will be in recovery mode. DO NOT REBOOT TO SYSTEM. Select "Reboot to bootloader".
6. Reflash vbmeta to disable boot verification:
Code:
fastboot flash vbmeta --disable-verity --disable-verification --slot=all vbmeta.img
7. Flash patched boot image:
Code:
fastboot flash boot --slot=all magisk_patched-23xxx_xxxxx.img
8. Reboot to system.
Factory update:
1. Download the factory zip.
2. Extract boot.img
3. Patch the boot image and copy it back to your computer.
4. Reboot to bootloader.
5. Apply update:
Code:
fastboot update --disable-verity --disable-verification --skip-reboot image-codename-buildnumber.zip
6. Flash patched boot image:
Code:
fastboot flash boot --slot=all magisk_patched-23xxx_xxxxx.img
7. Reboot to system.
Android Flash Tool:
1. Download the factory zip.
2. Extract boot.img
3. Patch the boot image and copy it back to your computer.
4. Reboot to bootloader.
5. Follow the instructions on the Android Flash Tool to update your device. The ONLY boxes you should check are "Disable Verity" and "Disable Verification"
6. When the update completes, the phone will reboot to system without root.
7. Reboot to bootloader and flash patched boot image:
Code:
fastboot flash boot --slot=all magisk_patched-23xxx_xxxxx.img
8. Reboot to system.
REMEMBER: The most critical part of this is making sure verity and verification are disabled during the update process before the phone reboots. If you forget to patch the boot image, that's OK - you don't have to flash /boot right after update.
If you have trouble with the patched boot image, simply flash /boot back to stock and allow Android to boot, then re-patch and re-flash the boot image.
You can also, if you want, boot the patched image instead of flashing it:
Code:
fastboot boot magisk_patched-23xxx_xxxxx.img
This is considered "temporary boot" as it loads the image from your PC rather than from device storage. You can use this to confirm root works, and if you so desire, you can then perform Direct Install in Magisk.
Click to expand...
Click to collapse
You Sir are all over these forums spreading helpful advice, and knowledge. I would just like to say Thank You for all you do here. It's so greatly appreciated. You are one of the many people who make this place so special.
Also, Thank You for your service to our country.
@V0latyle can you link me to a web page that would list every adb and fastboot command that we as android modders would use. What I mean is I couldn't find a Google search that listed the fastboot command with --slot=all among other adb and fastboot commands
Krsmqn said:
You Sir are all over these forums spreading helpful advice, and knowledge. I would just like to say Thank You for all you do here. It's so greatly appreciated. You are one of the many people who make this place so special.
Also, Thank You for your service to our country.
Click to expand...
Click to collapse
I agree with @Krsmqn, @V0latyle THANK YOU FOR YOUR SERVICE !!!!! in the military and for your service in the xda community
I used the Android Flash Tool method to update to the November build, and followed the instructions precisely. It worked flawlessly. My deny list is exactly the same in Magisk, and all my modules are working perfectly. I didn't even have to disable them. I think I will use this method from now on.
Krsmqn said:
You Sir are all over these forums spreading helpful advice, and knowledge. I would just like to say Thank You for all you do here. It's so greatly appreciated. You are one of the many people who make this place so special.
Also, Thank You for your service to our country.
Click to expand...
Click to collapse
elong7681 said:
I agree with @Krsmqn, @V0latyle THANK YOU FOR YOUR SERVICE !!!!! in the military and for your service in the xda community
Click to expand...
Click to collapse
Thanks guys, I appreciate it.
elong7681 said:
@V0latyle can you link me to a web page that would list every adb and fastboot command that we as android modders would use. What I mean is I couldn't find a Google search that listed the fastboot command with --slot=all among other adb and fastboot commands
Click to expand...
Click to collapse
Boy, I wish I had that handy, because I could sure use it too! I don't have your answer but hopefully someone else does, because believe me I'll be bookmarking it!
Will this work on Android Pixel 5a?
Rafiul Bari Chowdhury said:
Will this work on Android Pixel 5a?
Click to expand...
Click to collapse
Yes. The root process is exactly the same for the 4a 5g, 5, and 5a. The update process is the same across all Pixel devices.
I patched the boot.img. Magisk 23 did not report errors. But size of the patched file is zero. This looks not promising...
nostromo12 said:
I patched the boot.img. Magisk 23 did not report errors. But size of the patched file is zero. This looks not promising...
Click to expand...
Click to collapse
What version of Magisk did you use?
The stabil one
Will this work on Android Pixel 5a?
V0latyle said:
Yes. The root process is exactly the same for the 4a 5g, 5, and 5a. The update process is the same across all Pixel devices.
Click to expand...
Click to collapse
Okay. But Should I Remove Magisk Fully before upgrading through ADB/Fastboot/AFT?
H,
I'm on Android 11 pixel 5, can I use this tutorial ?
I think it's safer to unroot/remove Magisk and modules when going from 11 to 12 right? Some modules might not be compatible with 12 causing bootloops.
thecompany said:
I think it's safer to unroot/remove Magisk and modules when going from 11 to 12 right? Some modules might not be compatible with 12 causing bootloops.
Click to expand...
Click to collapse
You're going to have to wipe /data anyway if you intend to root on Android 12. Unless you're willing to try an idea I have.
Thanks V0latyle !!
I follow the flash tool method for update from october to november on my pixel 5
Perfect update, no issues and all data ok
nico22320 said:
Thanks V0latyle !!
I follow the flash tool method for update from october to november on my pixel 5
Perfect update, no issues and all data ok
Click to expand...
Click to collapse
Did you use Magisk canary? It is not necessary to check wipe in the android flash tool?
I use standard Magisk and can not change the update path to canary
nostromo12 said:
Did you use Magisk canary? It is not necessary to check wipe in the android flash tool?
I use standard Magisk and can not change the update path to canary
Click to expand...
Click to collapse
No i use the beta version of magisk.
You need wipe only for update from Android 11 to Android 12.
Just follow the guide for update to november and enjoy
nico22320 said:
No i use the beta version of magisk.
You need wipe only for update from Android 11 to Android 12.
Just follow the guide for update to november and enjoy
Click to expand...
Click to collapse
I want to upgrade from 11 (oktober) to 12
In the first message from this thread concerning the flash tool there was no wipe mentioned.
I want to update keeping my data ! How to proceed?
The best way: save yours photos etc with your Google account and make a fresh install with Factory image on Android 12 ( with disable verity and vérification)
It's long for set up device but 100% of chance of work with no issues for futurs update
Sûre you Can try to update without wipe and disable verity and vérification but maybe bootloops or not

Categories

Resources