On my XT907 I did a full reformat/wipe and installed cm-12.1-20160822-NIGHTLY-xt907 with GAPPS 5.1. When I did Settings->Security->Encrypt phone it did a soft boot for about 10 seconds and then returned without changing anything. Logcat showed:
E/Cryptfs ( 244): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdataE/Cryptfs ( 244): Orig filesystem overlaps crypto footer region. Cannot encrypt in place.
The problem is that the size of the userdata filesystem specified in BoardConfig.mk allocates the whole partition to the filesystem. To allow encrypt-in-place it should leave at least 16KB unallocated. It's a well known problem that has cropped up with CM on other phones. I fixed it manually on my existing install by using resize2fs in an adb shell to shrink the size of the /data filesystem by 16KB. Then the encryption worked and the phone works as it should.
The fix in the xt907 BoardConfig.mk is a one liner:
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 4971543040+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4971526656
Looking at github the problem is in all the 12.0, 12.0 stable, 12.1, and 13.0 branches.
On my XT907 I did a full reformat/wipe and installed cm-12.1-20160822-NIGHTLY-xt907 with GAPPS 5.1. When I did Settings->Security->Encrypt phone it did a soft boot for about 10 seconds and then returned without changing anything. Logcat showed:
E/Cryptfs ( 244): Bad magic for real block device /dev/block/platform/msm_sdcc.1/by-name/userdata
E/Cryptfs ( 244): Orig filesystem overlaps crypto footer region. Cannot encrypt in place.
The problem is that the size of the userdata filesystem specified in BoardConfig.mk allocates the whole partition to the filesystem. To allow encrypt-in-place it should leave at least 16KB unallocated. It's a well known problem that has cropped up with CM on other phones. I fixed it manually on my existing install by using resize2fs in an adb shell to shrink the size of the /data filesystem by 16KB. Then the encryption worked and the phone works as it should.
The fix in the xt907 BoardConfig.mk is a one liner:
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 4971543040
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4971526656
Looking at github the problem is in all the 12.0, 12.0 stable, 12.1, and 13.0 branches.