Unsupported/Unknown image format when patching via Magisk pls help - Sony Xperia XZ Questions & Answers

Hi,
I have very awkward problem, when trying to root my xperia xz. I was trying almost everything to fix it, but nothing helped. I used different Magisk version, downloading different stock roms from Xperifirm that fits mine fw, extracting kernel.sin, dumping with flashtool to kernel.elf, and renaming to boot.img, but still the problem occured. I was also trying to root via twrp, but still the same problem. I read tons of guides, but found nothing useful, searched in google and nothing. It seems like the problem is quite rare. I also noticed, that every boot.img, which Magisk can patch, has size below 20MB, for example, boot.img from ROMs downloaded by Xperifirm, have around 35MB, and boot.img transferred from my phone has 65MB. And second thing, when i was trying to modify boot.img via rootkernel, only kernels that rootkernel could modify, were the kernels patchable by Magisk. Rootkernel was getting stuck with kernels from Xperifirm and from my phone. When flashed kernel, that Magisk could patch, bootloop occurred. My stock rom is oreo 8.0.0 41.3.A.2.192-R2E, bootloader is unlocked. Maybe my phone is just unrootable? Or kernels from stock roms are encrypted somehow, and i just don't know how to decrypt them? Every help is really appreciated, thanks.

try to root with twrp

Raghaov said:
try to root with twrp
Click to expand...
Click to collapse
I tried, but it didnt work, i wrote that earlier

Blaska122 said:
Or kernels from stock roms are encrypted somehow, and i just don't know how to decrypt them?
Click to expand...
Click to collapse
Here is what you need to extract your kernel (boot.img) from offical firmware. You will also need to repack it (very simple, just unpack ~ repack) with AIK in order for it to boot properly rooted.

&(*) said:
Here is what you need to extract your kernel (boot.img) from offical firmware. You will also need to repack it (very simple, just unpack ~ repack) with AIK in order for it to boot properly rooted.
Click to expand...
Click to collapse
Thanks for answer!

Thank you all for help, but I recently change my phone, so the thread can be archived.

Related

T-Mobile IN2017 Root Method?

All of the similar threads just end after a few replies (I think because people didn't have unlocked bootloaders) so I thought I'd try to ask again. I have a T-Mo OP8 (IN2017) on 10.5.22IN55CB. I already have the bootloader unlocked. But all of the root methods I can find need a payload.bin from the stock firmware, and I can't seem to find that. Is there another method or a source for branded firmware? I wasn't sure if I could do it by just booting the TWRP found on this board without flashing the recovery.
TIA.
SilverZero said:
All of the similar threads just end after a few replies (I think because people didn't have unlocked bootloaders) so I thought I'd try to ask again. I have a T-Mo OP8 (IN2017) on 10.5.22IN55CB. I already have the bootloader unlocked. But all of the root methods I can find need a payload.bin from the stock firmware, and I can't seem to find that. Is there another method or a source for branded firmware? I wasn't sure if I could do it by just booting the TWRP found on this board without flashing the recovery.
TIA.
Click to expand...
Click to collapse
I booted into TWRP and took a backup of the device. I then transferred the backup to my local PC and took the boot file from the backup, renaming the extension to .img. I then put this boot image on my device and downloaded magisk manager and set magisk manager to install magisk by patching a file. Once completed, I downloaded the patched file to my PC and booted to fastboot. While in fastboot, I flashed the magisk_patched boot image to both boot slots (boot_a, and boot_b). Upon rebooting, I had root. One thing, as soon as you have root, I recommend taking an image of your persist file (for fingerprint) to prevent any issues if the persist partition gets corrupted on your device. Search the forum for instructions on how to do this.
Cheers,
B.D.
You literally don't have to do anything special. Boot TWRP, flash Magisk zip in TWRP, reboot. Done.
stompysan said:
You literally don't have to do anything special. Boot TWRP, flash Magisk zip in TWRP, reboot. Done.
Click to expand...
Click to collapse
Works great. Thanks!
BostonDan said:
I booted into TWRP and took a backup of the device. I then transferred the backup to my local PC and took the boot file from the backup, renaming the extension to .img. I then put this boot image on my device and downloaded magisk manager and set magisk manager to install magisk by patching a file. Once completed, I downloaded the patched file to my PC and booted to fastboot. While in fastboot, I flashed the magisk_patched boot image to both boot slots (boot_a, and boot_b). Upon rebooting, I had root. One thing, as soon as you have root, I recommend taking an image of your persist file (for fingerprint) to prevent any issues if the persist partition gets corrupted on your device. Search the forum for instructions on how to do this.
Cheers,
B.D.
Click to expand...
Click to collapse
Post below yours worked for me but I appreciate the advice on backups and what to watch for. I haven't installed TWRP yet, just booted it and installed.
SilverZero said:
Works great. Thanks!
Click to expand...
Click to collapse
I should state one thing that I didn't in my original post. Booting TWRP and flashing that way ONLY works if you are still running Android 10. Since you have a T-Mobile variant, I knew this was a non-issue (we STILL don't have official A11). For those running Android 11, you do have to patch the boot image and flash it like stated above. Also note that this will likely change if we get TWRP on A11. Once we have that working, flashing Magisk from it should work fine.
stompysan said:
I should state one thing that I didn't in my original post. Booting TWRP and flashing that way ONLY works if you are still running Android 10. Since you have a T-Mobile variant, I knew this was a non-issue (we STILL don't have official A11). For those running Android 11, you do have to patch the boot image and flash it like stated above. Also note that this will likely change if we get TWRP on A11. Once we have that working, flashing Magisk from it should work fine.
Click to expand...
Click to collapse
Following up on this just in case you know anything new. My IN2017 just updated to A11 without any action on my part, and I lost root. Is there a TWRP or patched boot img that you know of for us on TMo now?
There is no working twrp for us on Android 11. I also haven't seen a patched boot image of 11.0.1.3.IN55CB around yet. I have that firmware extracted on my laptop so I could grab the boot image and patch it for you, but I won't be able to do that until later tomorrow. If no one else has it out or if you don't find it before I can get to it, I'll post it up.
Edit: Here's the patched boot image: Magisk Patched Boot IMG TMO 11.0.1.3

OTA and maintain root ( TWRP Magisk)

How can i install an OTA update and maintain root ?
I have rooted using TWRP 3.5 and Magisk 22
I've found several instructions using the “TWRP A/B Retention Script”
but since the Samsung A8 (2018) has an A-Only (or non A/B) partition scheme
i am left in the dark ...
ReMiOS said:
How can i install an OTA update and maintain root ?
I have rooted using TWRP 3.5 and Magisk 22
I've found several instructions using the “TWRP A/B Retention Script”
but since the Samsung A8 (2018) has an A-Only (or non A/B) partition scheme
i am left in the dark ...
Click to expand...
Click to collapse
Why not download and flash firmware updates manually?
For me, official OTA updates are often too late. I want to install an update as soon as I can get my hands on it.
It_ler said:
Why not download and flash firmware updates manually?
For me, official OTA updates are often too late. I want to install an update as soon as I can get my hands on it.
Click to expand...
Click to collapse
Seems like a good idea, but how can i install a OTA manually ?
ReMiOS said:
Seems like a good idea, but how can i install a OTA manually ?
Click to expand...
Click to collapse
I use Frija (https://forum.xda-developers.com/t/tool-frija-samsung-firmware-downloader-checker.3910594/) to check for and download latest stock Samsung firmware files. Then I use Odin to flash it to my phone.
It_ler said:
I use Frija (https://forum.xda-developers.com/t/tool-frija-samsung-firmware-downloader-checker.3910594/) to check for and download latest stock Samsung firmware files. Then I use Odin to flash it to my phone.
Click to expand...
Click to collapse
Thanks for your reply
When using Frija and Odin wil this wipe my data ?
Or will the phone-data be untouched and also the TWRP Root (Magisk) ?
ReMiOS said:
Thanks for your reply
When using Frija and Odin wil this wipe my data ?
Or will the phone-data be untouched and also the TWRP Root (Magisk) ?
Click to expand...
Click to collapse
Downloading with Frija does nothing on your device.
Flashing firmware files with Odin will overwrite the corresponding system partitions ... and when flashing another CSC file, you may have to wipe data partition to get the device rebooting into system again.
But as long as you do not flash another CSC file (I always use Home_CSC file to stay on my current CSC), data partition will not be overwritten or wiped.
Concerning root / Magisk IDK. If you have changed something in system partitions for rooting the device, this may be overwritten by flashing the stock Samsung firmware. In this case, you will have to do the needed changed again for rooting the device.
As I am not rooted with Magisk ATM, I am not familiar with the exact steps. I heard about "patching" a system file, but better to ask someone more familiar with rooting with Magisk.
BTW... after flashing stock firmware, will have stock recovery. No more TWRP. If you want/need it back, you will have to flash TWRP recovery again afterwards.
It_ler said:
Downloading with Frija does nothing on your device.
Flashing firmware files with Odin will overwrite the corresponding system partitions ... and when flashing another CSC file, you may have to wipe data partition to get the device rebooting into system again.
But as long as you do not flash another CSC file (I always use Home_CSC file to stay on my current CSC), data partition will not be overwritten or wiped.
Concerning root / Magisk IDK. If you have changed something in system partitions for rooting the device, this may be overwritten by flashing the stock Samsung firmware. In this case, you will have to do the needed changed again for rooting the device.
As I am not rooted with Magisk ATM, I am not familiar with the exact steps. I heard about "patching" a system file, but better to ask someone more familiar with rooting with Magisk.
BTW... after flashing stock firmware, will have stock recovery. No more TWRP. If you want/need it back, you will have to flash TWRP recovery again afterwards.
Click to expand...
Click to collapse
GitHub - Magisk-Modules-Repo/twrp-keep: twrp-keep
twrp-keep. Contribute to Magisk-Modules-Repo/twrp-keep development by creating an account on GitHub.
github.com
It's called a TWRP retention script.

Question Nord 2T 5G Full Factory ROM/Firmware with Scatter file for Unbricking

After successfully rooting my Nord 2T by backing up and then patching the stock boot.img I proceeded to patch the inactive slot within Magisk (it was unecessary of me..) and after rebooting entered a loop. Anyone know where I can get the factory ROM? I was on the May patch. Thanks in advance!
I am also looking for the factory OTA image.
How did you get the boot.img exactly?
jolaviska said:
I am also looking for the factory OTA image.
How did you get the boot.img exactly?
Click to expand...
Click to collapse
Good ol SP Flash but I think the backed up images are corrupted hence the need of factory firmware to use it to restore my device.
Apologies I did not realise you still needed the firmware. I have mirrored it here if you still need it May Patch Full ROM
garylawwd said:
Apologies I did not realise you still needed the firmware. I have mirrored it here if you still need it May Patch Full ROM
Click to expand...
Click to collapse
So extracting boot. img from your file won't be enough to do Root right?
Riski3Run said:
So extracting boot. img from your file won't be enough to do Root right?
Click to expand...
Click to collapse
You can't extract from the firmware. You must use spflash tool to pull the boot.img from the device (mediatek devices are a bit different to Snapdragon devices)
I'm going to do it today but I had to bring my daughter to the hospital after a fall she had which required stitches.
Once I have it extracted I might write a guide on how to do it with links to all firmware needed and have a thread where we will have both the stock and magisk patched boot.img's available.
Been like 6 weeks and no root on my device, this is the longest I have went without rooting in almost 7 years
garylawwd said:
You can't extract from the firmware. You must use spflash tool to pull the boot.img from the device (mediatek devices are a bit different to Snapdragon devices)
I'm going to do it today but I had to bring my daughter to the hospital after a fall she had which required stitches.
Once I have it extracted I might write a guide on how to do it with links to all firmware needed and have a thread where we will have both the stock and magisk patched boot.img's available.
Been like 6 weeks and no root on my device, this is the longest I have went without rooting in almost 7 years
Click to expand...
Click to collapse
Thanks. I rooted mine within a day but went too far with patching the inactive slot via Magisk and now phone is soft bricked. If you are still interested in extracting the boot image for patching then use this tool. I tried to use it to flash the payload.bin but phone still not booting. I even flashed all the extracted images manually in fastbootd. I guess the OTA file doesn't contain all the files needed to restore the device back to its factory state.
Anyone with the full firmware containing the SP Flash Scatter file please share it. You'll be saving everyone else. I bought my phone on a trip and there are no OnePlus repair centers over here so won't be using my phone until I can restore it myself
garylawwd said:
Apologies I did not realise you still needed the firmware. I have mirrored it here if you still need it May Patch Full ROM
Click to expand...
Click to collapse
Hello
Can't you upload this zip file somewhere else?
Each time download is not finished.
Riski3Run said:
Hello
Can't you upload this zip file somewhere else?
Each time download is not finished.
Click to expand...
Click to collapse
Saw you were able to fully extract the payload.bin so could you mirror the files as well..
Issue is now resolved Thanks @Riski3Run and @garylawwd
Alternatively extracting and flashing the payload.bin ALSO works. No need to extract the images just use this beautiful tool
garylawwd said:
Apologies I did not realise you still needed the firmware. I have mirrored it here if you still need it May Patch Full ROM
Click to expand...
Click to collapse
Hi Garylawwd, when I click on the link it displays an empty folder. Can you perhaps reupload the firmware? My device is bricked and I'm unable to find the stock rom and scatter file for CPH2399 :/
woodiewood3 said:
Hi Garylawwd, when I click on the link it displays an empty folder. Can you perhaps reupload the firmware? My device is bricked and I'm unable to find the stock rom and scatter file for CPH2399 :/
Click to expand...
Click to collapse
Were you on the latest June security patch?
garylawwd said:
Were you on the latest June security patch?
Click to expand...
Click to collapse
Yes I was on the June patch, but I completely messed up my Phone.. can't boot into recovery or fastboot, screen stays black.
When I plug in the phone my computer recognizes it as Mediatek usb port.
When I try to use mtk_gui it is able to connect but it freezes after DA extension and thus I'm unable to read or write anything from or to the device via mtk_gui.
I hope that I can flash the stock firmware via SP flash tool, otherwise I will probably need to send it to OP repairs centre.
But to flash via SP flash tool I do need the firmware + scatter file. ATM I'm unable to find them.
I am unable to create the scatter file via MTKDroid it says --- Unknown ROM structure, backup NOT possible!

Question How do I root one ui 5 Android 13?

So, I installed the One ui 5 beta successfully although I am not on Indian region, but I can't live without root. There are too many magisk modules I rely on for daily use. However, since there is no AP file for one ui 5, i can't simply patch it and flash it.
So, what I am asking is if any of you can tell me any methods that might work, even if you haven't tried it.
Here are some of the things I tried so far and failed:
1. Tried patching the one ui 5 update.zip file but error.
2. Tried installing TWRP which worked but after I flash Magisk, it leads to bootloop.
3. Tried installing Pixel Experience recovery to flash magisk but same bootloop.
4. Tried flashing services disabler in TWRP, thinking it would prevent bootloop, but it gets stuck during installation.
So, here are some things I want to try and I want your opinion on whether it would work before trying:
1. Installing one ui 4.1, rooting it with TWRP and then installing the update.zip directly from TWRP.
2. Installing Magisk patched AP for one ui 4.1 and then installing update.zip via stock recovery. (oh wait nvm I tried this and the update.zip didn't install)
Please let me know if there might be a way to install Magisk safely without bootloop in One UI 5.
Hello, extract Boot.img from firmware file, transfert to Phone, With magisk on unrooted Phone, patch the boots.img,transfert to computer and try to make an .tar file with it, and try to patch with Odin in User line
buzzsaw891 said:
Hello, extract Boot.img from firmware file, transfert to Phone, With magisk on unrooted Phone, patch the boots.img,transfert to computer and try to make an .tar file with it, and try to patch with Odin in User line
Click to expand...
Click to collapse
I tried that but how do i extract boot.img from firmware?
Hi I am root my phone is root
MAO kam said:
Hi I am root my phone is root
Click to expand...
Click to collapse
didn't understand that. Are you root or is your phone root?
I'm on "A525FXXU4CVJB" version and have tried to root using files from HalabTech but did not work.
Stuck in boot loop after flashing some zip files.
Still looking for root for Android 13.
Also there is November update for my country.
this is why you are better off just getting google pixel devices
barryallen3038 said:
I tried that but how do i extract boot.img from firmware?
Click to expand...
Click to collapse
Use 7-Zip to extract AP and get "boot.img.lz4" file, then extract boot.img.lz4 with 7-zip and you'll get your boot.img file.

Extracted Stock Files

So I see a lot of people using magisk patched boot images that are really old. It'd be better to patch the image yourself from magisk and use that. The problem might be that it's not that easy to extract it.
You can find most of the stuff from stock rom extracted by me here. The files were extracted from the Indian varient. Make sure to use the appropriate files for your stock rom. The index site does have other files like some old and unstable kernels so don't go flashing everything you see from the root directory. This just started as a personal archive. The domain is free, so idk how long it'll stay active either.
As always, use everything at your own risk.​
Do Magisk versions newer than v24.3 work this way?
newt23 said:
Do Magisk versions newer than v24.3 work this way?
Click to expand...
Click to collapse
Yes, patching the boot image is the recommended way to install Magisk.
The official guide does ask to patch AP wholly for samsung devices, but patching the boot image itself is faster.
Official Guide
I don't understand why I get bootloops if I update to v25.x from v24.3 from the Magisk app (using direct method). As I understand it, it also (re-)patches the boot image.
newt23 said:
I don't understand why I get bootloops if I update to v25.x from v24.3 from the Magisk app (using direct method). As I understand it, it also (re-)patches the boot image.
Click to expand...
Click to collapse
That's how I updated too. Try flashing the magisk zip directly.
Or, only update the magisk app, patch the boot image, rename it as boot.img, put it in a tar file, and then flash it to "AP" using Odin.
Hmm... this is funny. I patched the stock boot image and flashed it using Odin and still got bootloops. I took a full nandroid backup beforehand so I was able to get everything working by flashing TWRP again and restoring the previous boot image.
I get bootloops if I install v25.x from TWRP after installing a rom or update to v25.x from v24.3 directly or by patching the stock boot image. The only one that's left now is flashing v25.x zip from TWRP (while having a functioning system with v24.3) but something tells me it's going to end in bootloops too.

Categories

Resources