You have at least two solutions to fix this issue:
- Resize your /data partition to free up the needed space. Here and here are guides how to do it. I haven't give it a try, so I can't confirm it's working, but several other guys reported this fix working.
- If you're not comfortable to resize your partition, you can use an old version of TWRP. Beginning with version 220.127.116.11 TWRP seems to use up all blocks for /data. So you need a version prior to this one. I've used TWRP 18.104.22.168, but 22.214.171.124 should also work. Step by step:
- Download and flash TWRP 126.96.36.199.
- Boot into recovery and do a factory reset: Main menu -> Wipe -> Format Data (confirm with "yes"). I also wiped Cache and System (Main menu -> Wipe -> Advanced Wipe).
- If you're going to flash a Nougat based ROM you can stop reading and start flashing and encrypting
- If you're going to flash an Oreo based ROM you now need to update your TWRP version as anything prior to 188.8.131.52 doesn't support flashing Android 8.1. The official TWPR version sucks because you won't be able to decrypt your phone when booting in recovery. I've used the TWRP provided in this post.
- Install your preferred ROM and encrypt it.
I haven't tested it, but dirty flashing a ROM (without a factory reset) might also work. But this usually leads to some random ****ups.
Also the TWRP alternative "Orange Fox" was mentioned as a solution in this thread. I actually can't remember if I've used Orange Fox to factory reset my phone or if I've flashed it only after having performed a factory reset using TWRP. For me Orange Fox didn't work (= encryption didn't work). But you might give it a try...
I'm kind of stuck right now because I cannot encrypt my phone anymore and I don't know why. I got my phone last year and installed LOS 14.1 right away. For security reasons I also encrypted it - without any issues whatsoever. When LOS 15.1 came out, I upgraded my phone, with encryption still working. A couple of days back for some reason I decided to do a factory reset. Obviously, the device wasn't encrypted anymore after the reset. I then installed the new nightly of LOS (20180807) and tried to encrypt my phone once again. When I select "Encrypt phone", I need to enter my PIN, the phone restarts and reboots without encryption being started.
What I've done so far:
- I've flashed two different TWRP versions: 184.108.40.206 and a customized one (https://forum.xda-developers.com/red...-15-0-t3690465).
- I've clean installed different LOS versions (unofficial LOS 14.1 and LOS 15.1 starting from the 20180710 release)
- I've clean installed Omnirom (current release and a release from 20180107).
- I've even flashed MIUI 9 and reinstalled LOS thereafter because some guy in the above mentioned LOS thread wrote, that this did the trick for him.
- I've disabled WI-FI and mobile data before trying to encrypt my phone, because I found a blog article stating that this might help.
Do you guys have any additional hints or ideas how I can manage to encrypt my phone once again? Could another TWRP version do the trick? Is TWRP even involved in any kind when it comes to encryption of the OS? Do you think another ROM could be helpful?