Changing Encrypted Partition Password on LineageOS 14.1
June 20, 2018
Posted by on
This was done on a ZTE Axon 7 running Android 7.1.2 (LineageOS 14.1).
I booted into the LineageOS 14.1 operating system, connected using ADB.
WARNING: the encryption password can only be changed in LineageOS itself, not TWRP, so if you get this wrong you will have an irrecoverable encrypted data partition. To protect yourself ensure you verify the new password before rebooting.
NOTE: this does not change the screen lock code, it only changes the password for decrypting the phone on boot (the first password you’re required to enter after a cold boot).
~$ adb root
~$ adb shell
axon7:/ # vdc cryptfs verifypw 1234 # wrong password
200 8421 -1
axon7:/ # vdc cryptfs verifypw 1111 # wrong password
200 8543 -1
axon7:/ # vdc cryptfs verifypw 4444 # correct password
200 8558 0
axon7:/ # vdc cryptfs changepw help
Usage: cryptfs changepw default|password|pin|pattern [[currentpasswd] newpasswd]
axon7:/ # vdc cryptfs changepw pin 4444 912541324 # change password
200 8703 0
axon7:/ # vdc cryptfs verifypw 4444 # no longer correct password
200 8761 -1
axon7:/ # vdc cryptfs verifypw 912541324 # new correct password
200 8770 0
Thanks to the information in this forum post for assistance in how to do this.