[GUIDE | FIX] PIN/PATTERN/PASSWORD not recognised after TWRP restore

Search This thread

5m4r7ph0n36uru

Senior Member
Apr 23, 2014
3,800
3,473
MD5: 91497e1b11f2262d0d8ff0aa7a164f3b
32280653006_0a62a1d2a9_c.jpg

Hello folks,

this is regarding a question that does seem to pop up just ever and ever again, with the respective developer teams, developers and tester over in the ROM and development section, seemingly, having to answer it always and again. By this the respective question has been answered at least a hundred times by people like e.g. Captain_Throwback, j to the 4n, nkk71, topjohnwu, LeeDrOiD, Llabtoofer and many other I'm - to keep the matter brief at this point - gonna leave uncredited. If anyone wants me to credit im personally please let me know via PM. I'll in such a case add his/her name to the credits section below.

What I did was just carrying together the needed information. All of it has been written prior to this, on various threads. Always by one the above mentioned and/or others. Anyway I'll give the steps again in this short tutorial as I think it is of importance to many to be able to find a solution to their problem right at the top of a quick thread. In addition such guides were really helpful to me in the past, learning about how Android works. Thus I decided to open up yet another thread.

If you - just like me - have set a lock pattern or password on your device, and you did a TWRP backup as long as the pattern has been set, you might - especially restoring different ROMs - be confronted by a little problem where after the HTC 10 boots up you cannot unlock it even if you enter the correct lock pattern/pin/password.

Well then this thread is about how you can fix it.

32567527592_36bafaa846.jpg

Method 1 - TWRP FileManager

  • boot to recovery
    • reboot to bootloader
    • reboot to recovery
  • In TWRP, go to "Advanced" > "File Manager"
  • In TWRP File Manager, go to /data/system folder
  • Find and delete the following files:
    Code:
    locksettings.db-wal
    locksettings.db-shm
    locksettings.db

Reboot the phone/tablet back into the ROM. Now you should be able to just swipe the lock screen and get into the launcher screen. You can then set a new lock from the Settings, if you want.

Method 2 - TWRP Terminal

  • boot to recovery
    • reboot to bootloader
    • reboot to recovery
  • In TWRP, go to "Advanced" > "Terminal"
  • Type the following commands:
    Code:
    cd /data/system
    rm -f locksettings*
    rm -f *.key

Method 3 - TWRP Flash of "lockjscreen_removed_signed.zip
  • Download the zip provided by @JohnFawkes in Post #5
  • Place downloaded zip onto your device
  • boot to recovery
    • reboot to bootloader
    • reboot to recovery
  • In TWRP, flash the downloaded zip

31877367484_f88c9d6a33_m.jpg


THANKS TO ALL DEVELOPERS AND DEVELOPER TEAMS, AS WELL AS THEIR TESTERS!
THEY FOUND OUT AND PRESENTED US WITH THE SOLUTION.


32597366961_c5216eb051_m.jpg




XDA:DevDB Information
PIN/PATTERN/PASSWORD not recognised after TWRP restore

Contributors
All referred to in Credits, 5m4r7ph0n36uru (OP Leader)
 
Last edited:

jeehuu91

Senior Member
Jun 24, 2013
80
17
32280653006_0a62a1d2a9_c.jpg

hello folks,

this is regarding a question that does seem to pop up just ever and ever again, with the respective developer teams, developers and tester over in the rom and development section, seemingly, having to answer it always and again. By this the respective question has been answered at least a hundred times by people like e.g. Captain_throwback, j to the 4n, nkk71, topjohnwu, leedroid, llabtoofer and many other i'm - to keep the matter brief at this point - gonna leave uncredited. If anyone wants me to credit im personally please let me know via pm. I'll in such a case add his/her name to the credits section below.

What i did was just carrying together the needed information. All of it has been written prior to this, on various threads. Always by one the above mentioned and/or others. Anyway i'll give the steps again in this short tutorial as i think it is of importance to many to be able to find a solution to their problem right at the top of a quick thread. In addition such guides were really helpful to me in the past, learning about how android works. Thus i decided to open up yet another thread.

If you - just like me - have set a lock pattern or password on your device, and you did a twrp backup as long as the pattern has been set, you might - especially restoring different roms - be confronted by a little problem where after the htc 10 boots up you cannot unlock it even if you enter the correct lock pattern/pin/password.

Well then this thread is about how you can fix it.

32567527592_36bafaa846.jpg

method 1 - twrp filemanager

  • boot to recovery
    • reboot to bootloader
    • reboot to recovery
  • in twrp, go to "advanced" > "file manager"
  • in twrp file manager, go to /data/system folder
  • find and delete the following files:
    Code:
    locksettings.db-wal
    locksettings.db-shm
    locksettings.db

reboot the phone/tablet back into the rom. Now you should be able to just swipe the lock screen and get into the launcher screen. You can then set a new lock from the settings, if you want.

method 2 - twrp terminal

  • boot to recovery
    • reboot to bootloader
    • reboot to recovery
  • in twrp, go to "advanced" > "terminal"
  • type the following commands:
    Code:
    cd /data/system
    rm -f locksettings*
    rm -f *.key

31877367484_f88c9d6a33_m.jpg


thanks to all developers and developer teams, as well as their testers!
They found out and presented us with the solution.


32597366961_c5216eb051_m.jpg




xda:devdb information
pin/pattern/password not recognised after twrp restore

contributors
all referred to in credits, 5m4r7ph0n36uru (op leader)

this really really saved my life!!!! :d:d:d
 

miamicuse

Member
Dec 27, 2017
14
0
Fort Lauderdale
I am running into a similar issue after updated my HTC 10 to Oreo. After installing the system update it rebooted itself twice, then asked me for a lock screen pattern and I put in mine (and I am absolutely sure it's correct) but it rejected it, saying I have 29 more attempts before device data is deleted.
I don't have TWRP installed, is factory reset the only option? and will a factory reset take it back to the original Android 7 or the new Oreo 8?
 

Dustymone

New member
Feb 6, 2019
1
0
Hello 5m4r7ph0n36uru, can you tell me...
If I follow your guide, eill this delete everything on my phone, photos, messages.
My problem is that I forgot the pattern required after restarting phone.
Thank you kindly, Dusty.
 

Mr Hofs

Senior Member
Sep 10, 2011
19,173
14,608
Hello 5m4r7ph0n36uru, can you tell me...
If I follow your guide, eill this delete everything on my phone, photos, messages.
My problem is that I forgot the pattern required after restarting phone.
Thank you kindly, Dusty.

There is no mentioning about losing data at all in the OP and the commands only show that they delete lockscreen password files so no you will not lose data.....
 

IrenePappel

Member
Apr 20, 2008
29
4
Scenario: Let's say I have a smartphone with both configured, PIN and Pattern. Default would be Pattern, backup method would be PIN. And I don't know the PIN.

Question: Is it possible to remove only the .key files (using TWRP) that are responsible for the PIN but keep the Pattern protection active? After reboot, there would still be the Pattern protection but when switching to PIN, the (new) PIN would be empty.?

Or alternatively, would it also be feasible to REPLACE only the .key files that are responsible for the (unknown) PIN with other .key files of a known PIN and at the same time, keep the default Pattern protection intact?
 

trachyte

Member
Nov 9, 2015
25
130
Scenario: Let's say I have a smartphone with both configured, PIN and Pattern. Default would be Pattern, backup method would be PIN. And I don't know the PIN.

Question: Is it possible to remove only the .key files (using TWRP) that are responsible for the PIN but keep the Pattern protection active? After reboot, there would still be the Pattern protection but when switching to PIN, the (new) PIN would be empty.?

Or alternatively, would it also be feasible to REPLACE only the .key files that are responsible for the (unknown) PIN with other .key files of a known PIN and at the same time, keep the default Pattern protection intact?

Once you remove the PIN and Pattern you will be able to boot into the system and set up the PIN and Pattern however you'd like. No need to mess with the files directly.
 

lestatab

Senior Member
Mar 25, 2016
67
11
32280653006_0a62a1d2a9_c.jpg
  • boot to recovery
    • reboot to bootloader
    • reboot to recovery
  • In TWRP, go to "Advanced" > "File Manager"
  • In TWRP File Manager, go to /data/system folder
  • Find and delete the following files:
    Code:
    locksettings.db-wal
    locksettings.db-shm
    locksettings.db

Reboot the phone/tablet back into the ROM. Now you should be able to just swipe the lock screen and get into the launcher screen. You can then set a new lock from the Settings, if you want.

You save me from a factory reset, i flash the aicp_zl1_p-14.0-WEEKLY-20190627.zip update and i was getting blackscreen after putting pin, now works ok
 
Nov 28, 2017
12
2
Kadapa
My problem is weird

After rooting,I have kept a lockscreen pattern,then it shows incorrect pattern even I drawn correctly. I flashed that above zip and lock was bypasses,then I tried again keeping PIN lock,same problem again,shows incorrect PIN even I entered correct pin
 

andybones

Recognized Contributor / Inactive Recognized Devel
May 18, 2010
14,502
14,676
After rooting,I have kept a lockscreen pattern,then it shows incorrect pattern even I drawn correctly. I flashed that above zip and lock was bypasses,then I tried again keeping PIN lock,same problem again,shows incorrect PIN even I entered correct pin

This is what I would do personally, and do frequently when using multirom when on N firmware and restore a backup that has a pin.
From the xda HTC 10 twrp FAQ.

"while still in TWRP, use the TWRP File Manager to navigate to /data/system and delete all the locksettings.* files (such as locksettings.db, etc). When you reboot, the password will be gone."

I find that just deleting the single locksettings.db file is enough for me to remove the pin/password or pattern, and keeps the fingerprints stored. This way I can still use my fingerprints to log into apps, but have no pin or anything to unlock phone.
 

andybones

Recognized Contributor / Inactive Recognized Devel
May 18, 2010
14,502
14,676
Yup,I have enabled pattern now,my pattern and pin working fine. I got a Zip file named enable_encryption from Realme unofficial developers. Then I flashed it in TWRP , my problem fixed

always risky flashing zip for another device.
glad it worked though
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 24
    32280653006_0a62a1d2a9_c.jpg

    Hello folks,

    this is regarding a question that does seem to pop up just ever and ever again, with the respective developer teams, developers and tester over in the ROM and development section, seemingly, having to answer it always and again. By this the respective question has been answered at least a hundred times by people like e.g. Captain_Throwback, j to the 4n, nkk71, topjohnwu, LeeDrOiD, Llabtoofer and many other I'm - to keep the matter brief at this point - gonna leave uncredited. If anyone wants me to credit im personally please let me know via PM. I'll in such a case add his/her name to the credits section below.

    What I did was just carrying together the needed information. All of it has been written prior to this, on various threads. Always by one the above mentioned and/or others. Anyway I'll give the steps again in this short tutorial as I think it is of importance to many to be able to find a solution to their problem right at the top of a quick thread. In addition such guides were really helpful to me in the past, learning about how Android works. Thus I decided to open up yet another thread.

    If you - just like me - have set a lock pattern or password on your device, and you did a TWRP backup as long as the pattern has been set, you might - especially restoring different ROMs - be confronted by a little problem where after the HTC 10 boots up you cannot unlock it even if you enter the correct lock pattern/pin/password.

    Well then this thread is about how you can fix it.

    32567527592_36bafaa846.jpg

    Method 1 - TWRP FileManager

    • boot to recovery
      • reboot to bootloader
      • reboot to recovery
    • In TWRP, go to "Advanced" > "File Manager"
    • In TWRP File Manager, go to /data/system folder
    • Find and delete the following files:
      Code:
      locksettings.db-wal
      locksettings.db-shm
      locksettings.db

    Reboot the phone/tablet back into the ROM. Now you should be able to just swipe the lock screen and get into the launcher screen. You can then set a new lock from the Settings, if you want.

    Method 2 - TWRP Terminal

    • boot to recovery
      • reboot to bootloader
      • reboot to recovery
    • In TWRP, go to "Advanced" > "Terminal"
    • Type the following commands:
      Code:
      cd /data/system
      rm -f locksettings*
      rm -f *.key

    Method 3 - TWRP Flash of "lockjscreen_removed_signed.zip
    • Download the zip provided by @JohnFawkes in Post #5
    • Place downloaded zip onto your device
    • boot to recovery
      • reboot to bootloader
      • reboot to recovery
    • In TWRP, flash the downloaded zip

    31877367484_f88c9d6a33_m.jpg


    THANKS TO ALL DEVELOPERS AND DEVELOPER TEAMS, AS WELL AS THEIR TESTERS!
    THEY FOUND OUT AND PRESENTED US WITH THE SOLUTION.


    32597366961_c5216eb051_m.jpg




    XDA:DevDB Information
    PIN/PATTERN/PASSWORD not recognised after TWRP restore

    Contributors
    All referred to in Credits, 5m4r7ph0n36uru (OP Leader)
    7
    You can add this to OP if you want. But you can just flash this zip and it will delete the files automatically
    1
    It might do. But it'd be much safer to delete all, as it then works on all kind of devices ;)

    Sent from my htc_pmeuhl using XDA Labs
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone