How to Root, Flash a Custom Recovery, and Unlock the Bootloader on the Sony Xperia Z (Video)

Love your new Xperia Z’s waterproofing but not the biggest fan of it’s software? No problem, just root it and open the whole new world of hacking and modding. You can overclock the device, remove bloatware, install stock Android and so much more. All of this, though, begins with rooting the device. Here’s how to root the Sony Xperia Z and unlock the bootloader.

Please note that if this procedure seems a bit longer than most it is because I have you backup your DRM keys so you don’t lose the Bravia Engine, Walkman Music, and keep your warranty fully intact whereas most rooting procedures don’t do this and you’ll lose them forever. Bottom line, this procedure is longer than most, but definitely worth the few extra steps.

I. Before You Begin

1. Thanks to Doomlord. If this procedure helped you, please head here and donate/thank him!

2. Thanks to DevShaft. If this procedure helped you, please head here and donate/thank him!

3. Thanks to Cpasjuste. If this procedure helped you, please head here and donate/thank him!

4. Check to see if your device’s bootloader can be unlocked by doing the following:

Open the phone app
Dial *#*service#*#*
Tap Service Info > Configuration > look to see if bootloader unlock is allowed or not.

If it says yes you can continue, if it says no then please head here to root the Sony Xperia Z without unlocking the bootloader.

II. Root the Device for Backing Up the DRM Keys

1. Enable USB debugging by going to Settings > Developer Options and checking USB Debugging on.

2. Enable Unknown Sources by going to Settings > Security and checking Unknown Sources on.

3. Increase the screen timeout to 10 mins by going to Settings > Display > Sleep > Change it to 10 mins.

4. Download the easy rooting script for locked bootloaders and save it to your desktop.

Rooting Script

5. Extract the rooting script by double clicking the rooting script .zip file.

6. Plug the phone in via USB.

7. Open the rooting script folder and double click the windows .bat file.

8. Hit Enter in the command prompt on the computer and wait for it to finish.

9. Once done, the device will reboot and you have root access.

10. To fix something with the bootloader not being able to be unlocked after using this root method, open the doomlord rooting folder then files inside that.

11. Hold shift on your keyboard and right click in any blank area of that folder and select Open Command Prompt Here.

12. Type the following into the command prompt with hitting enter at the end of each line:

adb shell
su
rm /data/data/com.sonyericsson.android.servicemenu/lib/libservicemenu.so
exit
exit

III. Backup TA to Keep DRM Keys

1. Download the TA Backup script and save it to your Desktop.

Backup TA (download link is in the first post on that page)

2. Extract it by double clicking the .zip file.

3. Open the folder that appears.

4. With the device still plugged in via USB, double click the Backup TA .bat file.

5. In the command prompt window that opens, type X and hit enter. Wait for it to finish backing up.

IV. Unlock the Bootloader

1. On your device, go to Settings > About Phone > Status and look for IMEI. Write this number down on your computer in notepad or some equivalent text editor.

2. Head to http://unlockbootloader.sonymobile.com/ on your computer.

3. Scroll down and click on Start Unlocking the Bootloader.

4. Read everything and click Accept.

5. On the Create Unlock Request page enter in the IMEI we wrote down earlier and the other info including your email (needs to be a valid email since they will email us something we need to unlock the bootloader).

6. You will receive your unique unlock key from Sony via email. Save this key.

7. Download the Fastboot folder and save it to your desktop.

Fastboot

8. Extract the file by right clicking it and select Extract all.

9. Open the fastboot folder inside.

10. Hold shift and right click on the background in this folder and select Open Command Prompt Here.

11. In the new command prompt window that appears, type the following but replace the word KEY with the unlock key you received via email from Sony and then hit enter:

fastboot.exe -i 0x0fce oem unlock 0xKEY

12. The device should reboot.

13. Leave the command prompt open for the next step.

V. Flash a Custom Recovery

1. Download and save the custom recovery to your desktop:

TWRP Recovery

2. Copy the boot-twrp-v2.img from inside the folder and place it into the fastboot folder that we downloaded earlier.

3. In the command prompt that is still open from section IV, type the following with hitting enter at the end o the line:

fastboot.exe flash boot boot-twrp-v2.img

4. You now have a custom recovery image.

VI. Re-Root the Sony Xperia Z

1. Head to Doomlord’s page and download the supersu .zip file in the second post and save it to your desktop.

Super SU

2. Download the Recovery app (so we can easily reboot into recovery).

Recovery

3. Copy the .zip file and apk to the internal storage of the Xperia Z.

4. Unplug the Xperia Z.

5. Open File Commander on the device and then click on the apk file and install it.

6. Open the app and click reboot recovery.

7. Once in recovery, go to Backup and then select backup and wait for it to finish.

8. Select Install Zip and then Choose Zip and then select the Super SU .zip file we put on the device and let it flash that.

9. Select reboot system now.

10. All done, you are rooted, running a custom recovery, have an unlocked bootloader, and have all your DRM keys saved. Head to the next procedure to flash a custom ROM on your Sony Xperia Z or head to our How To’s for the Sony Xperia Z to find all sorts of other how to’s you can do with root access. Enjoy!

Reported Issues:

Issue:

Computer won’t recognize the device in fastboot mode.

Solution:

1. Download and extract the Sony USB Drivers to your desktop from here.

2. Open Device Manager and find your device with the exclamation point next to it, right-click it and say update device drivers.

3. Browse for files and choose the extracted Sony Drivers folder and click OK and it should install the drivers.

28 responses to “How to Root, Flash a Custom Recovery, and Unlock the Bootloader on the Sony Xperia Z (Video)”

  1. Sang says:

    hi im stuck at the unlock bootloader part 11. after i have entered my code from sony. my phone never ends up restarting. i thought this was something small so i moved on to the custom recovering part and everytime i enter everything im simple left with the message “waiting for device” what have i done wrong?

    • Johnson says:

      I had the same issue. I’m guessing it’s something to do with the fact the article was written prior to the latest android update.

    • Yunus Akyildiz says:

      You have to reflash your phone, I think the easiest way for it is the Sony flashtool “Emma” .
      The same happened me and I tried the other flashtools, but I couldn’t install it, so tried the Sony flashtool, but at the first time I had to log in, but you can’t register, but with more luck then smartnes I had opened the flashtool like in the videos.

  2. fuzzybee7 says:

    Has anyone tried this approach and succeeded?

  3. separate says:

    hi, I did everything to the point of the “V” and then the phone does not respond to the volume button turns on TWRP Recovery and distances do not know what to do please help

  4. Niloy says:

    Can i unlock my Xperia P with this steps?

  5. khelil says:

    I have an xperia z from ntt docomo
    in the settings the developer option is not available ??
    what shoul I do ?

  6. Parv says:

    My phone didnt reboot after unlocking the bootloader, I went to the next step and flashed custom recovery now my phone keeps showing “sony” sign and keeps restarting. Please help me? whats the way out of this!! THANKS

    • Yunus Akyildiz says:

      You have to reflash your phone, I think the easiest way for it is the Sony flashtool “Emma” .
      The same happened me and I tried the other flashtools, but I couldn’t install it, so tried the Sony flashtool, but at the first time I had to log in, but you can’t register, but with more luck then smartnes I had opened the flashtool like in the video.

    • swifteagle says:

      The same happened to me, so what I did was put my micro Sd card on the computer, made a folder called download, then dragged into that folder the custom rom I wanted to use. Then I press power and volume down, the phone loaded Recovery and then from there I press install and chose the Sd card and installed the custom rom, so far so good.

  7. Aditya Singh says:

    after getting the bootloader unlock code from sony.. i followed all the steps except that my phone did not restart.. i continued on with the next step that was to install twrp.. i did so by using their actual site and downloading twrp verion 2.8.7.0 for my phone xperia z1 (C6902)!
    my problem – when i switch on my device my phone does not boot with any sony logo as being commented by others! it just opens twrp!
    i dont know what to do next! can i re lock my bootloader? is there any solutions? PLS HELP PLEASE URGENT!

    • David Cogen says:

      You flashed the wrong thing. This is for the Xperia Z from 2013 not the Z1. Regardless, head here to flash back to stock -http://www.andromods.com/unroot-locking/how-to-restore-to-stock-unbrick-sony-xperia-z.html

  8. Bob says:

    Dose this still work on the xperia z c6603 android v 5.1.1

    • David Cogen says:

      We did this a long time ago so not sure if it’ll still work for the newer OS versions. I’d recommend checking with the developers mentioned in the beginning of the tutorial and ask them if they ever updated the tutorial for that version.

  9. HaHaHaHa says:

    Why when I click and run runme_win, then press any key..it’s stuck on ‘daemon started succesfully’..not running anything..please help me..

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.