[Xperia Z1 Compact General] cokhavim:
Dear all,

This took me forever to figure out, so I'd thought I'd share how I rooted my Xperia Z1 Compact (Mini) using Ubuntu 14.10. (You could do this using Windows by skipping Step 2).

First, these were the problems I encountered using other methods:

- Using kingroot worked, but it was very suspicious (there's a nice thread that listed all the mysterious behaviours of kingroot - I can't find it so please just search for it).

- I never tried PRF Creator, since it was yet another Windows app.

- Flashing any boot.img into boot would cause an eternal boot loop.

- Thus I had to use Sony's Emma to enable flashing a recovery.img into recovery; but for this, I needed VirtualBox, and for VirtualBox, I needed USB 2.0 (3.0 didn't work).

- Old versions of SuperSu would never work. The only version that worked is the BETA 2.49.

So here are the steps that worked for me. (I don't guarantee that it will work for you). Make sure you back everything up and unlock your bootloader (you can relock it again using FlashTool).

Here are the steps in brief (details below):

0. Get Ubuntu to recognise your device.

1. Make sure you have stock firmware (either officially by Sony Update, or by flashing a .ftf using FlashTool).

2. Use VirtualBox and a copy of Windows straight from Microsoft (yes, it's free and legal).

3. Use Sony's Emma on Windows to do a "TA update".

4. Back on Ubuntu use fastboot to flash a recovery (fastboot flash recovery recovery.img).

5. Boot your phone into recovery and flash the SuperSu.

The Details:

0. Get Ubuntu to recognise your device

On Ubuntu, open a terminal and type:

gksudo gedit /etc/udev/rules.d/51-android.rules

type:

SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0664", GROUP="plugdev"

Save, then exit.

Then type this command:

sudo service udev restart

Next, test that it's working:

sudo apt-get install android-tools-adb
sudo apt-get install android-tools-fastboot

On your phone, enable USB debugging:

Settings -> About Phone -> Build Number (tap Build Number 7 times until developer options enabled)

Settings -> Developer options -> USB debugging

Connect your phone to your Ubuntu and type:

adb devices

This command may cause your phone to alert you that your computer is trying to modify your phone. Allow it. Then type the above command again in your ubuntu and you should get something like this:

List of devices attached
XXXXXXXXXX	device

where XXXXXXXXXX is your serial number.

1. Get stock Lollipop (14.5.A.0.270) on your phone

You can either get the update straight from Sony or download it and flash it using FlashTool.

From Sony:

If your bootloader is unlocked, relock it using FlashTool (click on the BLU button)

Use the update tool on your phone: Settings -> About Phone -> Software Update.

Using FlashTool:

Download FlashTool and unzip it.

In a terminal cd into the FlashTool folder and type:

./FlashTool

(you may have to give it permissions first: chmod +x FlashTool)

Click on the "BLU" button to unlock your bootloader (this is necessary for any fastboot command, see below).

Click on the XperiFirm button (the last one on the right that says "XF"). Select a firmware of your choice. Then click on the line under the PayPal symbol that says "14.5.A.0.270..." (for some reason, there's no button, just a line of text). Then click Download. If you didn't change the default "User home", the files will be downloaded to your home directory in .flashTool/firmwares/Downloads

Once it finishes downloading, close the XperiFirm windows in order to return to FlashTool. FlashTool will then take some time converting the stock firmware into a flashable .ftf file (placing it in .flashTool/firmwares).

Once it's done, click on the button with the lightning symbol, select Flashmode and then your firmware and click Flash. It will wait for you to connect your phone in Flashmode (turn phone off, hold the volume down button and then connect the USB cable). Once it detects your phone, FlashTool will flash your firmware, again taking some time.

2. Install VirtualBox with a Windows 7 Guest

Install VirtualBox and the Extension Pack from the virtualbox website (make sure the version of the extension pack is the same as the version of virtualbox. I used 5.0.

Download the image of Windows 7 (what I used) available free from the Microsoft Dev download page (dev.modern.ie/tools/vms/linux/). Unzip it and then double click it to open it in VirtualBox. Follow the VirtualBox prompts to install it (Microsoft recommends assigning between 1 and 2 GB of RAM).

Before running the guest machine, select the Windows 7 machine in Virtualbox and click on "Storage" then "USB". Make sure that USB controller is enabled, and select USB 2.0. (It never worked with USB 3.0 for me. Also, my laptop has one USB 2.0 port and one USB 3.0 port, and I had to make sure I used the correct port.)

3. Install and run Sony's Emma

The following will only work with an unlocked bootloader. Use FlashTool to unlock it (BLU button - see step 1 under FlashTool).

Run the guest Windows and install Emma (developer.sonymobile.com/services/flash-tool/). In the downloaded zip file for Emma, copy the customization.ini file to C:\Program Files\Sony Mobile\Emma\

Run Emma.

Turn off your phone and put it in flash mode (hold volume down and then connect usb). At the top of the VirtualBox window that shows your Windows running, click on the Devices menu, then USB, then "Sony D5503...". Your guest Windows should now detect your phone, and so will Emma.

In Emma, in the list of "Services" on the right, select the one that ends with "TA Update" and flash. When it's done, close Emma and VirtualBox.

4. Flash a recovery

On Ubuntu, download a recovery image. I used this one: Z1_DooMLoRD_AdvStkKernel_FW-757_v04.zip from this page:

http://doomlord.xperia-files.com/ (scroll down a bit to find it). Unzip this file and rename it to recovery.img

Then in a terminal type:

fastboot flash recovery recovery.img

This command flashes to "true" recovery as opposed to the command "fastboot flash boot boot.img" which installs into boot. I'm no expert, and I'm not sure what the difference is between boot and recovery, but you need Emma to enable recovery. (I tried doing things the boot way, ie, without Emma, but it resulted in a bootloop.)

Note also that this recovery is based in CWM. I read somewhere that TWRP won't work using this method, but I never tried it.

5. Use recovery to flash SuperSu

Download BETA-SuperSu-v2.49.zip from here (this is the only version of SuperSu that worked for me; earlier versions failed).

Copy this file into your SD card (using a card reader, or boot up your phone normally and connect it to your computer).

Boot into recovery: Turn off your phone. Press the power button and volume down button together. When the phone vibrates the first time, release the power button (but keep holding the volume down button). When the phone vibrates again, release the volume down button.

On the recovery menu, select "Install zip" and then choose your the BETA-SuperSu-v2.49.zip from your sdcard. When it's done flashing, go back and select "reboot system now". It might complain that "Root access possibly lost. Fix". Ignore it and select "No".

Your phone should now start up and SuperSu should appear in your app drawer. If you open it, it should start up with no complaints. (Or install the app Root Checker just to be sure).