Artificial truth

The more you see, the less you believe.

[archives] [latest] | [homepage] | [atom/rss]

Cyanogen reboot without encrypting the phone
Mon 21 December 2015 — download

I was flashing the latest cyanogen mod on my phone, and wanted to encrypt it. Unfortunately, when I launched the encryption process, it was simply rebooting, without encrypting anything.

A quick look at the logs revealed that there was some issues with my partitioning:

# adb logcat
[]
 E/Cryptfs ( 1890): Orig filesystem overlaps crypto footer region.  Cannot encrypt in place.
[]

The problem is that ecryptfs needs some space to store cryptographic material. This is how you can resize your partition:

# adb shell
shell@falcon:/ $ su
root@falcon:/ # mount | grep '/data'
/dev/block/mmcblk0p36 on /data type f2fs (rw,seclabel,nosuid,nodev,noatime,nodiratime,background_gc=on,user_xattr,inline_xattr,acl,inline_data,nobarrier,active_logs=6)
root@falcon:/ # cat /proc/partitions | grep /dev/block/mmcblk0p36
 259        4    5791616 mmcblk0p36
root@falcon_umts:/ # mke2fs -T ext4 -L data /dev/block/mmcblk0p36 5790000
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=data
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
362160 inodes, 1447500 blocks
72375 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1484783616
45 block groups
32768 blocks per group, 32768 fragments per group
8048 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

root@falcon_umts:/ # sync
root@falcon_umts:/ # reboot                                 

Don't forget to do that while in recovery mode, or you'll get something like this in the logs:

/dev/block/mmcblk0p36 is apparently in use by the system; will not make a filesystem here!

You can now encrypt your phone, and check that everything goes well with:

# adb logcat | grep -d crypt