[G 2014 Q&A, Help & Troubleshooting] Deleted member 6373327:
maybe it really is the encryption footer?

(I'm sorry but it won't let me post links yet, you'll have to fix them below to use, I stripped the schemes, put them between LINK uppercase, and italicized the link text)

I'm getting the same thing, I just tried with 20150505 nightly cm12.1, this seems to a be a known issue, but with very little real information as to the problem. I found LINK forum.cyanogenmod.org/topic/88973-moto-g-cm11-encryption-failed/ LINK this forum post going back to mid 2014, and LINK jira.cyanogenmod.org/browse/CYAN-4532 LINK the linked JIRA bug which seems to indicate that all the Moto G devices (falcon, peregrine, titan), possibly Moto X as well are affected, but nobody seems to know what causes this bug, only vague hints that it may be a "timing related issue" but no other clarifying information in the now more than a year since this bug was posted.

The obvious conclusion is that nobody is encrypting their devices, which I find bizarre. Once Motorola releases a 5.1 factory ROM for this device (which is supposedly imminent -- they've already released for G-2013 and X-2014 I believe), I'll flash it and test that one.

I used logcat -v long and saw the times, the process kills definitely come after the attempts to open the block device fails. I did a logcat -c in one shell and then a vdc cryptfs enablecrypto inplace <password> in another (this is what the encrypt UI initiates), and the after the resulting softboot (it keeps the adb shell alive, and system uptime continues, so this isn't a hard boot), a logcat shows the same sequence:

[ 05-06 20:06:03.897 230: 287 E/Cryptfs ]
Cannot open real block device /dev/block/platform/msm_sdcc.1/by-name/userdata

[ 05-06 20:06:03.897 230: 287 E/Cryptfs ]
Unable to get crypt_ftr_info

[ 05-06 20:06:03.898 230: 287 E/Cryptfs ]
Cannot get size of block device /dev/block/platform/msm_sdcc.1/by-name/userdata

and then the kills start.

At first, because of the apparent inability to get crypt footer (in the error message), I thought this was lack of the 16k footer mentioned in the aforementioned bug, but LINK review.cyanogenmod.org/#/c/86684/ LINK the patch to include it appears to be long incorporated in LINK github.com/CyanogenMod/android_device_motorola_titan/blob/cm-12.1/BoardConfig.mk LINK our board's version of this file.

However, as I write this, I notice that the size in BoardConfig.mk does not correspond to the one on the device:

$ readlink /dev/block/platform/*/*/userdata
/dev/block/mmcblk0p38

$ grep mmcblk0p38 /proc/partitions
259 6 5774208 mmcblk0p38

$ bc
((5930598400 / 1024) - 5774208) / 1024
16.9843750000

they appear to differ by slightly more than 16k (the size of the encryption footer). But yet /system corresponds exactly with the line from BoardConfig.mk:

$ readlink /dev/block/platform/*/*/system
/dev/block/mmcblk0p36

$ grep mmcblk0p36 /proc/partitions
259 4 1130496 mmcblk0p36

$ bc
1157627904 / 1024
1130496.0000000000

so now I'm thinking that really is the problem (the userdata partition needs to have its size extended by 16k). But then there is LINK forum.cyanogenmod.org/topic/104204-xt1039-cm12-nightly-20150123-encryption-of-data-partition-not-working-simply-warm-reboots/ LINK this forum post which claims that the same partition encrypts fine with the stock image.

I didn't factory reset when flashing cm12.1 (from a stock 5.x ROM), which I think recreates the partition (?) So, maybe the partition didn't get resized to the correct value. However if the stock ROM handles this case, I should think CM would too.

What about you? Did you factory reset (including /data) when you installed CM on your Titan? I saw no need to get rid of /data (although I did have to delete some things in /data/misc to get rotation working) when coming from stock ROM and wanted to avoid having to redo everything. Which worked fine... except for this :)