yashsingh1/xdaforums huggingface dataset:
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
It doesn't seem to be working for me. I keep getting error messages. Not sure exactly what I'm doing wrong. It's asking for a supersu zip file. I provided magisk, but it still gives another error. I loaded the FTF file though.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
I can do this on my old computer still but not new one
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
if you get the boot.img, please upload ?

I tried running the program in compatibility mode with windows vista and windows 8, even tried as administrator, same error message
[Sony XA2 Ultra Questions & Answers] mchlbenner:
I'm trying to get twrp built for this will take some time I wish I had the device but not for a threw months unfortunate.

---------- Post added at 10:01 PM ---------- Previous post was at 09:42 PM ----------

Try this twrp builder it works with out root.

http://www.mediafire.com/file/e5d1ojafoefcgbw/app-release-1.apk
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
It requires a stock recovery.img, which I don't have access to.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
I was told to use custom backup?

---------- Post added at 11:27 PM ---------- Previous post was at 10:44 PM ----------

You can try also xperia companion you can backup your phone
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
how would I get that? ?
[Sony XA2 Ultra Questions & Answers] mchlbenner:
What happen when you try that
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
how can I get a custom backup without root?
[Sony XA2 Ultra Questions & Answers] mchlbenner:
They said it could be done.

I will try to figure out how.
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
I'm thinking it can be done just like the boot.img can be patched without root. the issue arises when we don't have the img to work with, and no root access, there's no way to get it until Flashtool is updated to support the device. however, if we can get the recovery.img and boot.img files somehow, we should be able to get twrp and root
[Sony XA2 Ultra Questions & Answers] mchlbenner:
If we had a boot.img we have root right then!

Will get it but it will take time.
[Sony XA2 Ultra Questions & Answers] :
guys i'm not sure if this will really help you because i don't own XA2 Ultra, just XA2 and i don't want to unlock bootloader yet but i've just patched stock boot.img. at least it looks like i did :)

after you download your firmware with XperiFirm with extraction disabled in it's settings use FlashTool's Tools>Bundles>Create to decrypt those firmware files and close it. you won't need it anymore. i've set Xperia X as "Device:" and i believe it won't matter as we won't flash created firmware.

now download kernel_dump, open terminal and run "kernel_dump out kernel_X-FLASH-ALL-18AE.sin" maybe your kernel_* file will have different name, i don't know.

this will create "out" folder and there will be two files in it. rename the bigger one kernel_X-FLASH-ALL-18AE.000 which has ~50MB to boot.img, send it to your phone and use magisk to patch it.

that's it, if you have unlocked bootloader run "fastboot boot boot.img" to test it and if it works "fastboot flash boot boot.img" to flash it. good luck.

i believe the same thing can be done if you want stock recovery.img but i have no idea which .sin file is it

EDIT: this should do the same thing as kernel_dump but supports sin v5

https://xdaforums.com/crossdevice-dev/sony/tool-unsin-sin-v3-unpacker-t3128106

people with XA2 H4113 can try my boot.img just please don't flash this thing, fastboot boot first, without flash - https://drive.google.com/open?id=1tK_Wf95KXwJ7SJo0bu2Du-fMnmp93TS7
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Will not work on windows 10 unfortunately
[Sony XA2 Ultra Questions & Answers] :
ok i can confirm that it works. i have unlocked bootloader and after booting this boot.img i have root
[Sony XA2 Ultra Questions & Answers] serajr:
It will!

Nice!

I've already patched a kernel that way to [MENTION=7426713]li0nh3art3d[/MENTION] and it did work too (confirmed).

The "problem" is that magisk disables dm-verity on /vendor partition only (on its patching process, in the dtb), but /system partition still has that protection up and running. It can be disabled too, by patching fstab.qcom file (/vendor/etc/fstab.qcom), which may be (and surely is) an dangerous task, due right file permissions and selinux context.

li0nh3art3d already tried out replacing that file with a patched one, but device falled in a bootloop. I'm working on a flashable zip and a script to run the proper code to disable dm-verity (/system) and forceencrypt (/data) onto original fstab.qcom file.
[Sony XA2 Ultra Questions & Answers] serajr:
Can someone please send me output of this shell command (XA2 or XA2 Ultra)?

ls -Z /vendor/etc/fstab.qcom

Or simply confirm if output is equal to this one below:

u:object_r:vendor_configs_file:s0 /vendor/etc/fstab.qcom
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
Indeed it is.
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
What I was able to do since Flashtool won't create anything for the HXXXX devices, at the suggestion of Serajr, I was able to use unsin to get the boot.img by using the kernel.sin provided in the firmware on Xperifirm.
[Sony XA2 Ultra Questions & Answers] tokoam:
Can confirm I have root !! after using unsin !! thanks for this now we just need twrp
[Sony XA2 Ultra Questions & Answers] mchlbenner:
I can confirm this works unsin thumbs up.

So I have root for H3223 I'm holding off post.

I am know trying to get twrp for H3223 I will keep you informed.
[Sony XA2 Ultra Questions & Answers] Davide.porcelli:
tried it on my H4213 but got boot loop. Any suggestion ?

Thank You
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Did you resolve your problem?
[Sony XA2 Ultra Questions & Answers] serajr:
Great news bro!

Are you (all of you reading this) able to mount /system as rw (and perform permanent changes)?

If so, probably dm-verity on /system partition has been patched by Magisk (along with /vendor), and it won't be triggerd, which is great!

Twrp recovery would be great as well, so you could flash its image in the fotakernel partition!
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
Get the firmware for your device off Xperifirm. Get UnSin and drag the Kernel sin file and drop over the unsin exe. This should make you a kernel img file you can fastboot flash to your device. After you do that, copy the same img to your device and patch it with magisk manager. then copy back to your adb directory and fastboot flash it, and you should have magisk root access - no bootloop
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
I am not getting any kind of errors when I mount the system as RW, and add blank files to the system and system_root partitions. The changes seem to be permanent as the files are still present after reboot.
[Sony XA2 Ultra Questions & Answers] serajr:
Thank you again bro for confirmation!! :good:
[Sony XA2 Ultra Questions & Answers] bloodclot:
H3223 Magisk root confirmed using unsin! Thank you so much!

EDIT: "Busybox for Android NDK" magisk module also installs and works without a hitch
[Sony XA2 Ultra Questions & Answers] mingkee:
Even I have not purchased XA2 ultra, I found rooting is much easier.

Download the ROM with xperifirm

You don't really need flashtool. Just go to downloaded folder and copy the kernel sin file

Use unsin to unpack and you will get .img file

Patch .img with Magisk. Unlike mediatek hardware, the patching is straightforward.

Copy the patched boot img to your ADB folder.

Unlock the bootloader, flash the patched boot .img, and install Magisk Manager and that's it.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
After unlocking bootloader you can't get updates and you can't use the Sony companion but you will use Sony flash tool instead.

With the flash tool it new os comes out you will flash it with Sony flash tool.
[Sony XA2 Ultra Questions & Answers] woodykill:
Does it mean I have to flash a flesh new ROM everytime if I want to upgrade my unlocked device?
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Yes
[Sony XA2 Ultra Questions & Answers] makotech222:
Two questions. I'm on XA2 regular. I tested with fastboot boot, but it stops at the Sony screen and restarts before it gets to home screen. I'm guessing that it didn't work correctly?

Also, do I have to use the magiskmanager that is linked in the Post? is it a special version?

Edit: tried with linked magisk manager. Didn't work either.

For reference, this is the firmware i downloaded for my xa2 that matched the info on my phone: H3123_Customized US_1312-1865_50.1.A.4.102_R5A
[Sony XA2 Ultra Questions & Answers] mchlbenner:
What model do you have?
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
It's my understanding your bootloader is unlocked. You downloaded the firmware from Xperifirm, correct? Then used UnSin to turn the kernelxxxflashallx.sin to an img? after you do this, copy it to your device from your pc, use magisk manager to patch it, copy back to your adb directory, then boot into fastboot mode and use the command fastboot flash boot patched_boot.img and then reboot and it should work. it worked on my H3123. Let me know if you need any help. I bricked my device flashing some other unrelated **** but with fastboot and the firmware with UnSin I was able to fastboot stock firmware to fix it
[Sony XA2 Ultra Questions & Answers] makotech222:
Yeah thats exactly what i did. The boot after fastboot boot patched_boot.bin stops at the Sony screen, then reboots to stock.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Use unsin.

Kernel x flash all 18ae.sin use unsin it becomes kernel x flash all 18 ae.img.

I would change it to boot.img.

Then copy for safe keeping.

Patch it in magisk even then I would rename it boot.img.

But keeps the two imgs in different files so you mistake them.
[Sony XA2 Ultra Questions & Answers] makotech222:
H3123
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
what you need to do is fastboot flash boot patched_boot.img. it should be a img file after you use unsin on the kernel.sin

I think you're just test booting the boot.img by fastboot boot. you need the word flash after fastboot

I have the exact same device, H3123, it's working for me :good:
[Sony XA2 Ultra Questions & Answers] makotech222:
Yeah, I am testing it. Shouldn't it boot correctly and go to android home screen? It never gets to the homescreen, it just reboots and uses the stock boot.
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
For the change to stay, you need to fastboot flash. It does work, I promise you 100%. I have the same exact device as you, H3123. As long as you used unsin on the exact kernelxxxflashall.sin from Xperifirm specifically for our device, it will work, 100%
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
don't forget to hit thanks :good:
[Sony XA2 Ultra Questions & Answers] makotech222:
If it fails, how do i switch back to stock? Do i just use the unpatched boot.img?

I just tried the test with regular boot.img (unpatched). It gets to the sony screen and then reboots, same as the patched boot.img. Is this correct behavior?
[Sony XA2 Ultra Questions & Answers] mchlbenner:
What process did you use.
[Sony XA2 Ultra Questions & Answers] serajr:
"Do i just use the unpatched boot.img?" Yes, you do!

Fastboot has a secure boot process, and testing out boot.img won't work! Since the boot partition is empty (only in device memory), device is unable to boot properly, boot process will stop at init binary (which is not present where it should be at - symlink error)!

Do that this way (with patched or stock img): fastboot flash boot your_patched_or_stock_boot.img
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
It'll work.. but yeah when i bricked I was able to fastboot the factory images to fix it. didn't even lose any data either. it'll work though
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Make sure your using the proper boot.img.

Example H3232 only use H3223 boot.mg.

Some of you guys have xa2 and some have xa2 ultra.

Don't try other models boot.mg that likely will not work.

If I can get recover.img will get them to twrp.
[Sony XA2 Ultra Questions & Answers] makotech222:
Ah, **** me. Im definitely stuck in a boot loop now after doing 'fastboot flash boot patched_boot.img'

I'm going to try and go back to stock boot.img.

Ugh can't get into bootloader anymore using adb reboot bootloader. Any suggesstions? NVM got it, holding volume up key while booting up.

The stock boot.img isn't working either. Any ideas? Maybe UnSin doesnt work for XA2?
[Sony XA2 Ultra Questions & Answers] mchlbenner:
One more time did you use the boot.img for your device?

Do you have ftf file for your device.
[Sony XA2 Ultra Questions & Answers] makotech222:
yes I double checked the version with the *#*# number. I get the firmware from xperifirm, used latest UnSin v18 to get the img, then used fastboot flash boot

What is FTF file.

Edit: In the fastboot console, it says

sending 'boot_a' (51600 KB)...

OKAY [ 1.156s]

writing 'boot_a'...

OKAY [ 0.000s]

finished. total time: 1.172s

Is that writing time supposed to be 0 seconds? seems wrong
[Sony XA2 Ultra Questions & Answers] mchlbenner:
If you have an h3223 you can't use 3123 boot.img.

You need to download your devices ftf file an then extract images you need.
[Sony XA2 Ultra Questions & Answers] makotech222:
I have a 3123, so i'm using the correct boot.img.

How do i download ftf file?
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Nope you need to go xperifirm and download your firmware for your device.

So no fastboot?

Can you get into download mode?

Never flash another devices images.
[Sony XA2 Ultra Questions & Answers] makotech222:
I'm able to get into fastboot mode and try other device images, if needed. I already have the xperifirm firmware for my device.

---------- Post added at 11:37 PM ---------- Previous post was at 11:33 PM ----------

My full device is

H3123

1312-1865_R5A

Version GENERIC_50.1.A.4.102
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Can you boot normal now?
[Sony XA2 Ultra Questions & Answers] makotech222:
No, it bootloops. I checked the info from my Wife's phone, which is exact same.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Oka where did you get the boot.img you flashed?
[Sony XA2 Ultra Questions & Answers] makotech222:
XperiFirm, downloaded the firmware, used UnSin to create .img file. Renamed it to boot.img. Then send over fastboot.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Did come out like this picture.
[Sony XA2 Ultra Questions & Answers] makotech222:
Yup
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Oka

Try this

Fastboot flash boot.img one space drag and drop boot.img and hit enter.
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
That's about right for the boot.img flash. Double check the firmware in Xperifirm and make sure it's for the H3123, US version. make sure it's the kernel that you flashed. It's strange the stock kernel would cause a bootloop on your device...
[Sony XA2 Ultra Questions & Answers] makotech222:
That one didn't work :(

And i double checked the firmware i downloaded and that its the kernal sin file.

---------- Post added at 12:20 AM ---------- Previous post was at 12:17 AM ----------

Will I be able to try other things if someone gets TWRP working or the recovery.img?
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
needs to be flashboot flash boot patched_boot.img

if you didn't type boot before patched_boot.img, that's what went wrong. it needs to know you're flashing the boot.img to the boot partition.

you can make ext4 files for the oem, vendor, and system files and flash them. be sure and put oem before the oemfilename.ext4, vendor before the vendorfilename.ext4, and system before the systemfilename.ext4. it's important to tell fastboot what partition you're flashing the file to
[Sony XA2 Ultra Questions & Answers] makotech222:
Yes i did do the full command, 'flashboot flash boot boot.img'
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
Keep trying my friend. I got un-bootlooped yesterday by flashing those 4 stock partitions with the stock files made from UnSin

try flashing those 4 stock partitions with the 3 ext4 files and the boot.img

That's how I got out of bootloop 2 days ago. Then I flashed the patched_boot.img again and I was rooted.
[Sony XA2 Ultra Questions & Answers] makotech222:
Can you give instructions on how to do that?

---------- Post added at 06:43 PM ---------- Previous post was at 06:32 PM ----------

I took a guess on what to do. I took those three files and put them into UnSin and got the resulting ext4 files. I then proceeded to flash them using 'fastboot flash vendor vendor_X-FLASH-ALL-18AE.ext4' and same for 2 others. Didn't seem to work. Weirdly, when the boot fails, it goes straight into fastboot mode, instead of retrying.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Just make sure here.

You flash boot flash boot?

It should be fastboot flash boot.img.
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
Yeah, the systemxxxflashall.sin file in your firmware, drag and drop it over the unsin program like you did or should have done with the kernel.sin. do the same for the oem.sin and vendor.sin partitions. Then move the newly created files (they should be ext4 format) to your adb folder and fastboot flash vendor vendorsinfilename.ext4, when it's done fastboot flash oem oemsinname.ext4, fastboot flash system systemsinname.ext4. That's what worked for me when I was bootlooped. Let us know what the results are
[Sony XA2 Ultra Questions & Answers] makotech222:
Yeah i tried it. I will one more time i guess.

And yes, i meant 'Fastboot flash boot boot.img'
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
no it should be fastboot flash boot boot.img that's correct. when fastboot flashing, you need to specify the partition you are flashing the file to. i.e recovery, oem, vendor etc
[Sony XA2 Ultra Questions & Answers] makotech222:
Nope didn't work. All commands went through successfully though. Here is my powershell log:

PS C:\Users\Steven\Desktop\platform-tools> .\fastboot flash vendor C:\Users\Steven\Desktop\platform-tools\vendor_X-FLASH

-ALL-18AE.ext4

target reported max download size of 536870912 bytes

Invalid sparse file format at header magic

sending sparse 'vendor' 1/2 (523799 KB)...

OKAY [ 13.170s]

writing 'vendor' 1/2...

OKAY [ -0.000s]

sending sparse 'vendor' 2/2 (51555 KB)...

OKAY [ 50.468s]

writing 'vendor' 2/2...

OKAY [ -0.000s]

finished. total time: 63.654s

PS C:\Users\Steven\Desktop\platform-tools> .\fastboot flash oem C:\Users\Steven\Desktop\platform-tools\oem_X-FLASH-CUST-

18AE.ext4

target reported max download size of 536870912 bytes

sending 'oem' (460800 KB)...

OKAY [ 10.282s]

writing 'oem'...

OKAY [ 0.000s]

finished. total time: 10.282s

PS C:\Users\Steven\Desktop\platform-tools> .\fastboot flash system C:\Users\Steven\Desktop\platform-tools\system_X-FLASH

-ALL-18AE.ext4

target reported max download size of 536870912 bytes

Invalid sparse file format at header magic

erasing 'system_a'...

OKAY [ 1.266s]

sending sparse 'system_a' 1/5 (503911 KB)...

OKAY [ 11.837s]

writing 'system_a' 1/5...

OKAY [ -0.000s]

sending sparse 'system_a' 2/5 (521549 KB)...

OKAY [ 31.085s]

writing 'system_a' 2/5...

OKAY [ -0.000s]

sending sparse 'system_a' 3/5 (521844 KB)...

OKAY [ 48.901s]

writing 'system_a' 3/5...

OKAY [ 0.016s]

sending sparse 'system_a' 4/5 (523989 KB)...

OKAY [ 29.060s]

writing 'system_a' 4/5...

OKAY [ 0.016s]

sending sparse 'system_a' 5/5 (106504 KB)...

OKAY [ 6.220s]

writing 'system_a' 5/5...

OKAY [ 0.000s]

finished. total time: 128.416s

PS C:\Users\Steven\Desktop\platform-tools> .\fastboot flash boot C:\Users\Steven\Desktop\platform-tools\boot.img

target reported max download size of 536870912 bytes

sending 'boot_a' (51600 KB)...

OKAY [ 1.203s]

writing 'boot_a'...

OKAY [ 0.016s]

finished. total time: 1.219s

PS C:\Users\Steven\Desktop\platform-tools> .\fastboot reboot

rebooting...

finished. total time: -0.000s
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
Bizarre. The only thing I did differently is I used Minimal ADB & Fastboot software which does it from command prompt vs powershell (shouldn't make a difference in this case) and didn't put the file directory since i copied it to the same directory as the exe, which shouldn't really matter either. Really strange man. You flashed all 4 and you're still bootlooped? After flashing those 4, I successfully booted. I'll try to figure out what went wrong. I'm not the only person on here who successfully flashed the patched_boot.img. weird. something wasn't done right ?

EDIT:

Not sure if this matters or not, what version of MS Framework is installed on your PC? I'm assuming if you did everything correctly, there has to be some variable that went wrong here.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
Try this program

https://www.mediafire.com/file/9gxfrob1d3idric/minimal_adb_fastboot_v1.4_setup.exe
[Sony XA2 Ultra Questions & Answers] makotech222:
Yeah i have latest .net framework. Ill try that fastboot thing but i doubt it. I have latest from Dec 2017.

---------- Post added at 08:17 PM ---------- Previous post was at 08:13 PM ----------

The fastboot you linked didn't work either.

---------- Post added at 08:19 PM ---------- Previous post was at 08:17 PM ----------

The only thing i can think of that might be different for mine, was that when i unlocked the bootloader, i went to the Sony site and selected Sony Xperia XA1 as my phone. At the time, they didn't have an option for XA2. It still provided me with a unlock code and the code worked, so I dunno if that is it or not.
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
Shoot, it really should work.. It's insane how you can successfully flash those partitions all correctly and still be bootlooped. I flashed them all 2 days ago when I was bootlooped, and I was stressed the f*** out because this is my only working device at the moment.. but after flashing the 3 ext4's and the img to their respective partitions, to my relief, I was able to boot right up

---------- Post added at 02:27 AM ---------- Previous post was at 02:25 AM ----------

nah that code is generated by the IMEI. You would have got the same code no matter what device you selected. so it's definitely not that. it seems more like the wrong firmware but you say it's not so I'm really baffled
[Sony XA2 Ultra Questions & Answers] makotech222:
Yeah it seems like wrong firmware, but I checked the phone info before i flashed. And also checked my wife's exact same phone.
[Sony XA2 Ultra Questions & Answers] makotech222:
Hmm I ran the commands below. Do any of those versions look wrong? The bootloader specifically has different version than what came with my xperifirm download.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
You need to flash back to stock I check they have xa2 unlock option
[Sony XA2 Ultra Questions & Answers] makotech222:
What? Can you explain? I'm trying to flash back to stock but its not working.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
You need to use flashtool not Sony companion
[Sony XA2 Ultra Questions & Answers] makotech222:
Instructions?
[Sony XA2 Ultra Questions & Answers] li0nh3art3d:
This is what I get when I run the same command. I'm not an expert by any means, so I can't really understand why yours is different, hopefully someone with a better understanding can interpret the differences.
[Sony XA2 Ultra Questions & Answers] mchlbenner:
I think the problem could be how he got unlock.

At the time they had no xa2 unlock so he used the xa1 unlock.