In this guide, we will show you the steps to fix the bootloop issue after flashing the magisk_patched.img file. Rooting is considered an absolute necessity when it comes to gaining administrative privileges or getting access to the system partition. In this regard, there are two different methods that you could take, both of which involve the use of the Magisk App (as is now known as, beginning with version 22).
The first method is a pretty straightforward one, you only need to flash the Magisk ZIP via TWRP and your device stands rooted. However, not every device has a working TWRP. Likewise, some users prefer to keep a safe distance from flashing this custom recovery due to the complexity involved (especially after the A/B vs A partition change). All these reasons combined, users generally flock over to the second method.
This involves extracting the boot.img from the stock firmware, patch it via Magisk and flash it via Fastboot Commands. While it involves quite a few steps but is a tried and tested method. With that said, it isn’t free from its fair share of issues as well. One among them is when the user ends up in a bootloop after flashing the magisk_patched.img file. If you are also getting bugged with this issue, then this guide is here to help you out. Follow along.
- How to Fix All ADB and Fastboot Errors
- How to Flash Stock and Magisk Patched Boot.img via TWRP
- Fix Magisk Module Bootloop without TWRP Recovery
The Reason for Bootloop after flashing Magisk Patched Boot.img File
So why does this issue arises in the first place? Well, it happens when the boot partition on your device gets corrupted. And one of the major reasons for the same is when you have patched and flashed the incorrect build of boot.img. Always remember that you need to use the stock boot.img file that corresponds to the current build number of your device.
In other words, you should download the same firmware version that is currently installed onto your device. If you don’t do so but rather try out the rooting using an older or newer build of the stock firmware, then the issue is imminently bound to happen. So with this, you would have got a perfect idea regarding the reason for this issue. Let’s now check out the steps to fix the bootloop after flashing the magisk_patched.img file.
How to Fix Bootloop after Flashing magisk_patched.img
The below instructions are listed under separate sections for ease of understanding. Make sure to follow in the exact same sequence as mentioned below. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.
Download Stock Firmware
To begin with, download the stock firmware for your device. Make sure to download the same version that is currently installed on your device. You may verify the same by going to the About Phone section of your device.
Extract Stock Firmware
Once downloaded, extract it to any convenient location on your PC. While some OEMs pack their firmware in ZIP/RAR/TGZ format and you could easily extract it via WinRAR. On the other hand, OnePlus have it inside payload.bin, LG in KDZ/DZ, and Oppo and Realme have it in OZIP. So you may refer to the below guides if you own any of these devices.
- How to Extract OZIP Realme Stock ROM (Firmware)
- How to Extract Boot.img from LG KDZ or DZ Firmware
- Guide to Extract OnePlus payload.bin and get the stock boot image file
Install Android SDK
Next up, install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform-tools folder.
- How to Fix Bootloop in A/B Partition Android Devices
- Fix FAILED (remote: ‘Slot Change is not allowed in Lock State’)
- How to Fix OnePlus Bootloop issue on Locked Bootloader
Boot Bootloop Device to Fastboot Mode
You will now have to boot your device to Fastboot Mode. Since the device is in a bootloop. you wouldn’t be able to use the adb reboot bootloader. So you would have to use the hardware key combinations for the same.
While there are no universal combinations as such, most devices follow the pattern of powering off the device and then pressing and holding the Volume Down Keys (if that doesn’t work out, then you may try with the Volume Up key as well). Once done, let’s now move over to the final step of this guide to fix the bootloop after flashing magisk_patched.img.
Flash Stock Boot.img to Fix magisk_patched.img Bootloop
- Transfer the stock boot.img file to the platform-tools folder on your PC.
- Now connect your device to the PC via USB cable.
- Head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
- Now if your device is A-only single slot (i.e. if you have flashed the magisk_patched boot.img to only one slot), then type in the below command to flash the stock boot.img file:
fastboot flash boot boot.img
- On the other hand, if your device is dual partition A/B (i.e. if you have flashed the magisk_patched boot.img to both the slots), then you will have to flash the stock boot.img to both the slots, via the following two commands:
fastboot flash boot_a boot.img fastboot flash boot_b boot.img
- Once that is flashed, you may now reboot the device to the OS via the following command:
- This should boot the device to the OS. However, if that doesn’t happen and your device is still stuck in a bootloop, then you would have to flash the entire stock firmware via Fastboot. For that, please refer to our guide to Flash Stock Firmware via Fastboot Commands.
So this was all from this guide on how to fix the bootloop issue after flashing the magisk_patched.img file. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.