1

It all started with a factory reset on the stock Samsung ROM (Android 7.0). After I booted into the factory reset system I couldn't get the phone encryption to work: it failed with the message saying that the data partition is corrupt which effectively factory reset my phone again (forcefully).

  • Reflashing the official Samsung ROM didn't help, the phone kept showing me the same message about the corruption of the data partition.
  • Reformatting the partition in the TWRP didn't help either.

Any ideas how to fix it? It could also be a hardware failure.

I posted the same question on XDA but unfortunately got no response so far.

19
  • @alecxs what would I get from knowing if the problem is related to EFS or DATA?
    – user311865
    Dec 22, 2019 at 19:34
  • idea behind was to figure out if problem just related to encryption and not wear-out of userdata partition itself, and see if you still may use device unencrypted. but turns out the encryption key is located at end of userdata partition and not EFS (forceencrypt=footer;length=-20480)
    – alecxs
    Dec 22, 2019 at 20:58
  • @alecxs the device is perfectly usable without encryption. Could it be wear-out after 3.5 years of usage?
    – user311865
    Dec 22, 2019 at 21:17
  • if it is perfectly usable then it's most likely not wear-out. maybe it runs out of memory during encryption, or too much data on it (even after reset?)
    – alecxs
    Dec 22, 2019 at 23:56
  • I don't know why this shoud make a difference, but some people recommend to perform factory reset from stock android system recovery (instead twrp)
    – alecxs
    Dec 23, 2019 at 10:52

1 Answer 1

0

Flashing complete stock ROM including stock recovery will fix encryption, if you factory reset from stock recovery.

To make your ROM boot along with TWRP you need to flash no-verity-opt-encrypt or universal disable dm-verity.

Due some bug in TWRP, decryption dialog fails to open because EFS is not mounted at the time that TWRP checks for device encryption. TWRP is working along with stock ROM encryption if you swap entries in /etc/recovery.fstab and one of these flags for USERDATA:

flags=encryptable=footer
flags=encryptable=footer,length=-16384
flags=encryptable=footer,length=-20480
flags=encryptable=/efs/metadata
flags=encryptable=/dev/block/bootdevice/by-name/metadata
flags=encryptable=/dev/block/platform/15570000.ufs/by-name/EFS/metadata
flags=fileencryption=aes-256-xts:aes-256-cts
flags=fileencryption=ice:aes-256-cts
flags=fileencryption=ice:aes-256-cts;keydirectory=/metadata/vold/metadata_encryption

source: source.android.com/security/encryption

1
  • 1
    @alexcs Unfortunately, none of those flags worked. Tried with both TWRP 3.2.3 and TWRP 3.3.1
    – user311865
    Dec 30, 2019 at 18:09

You must log in to answer this question.