[TOOLS][All quark] MultiROM_TWRP [TWRP 3.1.1_Mod_3][MR 35][20171111]

fgl27

Recognized Developer
Feb 27, 2014
3,623
9,418
263
Brazil...South of the south
I was trying to encrypt secondary ROM but it seems it does not work. Some logo with an "android" is displayed for a while, then it UI is restarted but when the system gets back nothing happens. I've noticed also that system freezes after a while(even if I not trying to encrypt device) and phone becomes unresponsive(but the screen stays on). Could not run adb at the time so was not able to capture logs.
I thought that it's because I've made the secondary ROM from the backup of primary one so I've made a clean install of 7.0.2 as secondary.
At first boot it did not pass android logo(waited for some 5 minutes). Second time it reaches this "first time installation" screen, but then it said that System process becames unresponsive so I've to kill it. At third time it again displayed "first time installation" screen and after a while said that "intefrace" is not responding. I've gathered the logs(only logcat, adb shell was not working so could not get dmesg) from the last try :)

I've also installed your RR 5.8.5 as secondary(I thought that perhaps encryption will work there better) but it also freezes(so could not even get to the point of starting encryption). Unfortunately I haven't got logs from this try.

------------------------------edited----------------------------
Sorry, it looks like it just needed more time. Forth restart I've given it few more minutes and it stabilized and looks like is working just fine. Will try to gather logs from encryption :)

------------------------------edited----------------------------
I've tested again encryption. In the logs there is something like this:
07-26 10:58:04.367 308 3585 E Cryptfs : Unexpected value for crypto key location
07-26 10:58:04.367 308 3585 E Cryptfs : Cannot open block device
Technically encryption is done to the whole partition. Probably if the main ROM is encrypted the other will not work (I never tested), and the secondary if only that one is encrypted that will not finished if it may causes the other not to boot (also I never tested).

Quark has a encryptable footer on the data partition (encryptable=footer)
https://github.com/fgl27/device_motorola_quark/blob/P/rootdir/etc/fstab.qcom#L6-L7

that footer when device is encrypted is used, and can only be removed/erased by formatting data, if encryption is removed without erasing the footer the device can't be encrypted again, a format of the data partition always erase it, but a wipe doesn't, this is a form of extra security that exist for the full-disk
https://source.android.com/security/encryption/full-disk

Is something probably not possible to support because the way it was intended to be used, as the android helps informs "When the device is successfully unlocked, the password is then used to encrypt the master key and the crypto footer is updated", so if can be only one footer we can't have more then one encryption information as it gets update on it boot of it ROM.

Technically oreo and up uses a different process of encryption in relation to older OS, but I assume is the same issue as you tested and have those issues regarding location.
 
Last edited:
  • Like
Reactions: czechop

czechop

Senior Member
Aug 21, 2012
231
573
0
Technically encryption is done to the whole partition. Probably if the main ROM is encrypted the other will not work (I never tested), and the secondary if only that one is encrypted that will not finished if it may causes the other not to boot (also I never tested).

Quark has a encryptable footer on the data partition (encryptable=footer)
https://github.com/fgl27/device_motorola_quark/blob/P/rootdir/etc/fstab.qcom#L6-L7

that footer when device is encrypted is used, and can only be removed/erased by formatting data, if encryption is removed without erasing the footer the device can't be encrypted again, a format of the data partition always erase it, but a wipe doesn't, this is a form of extra security that exist for the full-disk
https://source.android.com/security/encryption/full-disk

Is something probably not possible to support because the way it was intended to be used, as the android helps informs "When the device is successfully unlocked, the password is then used to encrypt the master key and the crypto footer is updated", so if can be only one footer we can't have more then one encryption information as it gets update on it boot of it ROM.

Technically oreo and up uses a different process of encryption in relation to older OS, but I assume is the same issue as you tested and have those issues regarding location.
Thanks for the explanation. And for your support in this :)

I was just thinking. Right now secondary OS get's /data from ./MultiROM/roms/... Would it be possible to make an fixed size disk image of "data" and mount it as loopback? Such an image should be seen as regular block device so modification of the footer should be possible so maybe even encryption would then work?
 

czechop

Senior Member
Aug 21, 2012
231
573
0
Thanks for the explanation. And for your support in this :)

I was just thinking. Right now secondary OS get's /data from ./MultiROM/roms/... Would it be possible to make an fixed size disk image of "data" and mount it as loopback? Such an image should be seen as regular block device so modification of the footer should be possible so maybe even encryption would then work?
I was able to boot RR 7.0.2 using image files for data/system/cache, but unfortunatelly it still complains about key location:
07-31 13:00:24.489 317 3584 E Cryptfs : Unexpected value for crypto key location

Will keep trying and post back:)
 

Attachments