yashsingh1/xdaforums huggingface dataset:
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ungewiss:
I can't get TWRP to boot on my XZ2C anymore. I am using the official LOS and don't remember the Stock version I flashed before - at least it was Android 10.

I use this twrp:

index - powered by h5ai v0.30.0 (https://larsjung.de/h5ai/)

index - powered by h5ai v0.30.0 (https://larsjung.de/h5ai/)

www.dhsfileserver.de

First I flash the vbmeta stuff, the issue the fastboot boot command. The phone reboots, shows that annoying "device is unlocked" screen and then it's back in fastboot mode.

I wanted to boot TWRP so I can create a full backup before flashing the latest stock to both slots..

Something I am doing obviously wrong or how can I provide more information?

Note: if I issue a second fastboot boot command, then the device will get into a loop telling me that the device is corrupt. This is easily fixed by flashing the LOS recovery to boot.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
The TWRP is only compatible with the SODP and the STOCK DTBO partition.

I need to finish my android 10 based TWRP to hopefully fix this lacking feature.

(Google added the DTBO partition with Android 8, but the theoretically working new boot header for universal boot images was added in Android 10)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ungewiss:
Thanks, Martin.

But it was working some time ago? I remember booting TWRP, even working decryption and I created a backup.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
It never worked with an incompatible dtbo partition like the one from the stock los :)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ungewiss:
But where does this Backup I have here come from? Maybe I was running my own or one of your SODP builds before I migrated to the stock based LOS? Why don't I remember xD
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Exactly, every sodp based rom with the 4.14 kernel is compatible :P
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
TWRP 3.5.0 with added Android 11 decryption is on the horizont

I will update this build, after this commit got merged

https://gerrit.twrp.me/c/android_bootable_recovery/+/3166

(That should mean that all the added code changes get tested well enough)

Edit: Sadly my arch build system (my personal laptop) has a too new python version to build the android 9 based twrp.

So I just can continue to work on my Android 10 based TWRP, which hopefully solves the DTBO problem as well.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Forbiddendnb:
lates stock, clean install dont work.

ERROR 1
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Forbiddendnb:
i have this issue, i download twrp for stock!!!

https://xdaforums.com/t/recovery-an...-0-0-unofficial.4074305/page-21#post-84045149
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] seilent:
maybe you can try the TWRP from this thread (for stock), at least worked for me, not sure either why the one from this thread doesn't work.

https://xdaforums.com/t/rom-10-lineageos-17-1-official.4089775/

but make sure to do "fastboot reboot bootloader" first before booting the image just in case

though if you flashed SODP rom after that, you need to switch to SODP TWRP
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] TheeWolf:
Hi,

Last time I rooted my device was about 3 years ago with my Nexus 5X so I don't remember much, so you'll have to forgive me for the questions...

A few questions:

1. In step number 1:

Do you mean unlocking the bootloader?

I have stock firmware updated with OTA, 52.1.A.3.74. Is that OK?

2. Steps 4-5 - is that done in the ADB console (cmd/WIndows Powershell)?

3. Some people in this thread reported touch doesn't work after flashing this. Does it happen only in the recovery, or also when the phone is operating normally?

4. Is there anything I should have before attempting this, in case something goes wrong? Like a OTG cable or something? (which I don't have).

thank you very much!
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Hi,

no problem, you're welcome

Yes

Yes

That's weird, maybe some rare race condition? But if it happen it should definitely only happen in the recovery.

You always can restore your phone with xperifirm + newflasher, but any issue may only happen, if you use the "install to ramdisk" feature or accidentially flash the twrp.img in fastboot.

Since you only modify the boot partition, it is okay to throw newflasher and the boot.sin of the firmware into a single folder. (And if you flash everything, but don't delete the userdata.sin your userdata gets wiped)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] everett1911:
So earlier I'd soft-bricked my phone and I restored it with sony's official flash tool, and now I'm trying to flash twrp on stock but even after following all the instructions I'm still stuck at the sony boot screen, what can I do?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Please use the stock twrp for the stock firmware and do a "fastboot boot twrp.img"
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
I can't boot into TWRP. I flashed vmbeta many times, I reflashed firmware many times still no luck with booting recovery...

Could you please help me? I have dual XZ2
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
I use the dual xz2 too and just uses the manual.

Did you reboot into fastboot with adb?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
Yes, I booted via adb(I plugged it phone when it's booted into system), then adb reboot fastboot and I did the magic with vmbeta and boot twrp and nothing. It always reboot again into fastboot without booting TWRP
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Are you sure using the stock twrp and not the sodp one?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
Yes, I'm using this one:

2020-06-14_21-07-34_twrp_akari.tar.gz

It's in stock folder in android filehost
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Which firmware region/version?

(But that shouldn't matter)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
I'm in Poland but I have DE Customization ROM
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
I used the same one on my dual xz2 where it works o.O

Did you modify it?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
Nothing at all, I just unlocked bootloader... and I deleted all TA things but it's normal.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
I never deleted the ta files to flash the newest stock 10 customised DE on both slots
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
Do

Do you have those TA files somewhere? If not I will have to download whole sysem once again(4GB :D)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Here

http://www.dhsfileserver.de/ftp/MartinX3/0Tests/XZ2/H8266_Customized%20DE_1313-6279_52.1.A.3.49_R3C.tar.gz

Please tell me, after you downloaded them

And the download size is 2.48GB :P
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
I just checked your files... it's not working. Phone still doesn't boot into TWRP...
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Fascinating

Could you flash twrp with "fastboot flash boot twrp.img" and give me the logs?

A bug report manual is on the first page.

After that you would need to flash the firmware boot.img/.sin back with fastboot/newflasher if you want to boot your phone into android.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
Well, I received an error: recovery: No such partition...

I don't know what's wrong with my system but I think I will redownload system but now XperiFirm gives me error when I try to download firmware: The folder could not be created :D
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Weird, but the partition is called "boot" :P
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
So why I have this erro?

So what now? I managed to download stock ROM with another PC as on my I was received error. I will try to reinstall whole ROM, this time with CE1 customization.

All I did when I received phone is just unlocking bootloader. Did I do something wrong? Should I flash anything before booting TWRP?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Because you tried to flash a not existing recovery partition.

I hope you flashed the newest stock firmware first before unlocking the phone.

(I unlocked it on Android 8 in 2018)

Just the stock ROM like I did. :P
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
I was in latest Android 10 on my Xperia XZ2. But how it's possible that I have not existing recovery partition? 😑 I downloaded CE1 customisation with XperiFirm, I'll flash it today.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Because the device doesn't has it according to the A/B google specification of recovery as boot / system as boot and no manual mentions a recovery partition :P
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
So how I can boot TWRP if it doesn't have recovery partition? Is your instructions on first page fine to follow? 😅
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Of course not, my instructions only exist to brick phones 🤪
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
I flashed CE1, I flashed vbmeta.img, and tried to boot twrp. Nothing happened expect restart of the phone and it again went into fastboot.I don't know what to do, I'm the only one for whom it's not working...

I did this:

PS E:\platform-tools_r30.0.5-windows\platform-tools> ./fastboot boot twrpxz2.img

creating boot image...

creating boot image - 36743168 bytes

Sending 'boot.img' (35882 KB) OKAY [ 0.773s]

Booting OKAY [ 5.631s]

Finished. Total time: 6.530s

PS E:\platform-tools_r30.0.5-windows\platform-tools>
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
So, I think that I have edited DTBO which is not possible as I only unlocked bootloader. If I'm getting black screen after command fastboot boot twrp.img(stock one), what should I do now to have working TWRP? Could you please help me?

:(
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] everett1911:
turns out when I restored the phone with sony's emma tool I ended up with android 10 (the phone's carrier, videotron, choose not to update to android 10) so I thought I was on android 9 and flashed the twrp for that version. I re-restored my phone and everything worked up to the reboot into recovery after installing as ramdisk part, while the touchscreen worked perfectly when I booted twrp from fastboot, now the touchscreen doesn't work now that twrp is installed so I'm stuck at the user password screen, and nothing happens when I try to slide the twrp lock screen slider.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
But what happens if you flash the twrp directly to the boot partition?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Vaith:
It's funny but I made it work. I found special zip on 4pda forum. It had CMD files which was doing the same as you said - flashing vbmeta and booting TWRP. Everything works now, I flashed ExistenZ, I can boot into TWRP with power button and vol down 😎
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Can you execute "/sbin/preptouch.sh" in the adb shell?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
That's weird, but good, that it works now for you :)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ecthelion4:
Thanks for the tip. I had the same problems and this solution also worked for me. The instructions on 4pda can be found here.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] everett1911:
apollo:/ # /sbin/preptouch.sh

insmod: failed to load /sbin/synaptics_tcm_i2c.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_core.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_touch.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_device.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_testing.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_reflash.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_recovery.ko: Exec format error

insmod: failed to load /sbin/synaptics_tcm_diagnostics.ko: Exec format error

I'm using a Xperia XZ2 Compact.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
That's weird.

If you are sure using the newest stock 10 firmware, I would need a "logcat -b all" like described in the first page bug report manual.

But so far it worked on other XZ2C devices.

Also sadly I'm unable to look into the stuff until my exams are done at the end of the month. :(
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
02.03.2021
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] xzfan:
There are only TWRP files for Oreo and Pie for the XZ2 premium, how to use with android 10?

Can't find a guide to install Android 11 for xz2 premium dual H8166?

Anyone get it working?

Can you post the process?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
There is a A10 folder with the stock TWRP on both androidfilehost and the ftp server.

There is no stock developer owning a XZ2 Premium and the camera bionZ hardware vendor didn't allow the hardware to be used in SODP by Sony.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Hello to all better informed:)

I started yesterday to prepare an additional ordered XZ2 for the INstallation of the TWRP from this thread. All recommended tools and drivers I have loaded and installed.

But with the first steps it already hakt. Before the first manipulation on the smartphone, I see it connected via USB cable, in Explorer and can access the internal memory. The drivers are installed. In the device manager, I see the XZ2 under the USB devices.

After switching to USB debugging mode, I can easily enter adb reboot bootloader via CMD and the XZ2 starts with a black blank screen and a blue LED.

After that, the device disappears in the device manager and appears under other devices without drivers with a yellow warning triangle.

Now I can search for it in CMD via fastboot devices, but I find -logically? - nothing and the unlock command waits endlessly for a device.

Trying to install drivers manually (from the Sony website) brings me the USB drivers, but the device under other devices cannot do anything with these drivers.

I'm certainly not a nerd, rather one who somehow gets to his after script, but so far I've unlocked and rooted / ROM'd every one of my devices.

Is it already obvious from this description where I made mistakes?

In another thread I read that Martin assumes in such a case that the drivers for fastboot are not correct / not installed.

How should I do that then?

Thanks for your help, Joska

P.S. The installed stock-ROM is 52.1.A.3.49, renewed by companion.

Translated with www.DeepL.com/Translator (free version)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ecthelion4:
I assume you are using Windows. Then you should - after issuing the adb reboot bootloader command - check in the Device Manager whether you see your phone there with a yellow exclamation mark. Because from your description it sounds like you are missing a fastboot driver. That one you should then install. Afterwards a fastboot devices should give you your device id and also other fastboot commands should work.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Hello Ecthelion4

As I wrote, "

After that, the device disappears in the device manager and appears under other devices without drivers with a yellow warning triangle.

"

There is this yellow triangle. I agree with you, seems to be a driver-problem of fastboot, but, where do I find such driver, if not in the package platform-tools. All other drivers, I#ve found surching through the hole wide web, are very old, or part of a big SDK-Install or part of install-packages with unknown security level.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ecthelion4:
There should be a generic / Google fastboot driver available from the SDK install directory. Or perhaps a search for "windows generic fastboot driver download" produces something useful. Such a driver you should manually install.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Okay, I understand and I did so, my findings often seemed to be oder then 1 year. I will surch for it once more and maybe install the 1GB-SDK-Tool to get the driver of 4,5 kb :)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] der.lange:
Perhaps a possibility: disable signature verification in windows 10 ?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Hello. I did that. No change. I'm a liitle bit confused. Seems, that I am alone with this problems. I installed the Android-Studio, surched for SDK inside Android-studio, but found nothing. Stupid guy?

It seemed to be such a simple problem, but it is impossible to install correct drivers.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Hello

Well have installed android studio, then the SDK tools/SDK manager, but am sceinbar not managing to install fastboot driver with it too. Nor with the Google driver set, the 15-second tools here from XDA.

I can always use adb reboot-bootloder to enter the mode, find the existing phone beforehand using adb devices, but still not after the reboot.

fastboot devices does not generate an error, but finds nothing else.

In the device manager, the yellow triangle always remains under Andoid devices.

After many hours, I am at a total loss.

Now I have tried to find more information in the SDK tools, but after starting I get stuck in a dialogue that offers me 17 components to update, but the button to do so is greyed out. Even after confirming the terms and conditions, the button remains greyed out, update and extension not possible.

I've never been this lost, I've rooted every phone I've used for about 10 years and supplied it with a new ROM, mostly LOS etc. I've never been able to do this before.

Translated with www.DeepL.com/Translator (free version)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] seilent:
you can use zadig to install fastboot driver in windows 10
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] ML11:
I had problems with installing fastboot drivers on Windows 10 as well. Sometimes after my device disconnected I had to install the drivers again. In device manager try updating the drivers for Android device by loading the drivers from your disk. In my case I was looking for *.inf file, then select Bootloader driver and update. Your phone should be now detected in fastboot mode. This solution may be only temporary, I do not know what causes this but sometimes I have to repeat the procedure when my device is not detected by fastboot (check it before using other commands with: fastboot devices).
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Next step:

"windows has found drivers for the device but an error occurred during installation"

An info without overload of information ;-)

Driber installation failed, Timeout ;-(
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
There was an error while driver installation, system couldn't find the file...

boah, no hint why it is not possible

EDIT: It worked :-) Bootloader unlocked.

Next stepts will follow. Flashing of vbmeta.img und twrp.img was sucesfull. I installed twrp-akari.img. Should I rename ist before to twrp.img?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Update to newest stock firmware before unlocking!!!

Unzip the *.gz files with https://7-zip.org/ or Linux.

Enter fastboot via software, not hardware buttons. See "Known Bugs".

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img

fastboot boot twrp.img

Till that, seems to worked, but no reboot into TWRP. Can'treach any advanced menu.

What should I do now?
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Did this:

"D:\Programme\Portable\platform-tools>fastboot boot twrp.img

Sending 'boot.img' (34116 KB) OKAY [ 0.949s]

Booting OKAY [ 5.638s]

Finished. Total time: 6.771s"

After this, phone is rebooting to black screen with blue LED, then reboot twice to black screen with text: device not saved, reloch bootloader...."

Then starting up to original ROM.

No boot into twrp.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ecthelion4:
I had the same problems. As mentioned in this posting, I was able to boot into TWRP using another TWRP version. Perhaps this also works for you. Unfortunatetly, though, I was afterwards not able to install the Pixel Experience ROM that I wanted to use TWRP for :-(.
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Little more success: First of all, my failure using the wrong TWRP.IMG (11). Last hour, I used der TWRP-AKARI.IMG and VBMETA.IMG. With that, I was able to flash VBMETA und boot into that twrp. It is TWRP for STOCK (Android 10).

Now, with Volume down and power on, I boot into TWRP 3.4 :)

My next question is: Does this STOCK TWRP work, to install LOS 18?

Regards and thanx4helpm Joska
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Hello

Now I have to specify my question: The TWRP I installed was created for the STOCK ROM verion (10). Can I now install any other ROM with this version, or only SODP variants? If I should then have installed a SODP (Android 11beta), I have to adjust the TWRP version?

Greetings, Joska
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Hello,

the twrp is part of the boot partition and gets removed if you install another ROM.

The twrp just needs to match the dtbo partition and android version.

Greetings, Martin
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] Ecthelion4:
Can you explain how to find the right TWRP that matches the dtbo partition? I wonder whether my previous problems regarding the TWRP and Pixel Experience ROM installations are only due to the wrong choice of the TWRP variant...
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] MartinX3:
Just all SODP ROMs using the OEM.img file and the 4.14 kernel are matching the SODP TWRP

Just the Android version need to match or your userdata wont decrypt in TWRP.

The stock TWRP works for the vanilla stock firmware.

On stock based custom ROMs it depends if the custom ROM developer did modify the DTBO partition

As example the stock based lineageOS isn't compatible

To workaround this, the next TWRP version should include the DTBO in the boot.img to make an independent TWRP.

In theory it works with the ne android 10/11 boot headers.

But I don't know if it works practically. My exams did now, I will make a bit holidays and then start working on it. :)
[Sony Xperia XZ2 ROMs, Kernels, Recoveries, & Other] joska59:
Good luck and welcome back after holiday :)