Cryptfs : Unexpected value for crypto key location


Question

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?


Answer

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


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes