Sony Xperia Z2 upgrading to CyanogenMod 11

Contrary to my normal inclinations not to buy anything but Stock Android phones I ended up with a Sony Xperia Z2 in a hurry over the weekend (it’s a long story…). It appears to be quite a decent handset (with a pretty good camera actually) and one of the main reason to choose this over the other options was that is was one of the few high-end devices which already had a CM snapshot rather than just nightly releases. However similar to their colleagues at Samsung the Sony people also opted to stuff all sorts of crap-ware bloat onto the Android base OS. It appears not to be as bad as the Samsung (who are the kings of crap) mods, but for somebody used to the clean Android experience it’s just very annoying. So I opted to flash it straight to CyanogenMod.

Sony Xperia Z2 2 by epct414, on Flickr
Creative Commons Creative Commons Attribution-No Derivative Works 2.0 Generic License   by  epct414 


You need the Android SDK installed and on your Path – see one of my other posts on how to do this.

Get Bootloader Unlock Code

Another annoying step which is not required with Google Nexus series.

You will need to enter and confirm your email (WTF?) and need your IMEI number and at the end of the process you will get an update key that is required below.

Put phone into bootloader (fastboot) mode

Insert one end of the USB cable into your PC. Turn off the device and wait at least 5 seconds. Press and hold the Volume Down button and plug the other end of the Micro-USB cable in to your device.

fastboot devices
#should display the ID of the connected phone
fastboot -i 0x0fce oem unlock 0xKEY

Download CyanogenMod Release

Extract the boot.img file from the downloaded ZIP file via

fastboot -i 0xfce flash boot boot.img
fastboot -i 0xfce reboot

This should boot into Clockwork Mod Recovery and you can use the Volume +/- to navigate and On/Off button to choose.

Select the “Wipe data/factory reset” option

Note: this part was not in the CM Wiki or anywhere else and took me a while to get past. If you see an error “Error Mounting /sdcard/.android_Secure!” during the factory reset procedure you need to format the data partition manually. If you do not do this step the CM install will still work but you will not be able to boot the phone (it gets stuck at the Boot Animation).

Mount /data
Format /data

After the manual format procedure do the “Factory reset” again.

Install CyanogenMod

Choose the “Install zip from sdcard –> Install from sideload” option

adb sideload

After the install has finished choose the “Reboot system now” option.

CM Wiki Entry:

Author: Leo Gaggl

ict business owner specialising in mobile learning systems. interests: sustainability, internet of things, ict for development, open innovation, agriculture

3 thoughts on “Sony Xperia Z2 upgrading to CyanogenMod 11”

  1. Same thing happend to me. This post came after I tried random things for 3 hours last night. I wanted to kiss you when this worked. However,”mount/data” and “format /data” didn’t work for me. I had to select “format /data and /data/media (/sdcard)” first. Thanks for your help.

  2. Ditto for me. Had to choose the same option as Nic, but this blog post saved my arse!! Thank you! This was for a Samsung Galaxy S3 on Tmobile USA.

Leave a Reply