[GUIDE][WIN10] Bootloader Unlock/Re-Lock, Rooting with Magisk and flashing Firmwares

Search This thread

suntanfrodo

New member
Feb 8, 2021
3
0
11
I followed the guide step by step and my phone is now stuck in a bootloop.

I have a XQ-AS52 with firmware 58.1.A.1.178 (Customized EEA). Here is what I did:
- I already had USB debugging and OEM unlock enabled
- I followed the OP's guide to a T (with Magisk beta channel and all that)
- I flashed the magisk_patched.img to both partitions a an b in fastboot
- At this point, I had not used the Newflasher tool at all
- When I finished flashing the images, I got "Your device can't be checked for corruption. Please lock your bootloader"
- That repeated a few times and then it showed "Your device is corrupt. It can't be trusted and will not boot. Your device will be powered off in 5 seconds"
- To get out of that bootloop, I used the firmware boot_XXX.img file (that i got from the XperiFirm and Unsin tools) and flashed it in fastboot mode. However, I did not specify any partition, and just wrote "fastboot flash boot_XXX.img" and it showed that it was flashing that to partition b.
- The phone did boot up afterwards but still showed the "Your device can't be checked for corruption. Please lock your bootloader" message
- I allowed the USB debugging again (but could not find the OEM unlock in the Developer options because I guess the bootloader was already unlocked)
- I pasted the Newflasher files in the folder of the firmware downloaded by the XperiFirm tool
- I turned off the phone and put it in flash mode
- I ran the newflasher.exe file as admin and did "f, n, n, y" (fastboot, no, no, yes)
- But now my device is in bootloop again with the same messages as above and won't power up.
- Even if I redo the step of flashing the boot_XX.img file in fastboot mode, it still shows the same error.

I have Android 11 by the way (if that helps) and a previous user said to use another method than magisk as it is not currently working with Android 11 (which I, unfortunately, did not do).

Can anyone please help?

EDIT: I managed to get my phone out of the bootloop and it is working now. But it still unrooted and I guess I won't try rooting it again until we have experience trying to root Android 11, especially with Xperia 5 ii.

This is what I did to get my phone out of the bootloop:
- I installed the Sony Companion app and chose to repair the phone
- I do not know how much battery I had but I guess it was enough for the Sony Companion app to work
- The app would not work with an unlocked bootloader. So you have to boot into fastboot mode and lock the bootloader again.
- The app would guide you for the next steps. Basically, it would ask you to turn off the phone, disconnect it from the computer, choose repair in the app, boot into flash mode by pressing the volume down button while plugging in the cable
- if everything is fine (it was in my case), the companion app would reflash the phone with the original firmware and it should boot up normally again.

So my phone is back to operational right now, albeit with bootloader locked and unrooted
 
Last edited:

doggydog2

Senior Member
Jul 2, 2007
583
218
73
Samsung Galaxy S10
OnePlus 8 Pro
Negative guy is right, rooting was easy back in the day.. i have my 10y old files here for such phones as S Plus, Note 2 (didn't root earlier decade of HTC phones) and it was as easy as flashing one file:)
Last 3-4 years it got difficult unless you have OnePlus or Google device. For these phones, there's just few UI clicks to upgrade, and no tracking of IMEI.
But I will root til i die, so many benefits.. I switch between ~4 flagships a year, and I have hundreds of apps in the exact state on each phone. And the Magisk, Xposed plugins are so necessary..
Having said that, is Xperia5ii ok to upgrade to new firmwares? The OP says data is lost on each update, but some guys encourage otherwise.
 

Bellitsch89

Senior Member
Aug 28, 2012
795
292
98
32
Duisburg
I followed the guide step by step and my phone is now stuck in a bootloop.

I have a XQ-AS52 with firmware 58.1.A.1.178 (Customized EEA). Here is what I did:
- I already had USB debugging and OEM unlock enabled
- I followed the OP's guide to a T (with Magisk beta channel and all that)
- I flashed the magisk_patched.img to both partitions a an b in fastboot
- At this point, I had not used the Newflasher tool at all
- When I finished flashing the images, I got "Your device can't be checked for corruption. Please lock your bootloader"
- That repeated a few times and then it showed "Your device is corrupt. It can't be trusted and will not boot. Your device will be powered off in 5 seconds"
- To get out of that bootloop, I used the firmware boot_XXX.img file (that i got from the XperiFirm and Unsin tools) and flashed it in fastboot mode. However, I did not specify any partition, and just wrote "fastboot flash boot_XXX.img" and it showed that it was flashing that to partition b.
- The phone did boot up afterwards but still showed the "Your device can't be checked for corruption. Please lock your bootloader" message
- I allowed the USB debugging again (but could not find the OEM unlock in the Developer options because I guess the bootloader was already unlocked)
- I pasted the Newflasher files in the folder of the firmware downloaded by the XperiFirm tool
- I turned off the phone and put it in flash mode
- I ran the newflasher.exe file as admin and did "f, n, n, y" (fastboot, no, no, yes)
- But now my device is in bootloop again with the same messages as above and won't power up.
- Even if I redo the step of flashing the boot_XX.img file in fastboot mode, it still shows the same error.

I have Android 11 by the way (if that helps) and a previous user said to use another method than magisk as it is not currently working with Android 11 (which I, unfortunately, did not do).

Can anyone please help?

I had the same Problem with Android 11.
I have tried very often with Android 11 but IT doesnt works. With Android 10 IT works but I cant change any System files, like delete System Apps or change "normal" Apps like nova launcher to a System-App.
 

suntanfrodo

New member
Feb 8, 2021
3
0
11
I had the same Problem with Android 11.
I have tried very often with Android 11 but IT doesnt works. With Android 10 IT works but I cant change any System files, like delete System Apps or change "normal" Apps like nova launcher to a System-App.

How did you recover your phone when you encountered that problem?

I cannot get my phone out of that bootloop
 

Bellitsch89

Senior Member
Aug 28, 2012
795
292
98
32
Duisburg
I have locked the bootloader, then I have flashed android 10 and then I have made a repair with xperia companion. You can load the battery with the original Sony Power Adapter. IT will bootloop every time but IT will load.
You must at the right Moment press the volume down or up and connect to PC then you can Flash and lock the bootloader.

I hope you unterstand me because my Englisch is Not the yellow from the egg 😅

Edit: in this thread
I have found the solution. The last 3 or 4 replies has help me.
 
Last edited:

suntanfrodo

New member
Feb 8, 2021
3
0
11
I have locked the bootloader, then I have flashed android 10 and then I have made a repair with xperia companion. You can load the battery with the original Sony Power Adapter. IT will bootloop every time but IT will load.
You must at the right Moment press the volume down or up and connect to PC then you can Flash and lock the bootloader.

I hope you unterstand me because my Englisch is Not the yellow from the egg 😅

Edit: in this thread
I have found the solution. The last 3 or 4 replies has help me.

It worked! Danke dir 😅
 

BlackSalami

Member
Feb 7, 2017
31
10
8
I ****ed up somewhere and had to use the Xperia companion app to repair the phone after being stuck. But now my device is on Android 11 and I'm unsure if this tutorial will work or even serve a purpose now that I've learned Magisk is not working properly on android versions past 10. I'm too scared of bricking my device so I guess I'll give up on fully owning this one
 

Thelemic

New member
Aug 3, 2013
2
0
21
So I searched far and wide but there's no option to backup the DRM keys for the 5 II yet, correct? I'll probably have no use for it but still.
 

NoroXX

Member
Feb 22, 2019
5
0
1
Hi - step 27 tells me that the .img is too big to download .... what about that?
 

Attachments

  • chyba.jpg
    chyba.jpg
    22.2 KB · Views: 12

reclaimerog

New member
Mar 16, 2021
1
0
11
I'm having the absolute worst time trying to root my sony xperia 5 ii.
I have the USA variant XQ-AS62 build number 58.0.A.28.51
I do NOT want to move to android 11, im still stuck nearly at the begining of the entire process
when i look at xperiafirm its only offering me the a11 update which i dont want to do. if anyone is kind enough to please help me out via voice or chat ill gladly compensate you with 125 bucks when we are finished. I'm not completely illiterate when it comes to things like this but its been a long while. my email is [email protected] message me there then we can figure out discord or phone call. thank you guys.
 

AgashU

Member
Aug 27, 2015
9
1
23
EDIT: Realised this has been posted in the rom section by fengmubai here:

If anyone has the XQ-AS72 (Hong Kong) Xperia 5 II on software version 58.1.A.3.87, I have uploaded the fixed boot image patched with magisk as there are problems when flashing magisk on Android 11.
Link:

Works well on my device, but please make sure you have the correct variant and software version before flashing.
 
Last edited:

NoroXX

Member
Feb 22, 2019
5
0
1
Hello. Has anyone managed to root the Xperia 5 ii XQ-AS52? I tested the procedure repeatedly /with build 58.1.A.5.55 and 58.1.A.3.87/ The result is always the same - bootlop The new .img is not loading ... Can't anyone advise what to do with it?
 

b0r000

New member
Dec 29, 2013
2
0
21
@Miustone Have you tried that on Android 11?
Soft version 58.1.A.5.55 to be specific. I've tried that yesterday and it was epic fail. Not sure what went wrong.
Phone ended up in bootloop but luckily Xperia Companion was able to revive it to "factory" state.
I've looked around how's the state of rooting Android 11 looks now (I'm quite outdated when it comes to modding phones) but it seems it was taken care in Magisk 21.0. So I'm really lost what could go wrong?
 

Miustone

Senior Member
Jul 23, 2012
2,936
5,726
203
27
Marburg an der Lahn
sites.google.com

robi101012981

Senior Member
Dec 2, 2020
114
15
28
Bucharest, Romania
Sony Xperia 5 II
Hello, I just got my 5 II and I would like to root it, but I do have some questions.. Right now I'm on Android 11 and I would like to if rooting it's possible, because, as I've read here, rooting it's more difficult on android 11 than on 10. If I'm rooting, can I still receive OTA updates or I'm stuck on that certain version?
 

rayman2k1

Senior Member
Aug 29, 2011
95
20
28
Thank you for the guide!!

Got my AS72 shipped from HK this week and did both the OTA updates to bring me to Android 11.

Followed the guide (boy has it been long since I've done a bootloader/recovery/rom replacement) but ended up with a bootloop. It seems that Magisk cannot patch the 58.1.A.3.87 properly.

I was able to resolve the bootloop by getting into the bootloader (Vol+, plug in USB) and just doing
Code:
fastboot flash boot_a <unpatched boot.img from XperiFirm+UNSIN>
fastboot flash boot_b <unpatched boot.img from XperiFirm+UNSIN>

So, now this puppy is sitting with the latest firmware, but with an unmodded bootloader (essentially where it was after the fastboot oem unlock step).

Will do some more digging to see if there are any updates to the Magisk/Android 11 situation. If anyone has cracked this nut, I'd appreciate any and all help!

EDIT: Wow, I can't read. Looks like @AgashU has posted a patched bootloader. I will try this now!
EDIT2: Thanks to @AgashU for pointing me to this thread where I downloaded the patched Magisk-patched partition.
 
Last edited:

robi101012981

Senior Member
Dec 2, 2020
114
15
28
Bucharest, Romania
Sony Xperia 5 II
Thank you for the guide!!

Got my AS72 shipped from HK this week and did both the OTA updates to bring me to Android 11.

Followed the guide (boy has it been long since I've done a bootloader/recovery/rom replacement) but ended up with a bootloop. It seems that Magisk cannot patch the 58.1.A.3.87 properly.

I was able to resolve the bootloop by getting into the bootloader (Vol+, plug in USB) and just doing
Code:
fastboot flash boot_a <unpatched boot.img from XperiFirm+UNSIN>
fastboot flash boot_b <unpatched boot.img from XperiFirm+UNSIN>

So, now this puppy is sitting with the latest firmware, but with an unmodded bootloader (essentially where it was after the fastboot oem unlock step).

Will do some more digging to see if there are any updates to the Magisk/Android 11 situation. If anyone has cracked this nut, I'd appreciate any and all help!

EDIT: Wow, I can't read. Looks like @AgashU has posted a patched bootloader. I will try this now!
EDIT2: Thanks to @AgashU for pointing me to this thread where I downloaded the patched Magisk-patched partition.
What about AS52?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    The Problem is explained here :
    Let's hope for a fix asap...
  • 10
    YOUR BOOTLOADER NEEDS TO BE/GET UNLOCKED. YOU CAN'T CONTINUE HERE OTHERWISE....
    Please make sure You know what that means! HINT:
    The Devices Hardware and Software Features can all be restored after re-locking except for the Device Key.
    More about that at the very bottom of the Thread...


    What You will need:
    Windows 10 (With USB Access)
    Xperia Bootloader Unlock Key (From HERE)
    Platform Tools alias Fastboot/ADB (From HERE)
    Fastboot and Flashmode Drivers (From HERE)
    XperiFirm (From XDA)
    NewFlasher (From XDA)
    Unsin (From XDA)
    Magisk Manager (GitHub)
    A working Android System
    A Backup of Your Internal Devices Storage (Maybe!?)


    Let's start...
    1. Download the Drivers and install them with disabled Driver Signature Enforcement. To do so:
    2. Press and hold down the Shift key while you click the “Restart” Option in Windows 10 to do a advanced Restart
    3. Select the “Troubleshoot” Option, followed by the advanced Options and Select Startup Settings
    4. Click on Restart and select Option "7) Disable driver signature enforcement"
    5. Once back in Windows, Install the Fastboot and Flashmode Drivers
    6. Reboot Windows once more and You're prepared to flash Firmwares and to use Fastboot/ADB
    7. Download XperiFirm from XDA and extract it somewhere
    8. Download UnSin from XDA and extract it somewhere
    9. Download the Platform Tools (Fastboot/ADB) from Google and extract it to the root of Your Windows Drive
    10. Download the correct Firmware for Your Device Model with XperiFirm
    11. Download NewFlasher from XDA and extract it to Your Firmware Folder
    12. Download and install the Magisk Manager on Your Xperia Device
    13. Extract the File boot_********.sin with the Unsin Exe (Drag and drop the Image on the Exe)
    14. You will get a .img File which You can patch now with the Magisk Manager on Your Xperia
    15. Open the Magisk Manager and go into the Settings. Tap on the Update Channel and Select the Beta Channel
    16. Go back to the Main Page of Magisk and install Magisk by selecting the Image File You just got from UnSin
    17. Copy the magisk_patched.img in /download from Your Device to the Platform Tools Folder
    18. Grab Your Device again, go to "About Phone" in the Settings and tap several Times on the build Version
    19. Go now to the Developer Settings under "System" and enable "OEM-Unlock" and "USB-Debugging"
    20. Use now the Platform Tools with this Commands:
      (You can acces Fastboot and ADB by starting the Windows Command Prompt)
    21. Type now (Step by Step):
      Code:
      cd\
      cd platform-tools
      (To use the Platform Tools Folder as environment for Fastboot and ADB)
      (In case You extracted the Google platform-tools Folder to Your Windows Drive)
    22. Type now:
      Code:
      adb reboot bootloader
      (You will get a prompt on Your Xperia Device)
    23. Followed by Your Bootloader Unlock Code (You're in fastboot if You can see the BLUE LED on Your Xperia):
      Code:
      fastboot oem unlock 0xYOURKEY
    24. Wait for it... And type now:
      Code:
      fastboot reboot
    25. Wait for Your Device to Wipe and Start. Once in the Android System, turn Your Device off without USB Connected
    26. Press and hold now the Volume UP Button while connecting to USB to enable the fastboot Mode (You're in fastboot if You can see the BLUE LED on Your Xperia)
    27. Continue with flashing the Images for Root (Step by Step):
      Code:
      fastboot flash boot_a magisk_patched.img
      fastboot flash boot_b magisk_patched.img
      fastboot reboot

    Done. You are unlocked and rooted now, just install the Magisk Manager and enjoy!


    Flashing Firmwares and re-locking the Bootloader...

    First of all. You can and should use NewFlasher, with an unlocked and locked Bootloader State.
    That can prevent You from Bootloops and is the only way to Update Your Xperia in unlocked State since OTA don't work anymore.
    Flashing a new Firmware will also wipe Your Device so make sure You have Backups!
    So let's start with the Firmware Flashing (You should have followed the Steps from above before):
    -Make sure Your Device is turned off and that it is disconnected from USB
    -Press and hold the Volume DOWN Button while connecting to USB to access the Xperia Flashmode
    -Go to Your Firmware Folder an start the NewFlasher Exe
    -If it asks for rebooting choose what You want
    -If it asks for extracting Drivers answer No as "n"
    -If it asks for dumping the Trim Area answer No as "n"
    -If it asks for flashing modem, bootloader etc. answer Yes as "y" (always do that)
    Wait for it to finish and You're done with Updating/Flashing Your Firmware. Enjoy!


    If You want to relock Your Bootloader...
    -Just go into fastboot mode any type in the command prompt (like before in this Guide):
    Code:
    cd\
    cd platform-tools
    fastboot oem lock
    -Wait for Your Device and disconnect it from USB
    -Download and Install the "Xperia Companion" from SONY
    -Open the Xperia Companion and select Software Repair
    -Select that Your Device can't get recognized (or is a Smartwatch 3 lol)
    -Go to the next Page and select the Xperia Smartphone Option
    -Continue and wait for the Initialization
    -Press and hold Volume DOWN while connecting to USB (You will see the Green Flashmode LED again)
    -Continue once Your Device gets recognized and let the Xperia Companion do his work...

    Done. Your Bootloader is locked again and most of Your DRMs are restored. But please Note, that unlocking Your Bootloader erases Your unique Device Key FOREVER. That will flag Your Device as "it was unlocked". This can be checked by SONY and everyone else who has this Device in his Hands... (SONY knows it anyways).


    That helped? Leave a Thanks! <3
    Donations are actually also really welcome!

    2
    Might want to add a section for quickly updating firmware without wiping data. I am sure everyone here in XDA have done this many times, not sure am I missing any safety steps. Help me take a look

    1. Backup your stuff
    2. Download xperiafirm, unsin, newflasher, platform-tools
    3. Download the firmware with xperiafirm
    4. Copy newflasher files into the firmware folder
    5. Delete appslog_X-****.sin , diag_X-****.sin , persist_X-****.sin, userdata_X-****.sin , ssd_X-****.sin (may not have it now) , all *.ta and the partition folder (Not sure any files else)
    6. Turn off phone and plug in usb with volume down to enter flash mod (green led)
    7. Start newflasher and flash the firmware, I think the answers are all "no" now in v40
    8. Reboot, wait for andriod update complete
    9. Drag the boot_X-****.sin to unsin.exe to get boot_X-****.img
    10. Copy the boot_X-****.img to your phone
    11. Use the magisk app in your phone, go to install > select and patch a file
    Edit: current magisk is not working with our Android 11, use this method instead
    Edit 2: ken442266 has published a patched kernel for HK_58.1.A.1.178 here
    12. Copy the magisk_patch.img from your phone's download folder to the platform-tools folder for later use
    13. Unplug phone and plug in usb with volume up to enter fastboot mode (blue led)
    14. Create a .bat with this code in the platform-tools folder
    Code:
    adb start-server
    fastboot flash boot_a magisk_patched.img
    fastboot flash boot_b magisk_patched.img
    fastboot reboot
    adb kill-server
    @pause
    15. run the .bat and done?
    2
    The Problem is explained here :
    Let's hope for a fix asap...
    1
    Awesome guide.
    Bought my Xperia 5 ii today.
    Going to root my phone Tomorrow.:cowboy:

    Just updated or mostly reworked the whole Thread today. Hope it goes well for You! Enjoy Your Xperia 5 II :cowboy:
    1
    Done. Your Bootloader is locked again and Your DRMs are restored. Everything like out of the Box. Enjoy!
    I don't agree. DK key is lost forever! If you not believing me do trim area dump and search for unit 0x1046b it not exist anymore! And there is no way to restore DK key. I will not comment functionality but it might be reduced too, but for sure your warranty is bye bye because of removed DK (device key). You should update OP and tell users under warranty about that. What we have facing recently is "rollback protection" on newer xperia models -> https://forum.xda-developers.com/t/tool-newflasher-xperia-command-line-flasher.3619426/post-84077083 , anybody confirm?
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone