How to remove Cyanogenmod from Sony Xperia Z? I've got an old Sony Xperia Z running Cyanogenmod which is pretty unstable.

I'd like to remove Cyanogenmod &amp; do a factory reset to the default Sony Xperia Z ROM. It doesn't need to do much - just run Spotify &amp; Google Maps in our car.

However flashing a Sony Phone with a factory ROM requires a special tool (FlashTool) &amp; a special file format (FTF).

Running FlashTool on Ubuntu 16.04 my phone connects in flash mode, but then reboots into Cyanogenmod after the "Preparing the files for flashing" step. I had assumed this was something to do with Cyanogenmod.

INFO  - Device connected in flash mode
INFO  - Selected Bundle for Sony Xperia Z(C6603). FW release : 10.5.A.0.230. Customization : C6603_1270-4066
INFO  - Preparing files for flashing
INFO  - Device disconnected


How do remove Cyanogenmod from a Sony Xperia Z &amp; restore it to it's factory ROM?

If that isn't possible what can I replace Cyanogenmod with?
There's no such thing as "CM bootloader" - a CM installation only writes a new /boot (kernel) and /system.

Since you are explicitly looking to return to stock, FlashTool is still your best bet. Find the latest stock ROM for your variant and region using XperiFirm, generate a .ftf format file with what you downloaded using Flashtool with the guide here, then flash away.