2
Phone: Samsung S9 Plus, 256Gb
OS: Lineage OS 17.1 (Android 10)
ROOT: TWRP 3.5

I installed Lineage OS 17.1 on a Samsung S9+. It's been working fine so far. However, when I encrypt the OS from the security menu, right after the screen goes black with the green android-like logo, the phone quickly reboots back to the non encrypted OS. Going again through the process does not help.

logcat shows:

--------- beginning of main
01-20 19:17:52.959 4019 4129 D vold : fdeEnable(3, *, 0)
01-20 19:17:52.960 4019 4129 D vold : !fscrypt_is_native, spawning fdeEnableInternal
01-20 19:17:52.960 4019 403 E Cryptfs : Unexpected value for crypto key location
01-20 19:17:52.961 4019 403 E Cryptfs : Cannot get size of block device
01-20 19:17:53.067 4019 403 W vold : Found symlink /proc/29802/cwd referencing /data/misc/keystore
01-20 19:17:53.067 4019 403 W vold : Found symlink /proc/29803/fd/7 referencing /data/vendor/gps/.lhd.lock
01-20 19:17:53.068 4019 403 W vold : Found symlink /proc/29803/fd/12 referencing /data/vendor/gps/.pipe.gpsd_to_lhd.to_server
01-20 19:17:53.068 4019 403 W vold : Found symlink /proc/29803/fd/14 referencing /data/vendor/gps/.pipe.gpsd_to_lhd.to_client
01-20 19:17:53.069 4019 403 W vold : Found symlink /proc/29804/fd/7 referencing /data/vendor/gps/.gpsd.lock
...
...
01-20 19:17:53.217 4019 403 W vold : Sending Killed to 32740
01-20 19:17:53.218 4019 403 W vold : Sending Killed to 32509
01-20 19:17:53.218 4019 403 W vold : Sending Killed to 32383
...
...
01-20 19:17:53.221 4019 403 E Cryptfs : Unexpected value for crypto key location
01-20 19:17:53.221 4019 403 E Cryptfs : Cannot get size of block device
--------- beginning of crash

I tried the steps given here on /data (/dev/block/sda25), but it did not do it for me either.

  1. Any idea on how I can debug further Cryptfs : Unexpected value for crypto key location?
  2. Is there a way to encrypt /data via the command line if this keeps failing?
1
  • 1
    Just for clarification: The OS is never encrypted, just the data on the user data partition is encrypted (should be FBE - File-Based Encryption if I am not mistaken). – Robert Jan 21 at 11:03
4

this device is encrypted with FDE full-disk-encryption. depending on how you installed Magisk the forceencrypt= flag is gone. that's what the "crypto key location" refer. edit your fstab and restore encryptable= flag that might help to use Samsung encryption in boot mode. but TWRP is most likely not able to decrypt anyway, so there is no benefit of having TWRP

btw this is a well known Magisk Bug and topjohnwu decided to ignore my fix

9
  • Thanks @alecxs, Magisk was installed throught TWRP, after LineageOS. /system/etc/fstab only has reference to the swap at this point. From what you're saying, encrypting book doesn't make much sense, is that right? Lastly, for learning purposes, how can I verify for myself that the device is encrypted with FDE? – lucasart Jan 21 at 12:58
  • 1
    afaik the file should located /vendor/etc/fstab.* should be something like /dev/block/platform/11120000.ufs/by-name/USERDATA /data ext4 wait,check,encryptable=footer and you can check with getprop ro.crypto.type – alecxs Jan 21 at 13:17
  • I had the wrong fstab... This is the vendor one: pastebin.com/raw/nimAc6vr, FYI. – lucasart Jan 21 at 13:21
  • 1
    you can just add the missing flag. when dealing with system files make sure to preserve owner+ permissions+ secontext (ls -lnZ) and keep correct line ending LF (not CRLF) – alecxs Jan 21 at 13:24
  • 1
    encryptable= is the proper flag (not encrypted=) and you must encrypt from security menu afterwards. if still not working follow your link to free space for crypto-footer – alecxs Jan 21 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.