Custom Marshmallow ROM - encryption fails without error I have a Galaxy S6 G920F phone. I've replaced the stock firmware with a custom ROM - XtreStoLite. Attempts to encrypt the phone using Android's built-in FDE fail with symptoms similar to the ones described in this other question, but none of the solutions suggested there help in my case.
What I've tried:

disable Wi-Fi
remove the SIM card
hold the phone so that the screen switches to landscape mode
factory reset, also tried to encrypt right after the first boot after installing the ROM
plugged in to both a PC USB port and a wall charger
instal every single additional package supplied by the author in the Aroma Addons Package

None of this helped; the phone simply displays a padlock icon on black background for around 3-4 seconds, shuts down, and after 15 seconds boots normally without reporting any errors. The storage is obviously not encrypted.
What is the reason for this behavior? How can I encrypt my phone?
I figured it out - the solution is to perform a factory reset on a clean system right after installation. After this, encryption works normally.