[Sony Xperia S, Acro S, Ion] curiosus42:
Hello everyone!

First, thank you all very much for your insights and questions. By going through all your posts, I could finally breath some new life into my old Xperia S.

Here are some tipps and tricks, if you're facing problems, like beeing stuck in Cyanogen recovery.

Can't connect to phone with adb or fastboot​

The solutions is simple: Don't use windows! I tried it with 2 windows computers, but all failed in a slightly different way. With my Mac and Linux PCs it worked out of the box. No extra steps needed like drivers etc.

adb errors​

I actually had a lot of issues with adb, like version missmatches (your server uses XX but your client uses XX), random disconnects or access exceptions. First of all, I ended up using the official and most recent plattform-tools: https://developer.android.com/tools/releases/platform-tools

If you encounter any issues, try to start the adb deamon with root privileges:

adb kill-server

sudo ./adb start-server

After that, it worked most of the times for me. adb reconnect is also an option. Lastly, a computer restart always worked with my machines.

fastboot also only worked with root privileges.

Stuck in Cyanogen Recovery​

My smartphone didn't want to boot into TWRP. I fixed the problem by trying different versions of TWRP.

I recommend using twrp-3.5.1_9-0-nozomi.img (you can get it here) because it has supports for the F2FS file system and I could finally boot into twrp. Other twrp versions also worked, but they lacked features like F2FS.

Strangely I had no luck flashing the twrp rom to the boot partition with fastboot. But it worked just fine with FlashTool_0.9.18.6. You can download it from here: https://androidmtk.com/download-sony-mobile-flasher

version 9.18.6 is also available for all systems.

TWRP CLI​

Did you know, that TWRP has a CLI? It is documented here: https://twrp.me/faq/openrecoveryscript.html

You can use it by opening a shell to your phone and type twrp. Open shell with adb shell. All following explanations expect you to open a SSH connection to your phone.

Can't format partitions to F2FS​

If the partitions are mounted, but don't have the right filesystem, try twrp wipe /data. It wiped both /cache and /data and formatted them to F2FS.

If that doesn work, try the following:

Make sure that your /data and /cache partitions are unmounted. You can do so by using umount data and umount cache. You can always check which partitions are mounted to where with the df command.

After that, try the following commands:

mkfs.f2fs mmcblk0p14 (format the data partition)

mkfs.f2fs mmcblk0p13 (format the cache partition)

Note: I'm not a 100% sure, but maybe you need to provide the full parititon path, which is /dev/block/mmcblk0p14 and /dev/block/mmcblk0p13 .

If that doesn't work, you can try mke2fs before to format to ext4 and then to F2FS. There is also a twrp format data command. Maybe that will also do the job.

After that, you can push your files to your phone and install nearAOSP and gapps with twrp install FILE. Make sure to install nearAOSP first and gapps right after that. And double check, that you use the correct version of BitGApps, otherwise the installation will fail. If you get some sort of error during the install, like "TWRP fails to map file" or any other file, your partitions are likely to be formatted incorrectly or still mounted. Then you have to start with wiping and formatting the partitions all over again.