yashsingh1/xdaforums huggingface dataset:
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Rooting this phone is like the red pill vs blue pill scene from the matrix. If you take the blue pill, you don't root your phone and you wake up in your bed and believe what you want to believe. If you take the red pill, you root your phone and you see how deep the rabbit hole goes. But if you take the red pill you can never go back to a fully stock phone because the DRM keys are list when you unlock the bootloader and therefore will either have to keep the phone rooted so you can use janjan's kernel and fix to have a functioning camera OR you relock the bootloader but never get the DRM keys back and go back to stock and lose the camera in favor of taking green screen photos (every photo just turns out as a blank green screen).

Rooting is well worth it since with the fix you restore all functions but you do technically lose the DRM keys forever so it will be harder to resell it if you ever decide to.

We all made the jump and all are happy.
[Sony Xperia XZ1  Guides, News, & Discussion] postz:
After you root, can you restrict root privileges so that some apps don't have them, or better yet so that apps only get root privileges once explicitly given? Perhaps SuperUser can do this?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Of course, just like you can with any other phone
[Sony Xperia XZ1  Guides, News, & Discussion] postz:
Excellent. Thank you very much for your answers and for responding so quickly. :good:
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
My pleasure
[Sony Xperia XZ1  Guides, News, & Discussion] tummycj:
Will this work with the latest firmware?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
No, not until janjan releases an updated kernel and hopefully we get an updated TWRP from modpunk
[Sony Xperia XZ1  Guides, News, & Discussion] oF2pks:
Did any tried decryption: format /data + flash NOverity-opt-encrypt(V2) to change "fileencryption" to "encryptable" in /vendor/etc/fstab.qcom ?

Anyway, thx for compilation/guide; for further info, attached is (crypted)fstab & parted for (12.75) xz1...
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
hello friends. I just buy a new XZ1 and i am a noob sony user, after 3 years use Sam Sung phone.

As i understand, i don't need to unlock bootloader to install TWRP and Kernel+ DRM fix from OP 's guide ?

Am I wrong ? Please any one can help me step by step to install TWRP and other things ?

Thank you very much ?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Right in the OP brother
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
I need to update this guide today with the latest files and info.
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Installing TWRP on this device is the same as on any other device.

Adb reboot bootloader

Fastboot flash recovery path/to/recovery/image.img
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
Ok . Thank you very much for support. I understand now. I will lose DRM key but i have drm fix so no feature will lose. Right ?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Exactly
[Sony Xperia XZ1  Guides, News, & Discussion] oF2pks:
Just checked that [MENTION=490110]janjan[/MENTION] kernel is not obligatory : only the 2/3/4-zip to have Magisk/SafetyNet ok & Vendor/secd ("DRMfix").

But with both 1275 kernels I have : red log errors

(vendor/bin/hw/vendor.qti.harware.perf@1.0-service)
04-16 14:03:41.995 928 1027 E ANDR-PERF-OPTSHANDLER: Warning: Core control support not present for lock_min_cores on cluster 0 for this target
04-16 14:03:41.996 928 1027 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [4, 0]

any idea ?

Also finally tried my beta build of aosp (updater-script:2 first deleted) and sad to realize that Treble/Widevine/Encryption are missing from github/xperiadev sources; will try new build with widevine... (but microG + Camera + SnapdragonMusic ok)

So switching to custom rom can also broke Xperia encryption

. In order to come back to Xperia rom (

without PC

), you better need an SDcard with 2/3/4-zips and 2 different backups:

a)original

unpatched minimal

Xperia : /boot/system/oem/vendor

b)your last target backup : /system/data(patched)

Then you need a)+ format /data(yes) & wifi connection to re-settle encryption via 1st boot + Google account;

Xperia original recovery is not needed

: works fine with twrp on /recovery (FOTAkernel). Reboot to twrp to flash 2/3/4 zip (optionally with janjan kernel and boot once for check).

Finally (otherwise you get flash error on /data), you can now restore your target backup b) :

ONLY

/system & /data. + wipe Dalvik & cache.

EDIT : whatever I tried, I could not decrypt Xperia rom or keep Playstore <certified>, BUT SafetyNet/Magisk ok with WidevineL1 and secd ("DRMfix") working.
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
With all due respect, let's keep the thread on topic. If you want to talk about a different ROM then please create a new thread in the appropriate channels.

I'm not exactly sure what you mean by janjan's kernel is not obligatory. Every time I upgrade the firmware and the kernel,I flash the firmware, then kernel, then in TWRP I flash the #2 and #3 files and I always have a flawless experience.
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
Waiting for update for 145 firmware.
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
Hello sir, thank you for your work to keep update this thread.

I have a question:

I read page 1 and 2 and somebody say that need to flash boot.img to both boot and FOTA. Can you give some details for this because I don't see it in OP
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
No there's no need to flash to FOTA, just follow the guide.
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
Thank you very much
[Sony Xperia XZ1  Guides, News, & Discussion] Aftab_khatri:
How to update after modify system ?? How to get security updates
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Flash the newer firmware using flashtool or newflasher. There's plenty of guides out there to detail the process.
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
hey [MENTION=3666806]N1ghtr08d[/MENTION] - i just want to say thank you. i upgraded from .75 (hk) to .145 (my) firmware tonight on my xz1 dual and everything went flawlessly.
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
No problem. It's my pleasure to be able to help.
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
After unlock bootloader and install TWRP, root, how can I update if it have new firmwares from Sony?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Read 3 posts up this thread ?
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
easiest way is to use flashtool - http://www.flashtool.net/downloads.php

flashtool has xperifirm baked into it, which allows you to download and install the latest firmware. there are lots of threads on how to use it.
[Sony Xperia XZ1  Guides, News, & Discussion] hungvip2001:
Thank you, guys. Now I have root and twrp in my phone. This is my last question:

When I flash new firmware with flashtool, I have to follow this guide again each time ?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Yes you do. Every time you update the firmware, you're going back to stock setup so following this guide is necessary every time.
[Sony Xperia XZ1  Guides, News, & Discussion] nerak11111:
Hi, i followed this guide but this feature doesnt work for me,

do you know if with this guide https://xdaforums.com/xperia-xz1/development/oreo-xz1-drmfix-root-ricoffo-t3727030

it will work?

and if i want try oreo-xz1-drmfix-root-ricoffo i must flash stock firmware first '?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
That guide you're referring to is an old guide for an old firmware, I have no idea if it works anymore or not.

If you followed my guide and failed then I promise you you've gone wrong somewhere down the line. You'd be the only person with this phone that the process wouldn't work.
[Sony Xperia XZ1  Guides, News, & Discussion] nerak11111:
thanks for your reply

everything else it works only video image enhancement dont work :(
[Sony Xperia XZ1  Guides, News, & Discussion] NeilChiu:
Will my phone's data be erased？
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Only when you unlock the bootloader.
[Sony Xperia XZ1  Guides, News, & Discussion] baskwo:
Is there any cons from doing this? Like no more OTA update? Feature doesn't work, things like that.

Thanks
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
You lose ota updates but that's true of any phone you unlock the bootloader on, but you can simply use newflasher to flash any new or old firmware to the phone. There's plenty of guides out there on his to use newflasher, it's very simple.
[Sony Xperia XZ1  Guides, News, & Discussion] spippo:
thank you very much for your reply and for saving my camera and Sony features!
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
confirming that these instructions continue to work flawlessly for the xz1 dual (g8342) with janjan's .179 kernel and latest version of twrp (twrp-3.2.1-0-poplar-7).

permissive script took a much longer time to complete (~90 seconds) where the phone becomes unresponsive. be patient, let it do it's thing, enjoy your may 2018 security patch.
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
I may be doing something wrong at the step 5, or maybe messed up on previous steps...

First, I installed XZ1 drivers to PC. Then flashed Generic LAM 47.1.A.12.179_R10B to match with kernel version of Jan Jan. That version was not available to me by FOTA. Good news is that I maybe learned how to downoad firmware by XperiaFirm and convert it to flash using Flashtool. I guess it worked, because the phone seems fine.

Then, enabled developer options and turn USB debug on.

Download the files from step 1:

"gpgkey-8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D"

"twrp-3.2.1-0-poplar-7.img.asc.txt" (833b) and renamed it to "recovery.img.asc"

"twrp-3.2.1-0-poplar-7.img" (29mb) and renamed it to "recovery.img"

and did the command "gpg --keyring ./gpgkey-8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D.gpg --verify recovery.img.asc" and get the message "good signature..." even though I have no idea about what it means, but I was followign the tutorial abour installing TWRP. :confused:

Then, a downloaded the JanJan kernel udated files, that are four:

1-kernel-XZ1-G8341-kernel.zip

2-Patching.zip

3-Magisk.zip

4-kernel_permissive.zip

and copied all them to internal storage of the phone.

Phone is connected in File transfer mode, with USB debug enabled.

I started a comannd prompt from start menu to try the step 5:

5: Open a cmd window on your pc and type the following:

adb reboot bootloader but I got the message command" is not recognized as an internal or external command, operable program or batch file.

I restarted the pc and the phone (noob workaround for everything that works sometimes), terminated all instances of Xperia Companion and Flashtool, since I don't know if they could interfere, and tried again, but got the same message. Tried to open command prompt from the directory that the files are saved at PC, and still the same message.

Any tips for inexperienced users? I may be missing something simple and stupid... So, any opinions are very welcome! :rolleyes:

I had rooted all my android phones before (Xperia ARC, Xperia Z, Z2 and Z5) but it semms rooting sony phones is getting everytime more complex across the years. :confused:

I still dream about the day that XDA senior members will be contracted by Sony to offer special versions of their brand new phones, factory rooted, bloatware free and with TWRP preinstalled! :D
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
you didn't set up adb to be allowed to be run from anywhere. follow this guide: https://www.xda-developers.com/adb-fastboot-any-directory-windows-linux/

alternatively, you can just go to the folder where adb.exe is installed and run the commands there. i'd strongly suggest doing a sanity check and run "adb devices" first to ensure adb detects your device.
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
Thanks, the command worked when I started cmd from the directory that adb. exe was installed. But can't flash it in locked state. Time to unlock bootloader to continue....

I"ll try this guide:

xdaforums.com/xperia-xz1/how-to/how-unlock-sony-xperia-xz1-bootloader-t3758742/amp/

Is it possible to backup drm keys and restore it if necessary, or it won't be missed at the end of this guide, considering it can keep sony stuff working?
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
Actually what I do instead of typing the whole path is I simply drag and drop the image from my folder onto the cmd screen and it inputs the path itself.

That should take a grand total of 2 seconds to flash. Once it's finished, just unplug your phone, wait for the LED light on the phone to turn off then press and hold power and vol down together until the phone vibrates once then release both buttons. Wait a few seconds and it'll boot into TWRP for you. Enter your lockscreen pin/password to decrypt the data partition.

Mine is rebooting automatically to TWRP... I'm trying to reboot to system, and it only reboots to TWRP. No passwords were asked... Should I continue flashing files 2, 3, and 4 or repeat "fastboot flash recovery path/...recovery.img"?:confused:
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
When does it automatically reboot to TWRP on its own? That should not happen, and if you're not asked by TWRP for a password to decrypt the data partition then that means you have the wrong version installed. Install the latest version that modpunk created, it is new in the respect that it doesn't have to keep getting patched with every security release anymore.

Also what firmware are you running? Do you have the correct kernel for that firmware from janjan?
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
Thanks very much for your reply.

It starts to boot only to TWRP after step 6, after flashing boot.img.

It seems be flashed correctly, but can't boot to system., only to twrp

Firmware version:

47.1.A.12.179/R10B Generic LAM Customized GEL

For my region, only .145 was available. So I choosed generic Latin America fw.

I downloaded and created ftf file, but I included all files. I'm reading now that .ta files should not be included.

I used the latest files for TWRP - May 16:

twrp-3.2.1-0-poplar-7.img renamed to recovery.img

twrp-3.2.1-0-poplar-7.img.asc.txt

Kernel files: SONY-XZ1/[G8341]-[47.1.A.12.179][10/MAY/2018]

1-kernel-XZ1-G8341-kernel.zip renamed to boot.img

the other files (2, 3 and 4) were copied to internal storage.

boot.img and recovery.img were copied to adb.exe directory, to use drag and drop method to flash them.

As I cant't boot to system, I can't see if the kernel has changed to continue the tutorial. ...

Oh, if TWRP is installed, but it only shoud be after flash recovery... Wow... I think I flashed recovery.img first instead of boot.img or messed it while renaming files :rolleyes:

Ok, I'll recreate and flash fw again, excluding all .ta files this time, and restart from the first step.

Thank you!

---------- Post added at 10:03 AM ---------- Previous post was at 09:37 AM ----------

Flashed FW again... turned on USB debug. Flashed boot,img and

"your device has been unlocked and can't be trusted" message just turned to

"Your device has failed verification and will not work properly" and powers off in 5 seconds.

:crying:

I flashed TWRP after and managed to boot from it, but no passwords were asked again.

I tried to flash boot.img again and. Sending and Writing boot shows OK at cmd.

It semms that this FW is not compatible to kernel. Which one of .179 options and region should I use while downloading it from Xperia Firm?

Thank you!
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
What is your model number? Are you sure you have a 8341?
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
Yes.. G8341 SI 1310-9540 REV 5 Xperia XZ1.

I'll try to flash 47.1.A.12.179 Customized DE R9B firmware.

While flashing the new .ftf file, should I exclude all .TA files? Some guides says that .TA files are incompatible to some devices, but I haven't found nothing specific to XZ1 yet...
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
Delete every .ta file you find
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
Just flashed 47.1.A.12.179 Customized DE. No TA partition files in that bundle. I selected all wipe options under SIN box...

The yellow warning of BL unlocked message is back. Phone boot normally to system. I skipped all first start options, enabled developer options and turned USB Debug On.

Connected it to pc and selected the option to always allow USB debug with that PC and copied files 2,3,4 of janjan kernel to internal storage.

Closed flashtool.

Started adb, reboot phone on bootloader and flashed boot.img by drag and drop.

Sending boot okay.

Writing boot okay.

Finished

Disconnect it and powered phone on...

And now I have the red warning message again "Your device has failed verification and will not work properly" and it powers off in 5 seconds."

When turning it on holding volume down, the yellow alert comes back, but a few seconds later, the red comes again and power off the phone. I guess thats because TWRP is not installed to bott from there.

I'm sending the firmware flash log attached... maybe there's something wrong at that :confused:
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
You'd want to ask the devs about logs. None of the guide is my original work (that's posted in the disclaimer), all I did was put together the guide on the process.

I haven't upgraded to 179 because I just can't be bothered anymore so I can't speak from experience on that firmware but the process is exactly the same for all firmwares. I'm currently running 145 and I have no problems.
[Sony Xperia XZ1  Guides, News, & Discussion] .LEONARDO.:
:fingers-crossed:I reinstalled JAVA , uninstalled and reinstalled flashtool, download and flashed a .145 rom, and finnaly managed to go to the end of the tutorial. Magisk is installed and SEL Linux Permissive active. But after step 10, when booting to twrp first time, no passwords were asked to decrypt data partitiom. I was not using any lockscreen security password. I still haven't fugured out why no passwords were asked on firt twrp boot. May I have any problems?:eek:
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
It's weird that you're not asked for a password but then again it may be because of the new TWRP and you not having a lock screen security. The only thing you need to worry about with TWRP is.... Even though you're not asked for a password, can you see the files on the data partition normally or are they scrambled/encrypted?

That's the only reason the password is required on my device, to decrypt the data partition. If you can read that partition then you've absolutey no problem my friend
[Sony Xperia XZ1  Guides, News, & Discussion] shaggydiamond:
TWRP asks at first boot to allow modifications or keep system read only. Thoughts?
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
you must allow it to make modifications otherwise the necessary file system changes can't be made.
[Sony Xperia XZ1  Guides, News, & Discussion] shaggydiamond:
ah no! i didn't choose that option. Also, after flashing the last zip. my phone turned off and wont turn on! What can i do? Edit: i panicked but i did a hard reset. its okay now.
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
typically, this doesn't brick your device. try doing a hard shutdown by holding power + volume up for 6 seconds until the phone vibrates. keep holding it to force it to power down (and then boot it up normally by holding power), or release it after vibration for it to reboot. then start the instructions all over again and properly flash your device.
[Sony Xperia XZ1  Guides, News, & Discussion] shaggydiamond:
yes thanks, that did it! Trying again.

---------- Post added at 01:22 AM ---------- Previous post was at 01:03 AM ----------

I can't get that prompt to show up again which allows the modifications. Tried reinstalling TWRP but the popup never comes. The last flashable zip in the guide made my device screen turn black(twice) during install and a hard reset was required. How can I see that the last zip flash was succesful? My modules section in Magisk is empty.
[Sony Xperia XZ1  Guides, News, & Discussion] alexkatayama:
not sure - the only way i know how to get that prompt back is re-flashing TWRP which should reset the permissions. you might need to do some googling.
[Sony Xperia XZ1  Guides, News, & Discussion] Matzeee:
It succeeded on my phone without allowing the modifications.

Follow 2nd method (written in janjans thread) and "flash" 4.zip through magisk.
[Sony Xperia XZ1  Guides, News, & Discussion] iiiPlex:
errors...

Hi, I'm new to this whole 'flashing' thing.

I'm currently getting this error using my XZ1 (G8342) in fastboot -

[IMG=":("]https://i.imgur.com/ITlTfQ4.jpg[/IMG]

-Yes I have oem unlocking enabled

-Yes I have reinstalled all ADB and Sony drivers

-Yes I have tried using Flashtool and it gives the same output

Thanks for any replies.
[Sony Xperia XZ1  Guides, News, & Discussion] TurkO546:
You need to unlock your bootloader first
[Sony Xperia XZ1  Guides, News, & Discussion] iiiPlex:
Nevermind - Figured it out, thanks!
[Sony Xperia XZ1  Guides, News, & Discussion] vyovyo:
N1ghtr08d Can you record a complete instructional video?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
No. I've enough on my plate these days and don't have time to make videos. I wrote the instructions to be as easy to follow as possible. In fact it's easier to follow the written guide since you can copy/paste any of the commands if necessary and you can't do that with a video.

Sorry.
[Sony Xperia XZ1  Guides, News, & Discussion] sinkoo1979:
Would this work on XZ1 SO-01K (Japan Docomo Variant)?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
What's the model number? G8341? G8342? G8343?

My guide covers 8341 and 8342 because there are kernels written for those variants. If you have a different model number then I doubt the guide will work since there's no kernel written for it.
[Sony Xperia XZ1  Guides, News, & Discussion] monsieurlezard:
Thanks for the great work!

Anyway, flashing permissive-kernel never worked in recovery (10 times or more trying!) but it worked throught Magisk Modules...

if it's the case for most users, maybe you should mention it in the tutorial?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
What firmware were you using?
[Sony Xperia XZ1  Guides, News, & Discussion] monsieurlezard:
i use the .179
[Sony Xperia XZ1  Guides, News, & Discussion] Andy3105:
This looks amazing, thanks but does it still maintain OTA updates....?
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
No, unlocking the bootloader you lose OTA updates but your can very easily flash them using newflasher or xperifirm
[Sony Xperia XZ1  Guides, News, & Discussion] Andy3105:
Thanks for the reply ?
[Sony Xperia XZ1  Guides, News, & Discussion] Lavievn:
tried install last zip file in TWRP but my phone keep screen blacked, but it's can install directly from magisk (touch on + button and find 4-permissive-kernel.zip and install it). thanks you :)

P/s : everything working good on .205 firmware :D
[Sony Xperia XZ1  Guides, News, & Discussion] N1ghtr08d:
I finally upgraded to .205 and I had the same issues as you guys reported regarding the permissive kernel so I'm gonna edit the op.

Thanks for the heads up guys.