yashsingh1/xdaforums huggingface dataset:
[Xperia Z2 General] prazvt:
OK - this is what I did:

1. Flashed a fresh clean version of .314 FTF for my locale (USA) (created it from Experifirm download via Flashtool)

2. Ran the rootkit; the message I saw in your screenshot is one I saw when initially I tried running the rootkit in .167 (ie the first day trying to root .167). Running this in .314 (with adb working properly, usb debugging on, granting connection on the phone, etc.) should work fine

3. Ran the DualRecovery installer to get TWRP/CWM

4. Followed Nut's DIY Guide to convert system.sin to system.tgz:

- I used his Ubuntu VM, so there's some pre-work to be done (install VM player)

- Copied the system.sin from the FTF of .167 (which I created from Flashtool after downloading w/ Experifirm)

- Extracted Data using SIN Editor within FlashTool (in Ubuntu)

- Ran the ROM builder script in his VM, which resulted in system.tgz

5. Dropped that system.tgz into the flashable zip mentioned earlier

6. Flashed the zip in recovery

7. Flashed .167 FTF in Flashtool, excluding SYSTEM

8. Booted up. Root works fine.

Of course after all that work, I ended up unrooting as for now, it breaks PS4 Remote Play :) But, now I know how to do it, so that was part of the exercise. But otherwise the above procedure worked for me.
[Xperia Z2 General] divanikus:
You mean flashable or preroot brick? If flashable, turn one page back, i've posted the instructions. If brick, you have to get system.tgz from your firmware first.
[Xperia Z2 General] anoevo:
u say that there is no easy way to make a root .

and that is really annoying
[Xperia Z2 General] anoevo:
I texted sony mobile.

And that was their response!

Sent From Xperia
[Xperia Z2 General] juanpirulo:
You can include Kernel fotakernel and the other staff in your prerooted flashable zip with no worries and you will get your rom in one step. Cheers
[Xperia Z2 General] DelacroixEX:
so that flashable is to install a preroot .167 firmware? im not brick or anything though coz im trying to install a rom rite now.. currently on cm11, i was going to try niaboc79 rom but i saw yours then i tried to compare it seems different inside the flashable zip between them so i was confused.
[Xperia Z2 General] lee480:
Yup

I managed to enable NC and system mount.
[Xperia Z2 General] Ningyou Higeki:
Succeeded? How did you do that? I still can't get system R/W...:crying:

---------- Post added at 01:48 PM ---------- Previous post was at 01:36 PM ----------

This is really effective, but someone can get system R/W while the others can't. Still confusing...
[Xperia Z2 General] norti:
I've made a patched version of the latest flashable DualRecovery, I updated the thread, download the patched recovery installer from 3.3 and flash it through recovery. That should fix system R/W mount. (I will commit a patch to [NUT]'s github...)
[Xperia Z2 General] lee480:
FIX UMOUNTABLE SYSTEM:

http://xdaforums.com/showpost.php?p=56608574&postcount=1
[Xperia Z2 General] tazoman:
U did this in locked bootloader right?

Sent from my D6503
[Xperia Z2 General] divanikus:
Ok, to make things clear, i'll write everything in one post. Method is based on Desperanto86's work.

How to build your own prerooted package

Mine method is based on NUT's DIY guide. There you extract system.sin from your firmware's FTF (with Flashtool), extract system.ext4 from it and repack it to system.tgz. Almost everything can be made on windows, but mostlikely you'll have wrong permission in the resulting tarball. So better stick with Linux.

Install script formats system partition, extracts system.tgz there and copy all your patches specified in the install script. I've made a preroot brick package d6503_23.0.1.a.0.167_preroot_brick.zip. You can delete everything in updater folder and extract it there. It contains SuperSu, Dualrecovery and SDcard permission fix. I've also included tzdata update, because I live in a country there timezone just have been changed, but Sony didn't updated databases yet.

After Building the (unsigned) flashable ZIP step of NUT's guide you'll have your prerooted firmware. You might also leave updater folder as it is, just get resulting system.tgz file and drop it into preroot brick zip and you'll have the same results.

As an example, i've posted mine results for russian unbranded firmware what can be found here: d6503_23.0.1.a.0.167_ru_root_tzfix_recovery.flashable.zip MD5: 4B8CCF7902E4553C123E0F69E6539924

How to flash

Everything can be done on a locked bootloader. Your prerooted zip updates system partition only. To make things work, you have to flash radiomodule and other stuff from original FTF (D6503_23.0.1.A.0.167_Customized_RU for mine example file).

1. You should be on rooted firmware with dualrecovery installed. It might be .314, for example. You may downgrade using Flashtool. No bootloader unlocking is required.

2. Copy your prerooted zip onto your phone.

3. Boot to TWRP recovery (you may use NDR Utils for that). Do wipe (WIPE > ADVANCED WIPE > SYSTEM + DATA + CACHE + DALVIK CACHE)

4. Flash your zip.

5. Turn off phone. DO NOT TRY TO BOOT.

6. Using Flashtool flash everything, except SYSTEM: tick SYSTEM in exclude window, also tick No final verification.

7. Turn on your phone.

8. Profit.
[Xperia Z2 General] DelacroixEX:
Okay.. I tried the step above, and everything is working fine. Hehe.. I was confused between your method n niaboc79 one. So yours step need to build preroot system zip 1st, flash it then flash remaining things with flashtool while niaboc79 is a whole rom, no need to flash anything else. Am i correct? Thanks for the help. Now i got root wehee..
[Xperia Z2 General] juanpirulo:
I ve been using nuts diy guide till i discover PrFcreator its much easy to use. You get the flashable zip with dualrecovery and supersu and Kernel Just in one step. Cheers
[Xperia Z2 General] divanikus:
Yup, you are correct. Mine is just a simple method to create your own prerooted system from official firmwares.

Yes, but i'm unsure what PRF actually does, but here I can control every step of the creation.

I have reviewed niaboc79's ROM. It flashes system, data and kernel partitions. It doesn't update baseband or whatever else original FTF has to update.
[Xperia Z2 General] norti:
PRFCreator does the same in Windows as [NUT]'s script in Linux, no need to worry: it decompiles system.sin, creates a zip with system.img, supersu and dualrecovery flashable packages and provides an install script for the recovery. So it's the untouched system image from the ftf update. And the rest of course, if you include them too. No need to control everything :)
[Xperia Z2 General] Hessi93:
So there is no way for me too root .23 firmware? I was rooted before I updated, but was a little bit to fast on the update button...
[Xperia Z2 General] juicejuice:
If you read this thread you will see the answer. Or if you go to the Z2 General forum you will find guides on rooting. What you can't do is use EasyRoot at this stage. You need to flash a pre-rooted FTF.
[Xperia Z2 General] Hessi93:
Well, I have created an flashable zip-file, but I'm not sure how I should flash it, as I don't have an custom recovery anymore, and ain't able to install one without root. Can I flash it through Flashtool by remaining the file to ftf?
[Xperia Z2 General] bdithug:
No, as it's been stated many times here in the z2 forums, you must already have root with recovery in order to flash a flashable zip. Therefore you must downgrade, root, and add a recovery. Then you can flash your pre-rooted flashable zip.
[Xperia Z2 General] Hessi93:
Thank you dude! I don't have time for that now. Hopefully there will be a way to root without needing to downgrade first.
[Xperia Z2 General] ghostofcain:
Wouldn't hold your breath. Whilst downgrading and installing pre-rooted zip is time consuming, it's fairly trivial and developers have L to aim for rather than finding another way to root this firmware.
[Xperia Z2 General] zhuhang:
As long as root is possible, one-click method is not compulsory. But definitely the latter is more preferable.
[Xperia Z2 General] Parul.Prabhat:
Could you please tell me if i can update by device:

1. OTA update is available from today on my device

2. I have root and supersu pro

3. I have enabled survival mode in supersu pro

4. I have locked bootloader

5. I had rooted 4.4.2 by easy root tool

6. If the survival mode succeeds, would i lose write to system ability? I guess i need that for xposed modules to work

Kindly guide. Thanks in advance to you amazing android devs!! :)
[Xperia Z2 General] Uhuhu:
[MENTION=3293331]parul[/MENTION], I'm on the same boat.. But I'm getting a "could not verify"... Weird..
[Xperia Z2 General] colacin:
I'm in the same situation - I'm told it's due to having a custom recovery.

Check this thread: http://xdaforums.com/xperia-z2/general/how-kept-root-167-t2936269
[Xperia Z2 General] Uhuhu:
Still, I'm on stock recovery, but with root..

I think I figured it out..

The "rootkitXperia_20140719" does change the recovery.. Maybe that's why I thought that the phone was stock. It isn't.. I'll have to revert back to stock recovery..
[Xperia Z2 General] Parul.Prabhat:
Same here. Says "couldn't verify". Maybe its due to xposed framework and modules
[Xperia Z2 General] jbbandos:
My experience with the Z1 Compact and the Z2 tablet is that you'll keep root, but will lose system write. However, running the dual recovery installer will disable sony_ric and enable again system writes, so that is all you need to do after the OTA.

I also recommend removing xposed before the OTA, it is safer to re-install it afterwards.
[Xperia Z2 General] Dingoman10:
Realized something strange regarding to X-Reality and Supervivid-Mode.

In Settings/Display i can tick X-Reality to on.

After a reboot it is unticked.

But when I reboot with powercable in phone it stays on until I release the cable.

Then I have to turn X-Reality or Supervivid-Mode manually on again.

Could someone with stock 4.4.4 firmware test it if he has same issues?

Maybe a bug in. 167?

EDIT: Was able to reproduce the issue. If you have activated Stamina-Mode then Xreality an Supervivid will be deactivated when you pull off the power cable.
[Xperia Z2 General] niaboc79:
Stay on topic guys, this thread in ONLY about rooting latest firmware.
[Xperia Z2 General] Parul.Prabhat:
Thanks a lot. Sorry for noob questions but which dual recovery would you recommend. Should i install dual recovery after OTA to enable system write :)
[Xperia Z2 General] Lagamorph:
Hm, think I'll wait for the Easy Root or something similar to be available and stay on 4.4.2 for now.

I rooted using Easy root before and haven't installed anything like a Custom Recovery. I'm trying to avoid that so going with flashing a pre-rooted ROM is a no go for me. Haven't/Wont unlock my Bootloader either.

Once a method to root 4.4.4 is out I'll update using PC Companion, which I know will un-root me, then just re-root.
[Xperia Z2 General] stubbadub:
I have just received the OTA upfdate notification on my EE rooted 4.4.2 stock ROM

I ran the update and it rebooted and i still have root.
[Xperia Z2 General] Lagamorph:
Really? That's pretty interesting. So when you run Root check it confirms your root is still present?

You've confirmed in version information that it has been successful in updating to the 4.4.4?
[Xperia Z2 General] ghostofcain:
I wouldn't be that surprised if we're on Android L by then, why would developers waste time looking for a security flaw to exploit when rooting via downgrade is so trivial? Your best hope is the Z3 boys discover a software flaw that'll work on Z2 roms.

---------- Post added at 05:11 PM ---------- Previous post was at 05:10 PM ----------

Yes that happens with some of the OTA upgrades. Enjoy.
[Xperia Z2 General] stubbadub:
Yeah, just ran the OTA update, couldnt verify first time due to dual recovery. Set that back to stock and ran the OTA.

The update went through fine and when rebooted folder mount worked. checked all my apps that require root and they all work.
[Xperia Z2 General] Lagamorph:
Risked an OTA update and can confirm I've also kept my root afterwards. Root Checker reports rooted and SuperSU is working normally, as are my Xposed modules.

I have no custom recovery and my bootloader was locked. Was running 4.4.2 previously that had been rooted through Easyroot kit.
[Xperia Z2 General] Radu_Stancu:
Downgrade

Hey guys,

I have a question related to downgrading back to 4.4.2. I read somewhere that there is a chance of losing the phone`s IMEI if you downgrade via FlashTool, is it true? I updated my Z2 via PC Companion and lost root. My plan is to downgrade back to 4.4.2, root it, and update back to 4.4.4 via OTA. My Z2 Tablet just got the OTA notification today, did the update and it still has ROOT ( all apps that require root work).

My only problem is downgrading... I`m not sure how it`s done. If someone could guide me, I`d really appreciate it.
[Xperia Z2 General] Parul.Prabhat:
Did u uninstall xposed before the OTA update?
[Xperia Z2 General] Lagamorph:
No. Didn't un-install or disable anything. Just ran the OTA update and let it install. After it finished everything was working immediately including my Xposed modules.
[Xperia Z2 General] lubluchka:
But can you change system files (i.e can you paste files in the system folder with root explorer)? I still have root, but I can't do this. Further Xrecorder isn't working (the remaining xposed modules work fine).
[Xperia Z2 General] chinedu40:
Please guys just look here.

http://xdaforums.com/xperia-z2/help/how-kept-root-167-t2936269
[Xperia Z2 General] lubluchka:
Thanks, I saw that, but I can't figure it out how to make a mac script out of windows file :(
[Xperia Z2 General] raystorm1777:
noob question

I am rooted with dual recovery

How to set back to stock recovery

Thanks in advance
[Xperia Z2 General] kamalmawa:
There's no such a thing called stock recovery with new Xperia line.. But if you wanted to remove the dual recovery delete the following files:

/system/bin/recovery.twrp.cpio.lzma (or .tar)
/system/bin/recovery.cwm.cpio.lzma (or .tar)
/system/bin/recovery.philz.cpio.lzma
/system/bin/charger
/system/bin/ric
/system/bin/chargemon
/system/bin/dualrecovery.sh

Then inside */system/bin/ rename chargemon.stock to chargemon check its permissions (should be 755 or otherwise visible as -rwxr-x-r-x).

or simply flash stock FTF exclude everything except SYSTEM, and do not wipe anything. But you will loose root

Source : http://xdaforums.com/showthread.php?t=2261606
[Xperia Z2 General] raystorm1777:
Thanks

Will try it
[Xperia Z2 General] Lagamorph:
Hm, on closer inspection when I open SuperSU I get a notification that no SU binary is installed and the application can't install it. This is unusual as just earlier today I installed Viper4Android and SuperSU prompted me to grant it Root access, I can even see it in the Apps list behind the warning prompt.

EDIT - And after rebooting my phone, I can open SuperSU no problem and get no warnings. Weird.

Ran a test using FX explorer (I don't have Root Explorer) and when I tested enabling Mount Read-Write for the system folder I did get an error, "The operation could not be completed". It's like the phone is partially rooted since apps like SuperSU work and Root Checker says it's rooted, but I can't make the system folder writeable to paste things into it. Double weird.
[Xperia Z2 General] juanpirulo:
Did you update bynaries with any other aplication? Because this Will corrupt your root. Cheers
[Xperia Z2 General] Lagamorph:
Not that I know of. Is there any way to check this? Or a way I can re-install my Binary to correct any corruption?

I'm now pretty sure that I'm not properly rooted. I've been trying to install Viper4Android to fix issues arising from 4.4.4 removing xLoud from the phone entirely, but I'm stuck in the problem of it endlessly asking to install the driver. On investigation it's never creating the libv4a_fx_ics.so file in \system\lib\soundfx nor is it updating the audio_effects.conf files, and I suspect this is because the \system folder cannot be written to.

Unfortunately this is leaving me with a major problem as now my Alarm Clock is incredibly quiet. xLoud did solve this, but for some reason only Sony know they've removed this setting entirely.
[Xperia Z2 General] pravinaldo7:
Put your question properly boy, dont mislead

i also actually thought you successfully rooted your z2. nvm we all will wait for it ;)
[Xperia Z2 General] bjorn96:
Anyone need the Norwegian?? :D
[Xperia Z2 General] Lagamorph:
Think I'm going to have to look up how to downgrade back to 4.4.2 for now.

4.4.4 is a complete downgrade to me without xLoud or a proper root that will let me install something like viper4Android, neither of which seem possible in the state the phone is in at the moment.

Is it a fairly simple process to downgrade to 4.4.2 from my partially rooted 4.4.4? My bootloader is locked and I have no custom recovery.

((Unless anyone knows of another way to boost my Alarm volume anyway))
[Xperia Z2 General] divanikus:
Lagamorph

You need a rickiller to be able to mount RW, it's a part of the ZXDualRecovery.
[Xperia Z2 General] hzmenxd:
wow, ADB root yet?
[Xperia Z2 General] Lagamorph:
So could I install ZXDualRecovery from where I am now? Or will I need to downgrade first? Mounting system with RW access seems to be the only thing I'm missing for a Full Root, and it would like me use something like viper4Android to overcome the volume limitations.
[Xperia Z2 General] ghostofcain:
Only if your prepared to downgrade, then either flash a pre-rooted zip or root and do an OTA.
[Xperia Z2 General] hzmenxd:
I know, i already have root on 4.4.4, just asking for new users
[Xperia Z2 General] divanikus:
You can always reflash with Flashtool, so give it a try. But be sure to make a backup of your vital data first.
[Xperia Z2 General] zhuhang:
XLOUD and Clearphase disppear, very disappointing from Sony, removing features in update, don't know what they are doing.
[Xperia Z2 General] Lagamorph:
Ok, I just want to confirm something before I risk doing something very bad to my phone.

First of all I want to downgrade to 4.4.2, and to do that I should follow this thread here,

http://xdaforums.com/showthread.php?t=2759934

And I believe this will put my phone essentially back to factory settings? Unroot the phone, wipe all data, etc. (All my personal data isn't a problem, it's all on my SD card/Google Drive/Onedrive anyway).

After this, Re-Root using the method from this thread,

http://xdaforums.com/showthread.php?t=2559009

Once that's done, install Dual Recovery using the method from this thread,

http://xdaforums.com/showthread.php?t=2785598

And then once that's done, follow this thread,

http://xdaforums.com/xperia-z2/general/4-4-4-creating-rooted-update-package-t2933155

To create a rooted 4.4.4 image and then flash it onto the phone.

Is there anything I missed? Or something I put on that I shouldn't have? Or a simpler method than what I've outlined?
[Xperia Z2 General] bdithug:
Bingo!

That's exactly what I had to do since I updated as soon as the update was released. Now I have fw 167 rooted with dual recovery and everything works perfectly.
[Xperia Z2 General] mrshaheryar:
Getitng Could not verify error on Xperia Z2

How can i remove dualrecovery from my xperia z2? May be this will help me to remove "could not verify" error and insyall 4.4.4 update. I unrooted my xperia z2 from within SU unroot option then I did factory reset. Now I have 4.4.4 update on my phone ready to be downloaded but after downloading it gives "could not verify" error at the end. I'm confused what is the problem.... I've tried 2 times but same error. Help
[Xperia Z2 General] divanikus:
Yes, you are correct, you can do root by this method you've mentioned: downgrade, reroot, install recovery, preroot, flash prerooted.

If you already have root but without working remount, you might try installing recovery using ADB (as you normaly would on .314), this might enable you to full root. But I cannot confirm it would, because I did full upgrade and didn't had root on .167.
[Xperia Z2 General] Lagamorph:
Has anyone got the UK 4.4.4 ftf?

Checking here, http://xdaforums.com/showthread.php?t=2759934 I can't see the UK one yet.

I've downgraded, re-rooted and installed dual recovery so far without any issue, just need to make my rooted 4.4.4 image now, but need the UK firmware to do it :)

EDIT - Found it in the thread, just not been added to the OP yet.

Just in the process of creating a backup of how the phone is right now before I create my pre-rooted image and flash it.
[Xperia Z2 General] Lagamorph:
XD

Custom Recovery? Check!

4.4.4? Check!

Rooted? Check!

/system mounted as R/W? Check!

Big thanks to everyone who offered up the advice to what I'm sure are not only dumb questions, but ones that have been asked a thousand times before.
[Xperia Z2 General] FabianLaRose:
Flash this zip http://xdaforums.com/xperia-z2/general/fix-fix-unmountable-t2933825
[Xperia Z2 General] bdithug:
Not dumb questions, better safe than sorry. And clearly by your first post, you did some searching beforehand which is always a good idea! :)
[Xperia Z2 General] zhuhang:
Rooted successfully on 4.4.4, no walkman or noise cancelling issues.

Downgrade, root, install TWRP, flash 4.4.4 rom zip, flash update-SU.zip, re-install twrp, flash a system RW fix zip and all done.

Methods from a chinese site: (Written in Chinese)

http://www.mobile01.com/topicdetail.php?f=569&t=3950998&p=1
[Xperia Z2 General] Lagamorph:
I didn't nee to re-install twrp or the system RW fix zip.

I just had to downgrade, root, install twrp then follow the pre-rooted 4.4.4 image guide.

It seems a bit convoluted, but at least in future I'll be able to skip the downgrade, re-root and install twrp steps since that's already done now. When 5.0 comes along I'll either be able to just flash a pre-rooted image, or flash a stock image then use whatever root methods are out for it.
[Xperia Z2 General] lodger:
Just for your info..

I downgraded , rooted with supersu in survival mode, then did the ota,

update finished the ran root checker and i still have root...happy days
[Xperia Z2 General] ghostofcain:
Why would you want to?

---------- Post added at 11:09 PM ---------- Previous post was at 11:07 PM ----------

Flash stock ftf, or delete the files from /system/bin referenced earlier.
[Xperia Z2 General] raystorm1777:
Trying to remove dual recovery to get the 4.4.4 through OTA

But in my phone directory, can't see two file (charger and ric)

So any more help is appreciated.

/system/bin/recovery.twrp.cpio.lzma (or .tar)

/system/bin/recovery.cwm.cpio.lzma (or .tar)

/system/bin/recovery.philz.cpio.lzma

/system/bin/charger

/system/bin/ric

/system/bin/chargemon

/system/bin/dualrecovery.sh

Then inside */system/bin/ rename chargemon.stock to chargemon check its permissions (should be 755 or otherwise visible as -rwxr-x-r-x).
[Xperia Z2 General] Zheng11:
Now i am in one situation:

i am not rooted previously,

i am upgraded to a.0.167,

question is ,

how to root my z2 with a.0.167 with lock boot loader?
[Xperia Z2 General] zhuhang:
downgrade to 4.4.2, root it, install recovery, flash 4.4.4
[Xperia Z2 General] Zheng11:
any guide?? i dont know how...
[Xperia Z2 General] sxtester:
http://xdaforums.com/showthread.php?p=56512822
[Xperia Z2 General] mishooo:
A bit of a long shot but has anyone tried the ADB root for Z2 on the updated firmware ?
[Xperia Z2 General] chudy_85:
Okay i have root to.

What I do :

I have firmware 314 and I root

I use ota to update to 167

When it's finished I check supersu and it work.

When I open root explorer I can't change rw to ro but I install Z2 lockeddualrecovery2.7.154-beta.instler to have recovery using install with supersu.

When it's finish it's reboot to team winrecovery and I do it reboot system. Now I open again root explorer and now I can change rw to ro.

Root work very good but xposed installer not.
[Xperia Z2 General] lanc3lot:
Hello,

1. when you say flash 4.4.4 rom zip, u mean the pre-rooted ftf through PRFCreator, right?

2. when you say flash a system rw fix zip, where we can find this?

Ty in advance