Pattern unlock after TWRP restore

Search This thread

bobcee

Member
Jan 4, 2016
7
0
Nexus 5X
TWRP 2.8.7.2
- Backup included: Boot, System, Vendor, Vendor image, Data, Recovery & EFS
- Stock ROM rooted

I created this backup because I wanted to try out the Pure Nexus ROM. Followed instructions before flashing (wipe data system etc..) everything was working fine but I later decided that I wanted to revert back for the time being. Booted into recovery, wiped data, system and so on before restoring backup. Once restored and at the lockscreen I placed my finger on the fingerprint scanner and was prompted for a pattern. Tried the only pattern I always use multiple times but it didnt work (as well as others) and it never locked me out. Did some reading online, followed an article on how to bypass-androids-pattern-lock-screen-access-its-files-from-pc, when i typed in adb shell rm /data/system/gesture.key I got this error "rm: can't remove '/data/system/gesture.key': No such file or directory. Don't know what to do from here.

Any help would be much appreciated.
 

Giovix92

Recognized Developer
Oct 22, 2015
1,722
1,773
22
Catanzaro, Italy
Nexus 5X
TWRP 2.8.7.2
- Backup included: Boot, System, Vendor, Vendor image, Data, Recovery & EFS
- Stock ROM rooted

I created this backup because I wanted to try out the Pure Nexus ROM. Followed instructions before flashing (wipe data system etc..) everything was working fine but I later decided that I wanted to revert back for the time being. Booted into recovery, wiped data, system and so on before restoring backup. Once restored and at the lockscreen I placed my finger on the fingerprint scanner and was prompted for a pattern. Tried the only pattern I always use multiple times but it didnt work (as well as others) and it never locked me out. Did some reading online, followed an article on how to bypass-androids-pattern-lock-screen-access-its-files-from-pc, when i typed in adb shell rm /data/system/gesture.key I got this error "rm: can't remove '/data/system/gesture.key': No such file or directory. Don't know what to do from here.

Any help would be much appreciated.

Hmmm. Try to follow this steps:
1: boot into TWRP
2: Mount /system ; /data and others
3: Go to Advanced-File Manager
4: Go to /data/system/
5: If exist the gesture.key file, copy it in your internal/external memory (in case of bootloop)
6: Delete the gesture.key file from /data/system/
7: Reboot and view if the pattern is removed
 

bobcee

Member
Jan 4, 2016
7
0
Hmmm. Try to follow this steps:
1: boot into TWRP
2: Mount /system ; /data and others
3: Go to Advanced-File Manager
4: Go to /data/system/
5: If exist the gesture.key file, copy it in your internal/external memory (in case of bootloop)
6: Delete the gesture.key file from /data/system/
7: Reboot and view if the pattern is removed

Hey thanks for the reply, im up to step 5 at the moment currently looking in data/system and cannot find a gesture.key in there. The only .key files present are:
1. gatekeeper.password.key and
2. gatekeeper.pattern.key

There is also locksettings.db, locksettings.db-shm and locksettings.db-wal. Im guessing they are to do with the lockscreen?

Im under the impression that the TWRP restore somehow created a 'ghost' pattern that doesnt seem to exist, hence its not accepting any pattern that i try and is also not limiting the number of tries. (sorry for the terminology im learning haha).
 
Last edited:

Giovix92

Recognized Developer
Oct 22, 2015
1,722
1,773
22
Catanzaro, Italy
Hey thanks for the reply, im up to step 5 at the moment currently looking in data/system and cannot find a gesture.key in there. The only .key files present are:
1. gatekeeper.password.key and
2. gatekeeper.pattern.key

There is also locksettings.db, locksettings.db-shm and locksettings.db-wal. Im guessing they are to do with the lockscreen?

Im under the impression that the TWRP restore somehow created a 'ghost' pattern that doesnt seem to exist, hence its not accepting any pattern that i try and is also not limiting the number of tries. (sorry for the terminology im learning haha).

Hmmm... Try (via TWRP) to follow this steps:
1: Go to /data/system/
2: Copy in your internal/external sd card these files: gatekeeper.password.key and gatekeeper.pattern.key
3: After you have pasted this files, return to /data/system/
4: Delete (from /data/system) gatekeeper.password.key and gatekeeper.pattern.key
5: Reboot
6: If the nexus will stuck in bootloop, restore these files. :)

Edit: locksettings.db.... I need to verify this file... I'll give you an update about this file asap.
 
Last edited:

bobcee

Member
Jan 4, 2016
7
0
Hmmm... Try (via TWRP) to follow this steps:
1: Go to /data/system/
2: Copy in your internal/external sd card these files: gatekeeper.password.key and gatekeeper.pattern.key
3: After you have pasted this files, return to /data/system/
4: Delete (from /data/system) gatekeeper.password.key and gatekeeper.pattern.key
5: Reboot
6: If the nexus will stuck in bootloop, restore these files. :)

Edit: locksettings.db.... I need to verify this file... I'll give you an update about this file asap.

Hi again, so i tried the following steps and it booted up all fine and didnt ask me for a pattern! However when i try to change the sceen lock it crashes and says "unfortunately, settings has stopped". But atleast i can get into the phone now! Thanks so much for the help.
 

Giovix92

Recognized Developer
Oct 22, 2015
1,722
1,773
22
Catanzaro, Italy
Hi again, so i tried the following steps and it booted up all fine and didnt ask me for a pattern! However when i try to change the sceen lock it crashes and says "unfortunately, settings has stopped". But atleast i can get into the phone now! Thanks so much for the help.

Good! Now, if you find the clean version (without patterns) of these files, you are ok. You're welcome. :)
 
  • Like
Reactions: bobcee

greee

Member
Dec 19, 2008
9
3
Paris
I've got the same problem, and the same solutions works (thanks @Giovix92)
But at the end of the process, I can not put another pattern or something else :(
So my phone is open to everybody => that's bad
Does some can provide a know gesture with both files (gatekeeper.password.key and gatekeeper.pattern.key) ?

please @bobcee , did you find a way ?

PS : my device is a Nexus 5X, under rooted MMB29Q
 

Giovix92

Recognized Developer
Oct 22, 2015
1,722
1,773
22
Catanzaro, Italy
I've got the same problem, and the same solutions works (thanks @Giovix92)
But at the end of the process, I can not put another pattern or something else :(
So my phone is open to everybody => that's bad
Does some can provide a know gesture with both files (gatekeeper.password.key and gatekeeper.pattern.key) ?

please @bobcee , did you find a way ?

PS : my device is a Nexus 5X, under rooted MMB29Q

You're welcome. You should get a nandroid backup of another Nexus 5X without pattern. Then use nandroid manager to manage the system.img file and extract the two files. Then reboot into TWRP and replace these files. And you are done. :)
 

glehel

Senior Member
Jun 9, 2013
313
56
ASUS ZenFone 8
boot Twrp run file manager
only delete locksettings.db in /data/system/locksettings.db
reboot and it works!

Heisenberg wrote:
"Note: If you happened to forget to remove lockscreen security (PIN/Pattern/Fingerprint) before creating your backup, and you cannot get into your OS after restoring, you can do the following to fix the issue. Boot into TWRP and use the built in file manager to delete /data/sytem/locksettings.db. This should be enough to get you into your OS again. If it isn't you can also try deleting /data/system/locksettings.db-shm and /data/system/locksettings.db-wal. If this still doesn't fix your issue you can delete /data/system/gatekeeper.password.key and /data/system/gatekeeper.pattern.key."
 
Last edited:

greee

Member
Dec 19, 2008
9
3
Paris
You're welcome. You should get a nandroid backup of another Nexus 5X without pattern. Then use nandroid manager to manage the system.img file and extract the two files. Then reboot into TWRP and replace these files. And you are done. :)

Seems complicated, I really don't know where to get such files :crying:
And I think a pattern is now mandatory on Marshmallow setup, no ?

---------- Post added at 05:26 PM ---------- Previous post was at 05:05 PM ----------

I just find another way !
First I've asked for a device lock on android manager website https://www.google.com/android/devicemanager
Then after unlocking my Nexus 5X with the given password, I was able to change (parameters/security) to a new pattern.
Great !
 
Last edited:

Giovix92

Recognized Developer
Oct 22, 2015
1,722
1,773
22
Catanzaro, Italy
boot Twrp run file manager
only delete locksettings.db in /data/system/locksettings.db
reboot and it works!

Heisenberg wrote:
"Note: If you happened to forget to remove lockscreen security (PIN/Pattern/Fingerprint) before creating your backup, and you cannot get into your OS after restoring, you can do the following to fix the issue. Boot into TWRP and use the built in file manager to delete /data/sytem/locksettings.db. This should be enough to get you into your OS again. If it isn't you can also try deleting /data/system/locksettings.db-shm and /data/system/locksettings.db-wal. If this still doesn't fix your issue you can delete /data/system/gatekeeper.password.key and /data/system/gatekeeper.pattern.key."

You should only delete gatekeeper.password.key and gatekeeper.pattern.key and you'll be able to enter in your phone. Isn't needed to delete locksettings.db and other.

---------- Post added at 05:02 PM ---------- Previous post was at 05:00 PM ----------

Seems complicated, I really don't know where to get such files :crying:
And I think a pattern is now mandatory on Marshmallow setup, no ?

---------- Post added at 05:26 PM ---------- Previous post was at 05:05 PM ----------

I just find another way !
First I've asked for a device lock on android manager website https://www.google.com/android/devicemanager
Then after unlocking my Nexus 5X with the given password, I was able to change (parameters/security) to a new pattern.
Great !

Good! I explain the process: When you unlock the bootloader, all your files will be deleted because the operation works as the factory reset. In fact: Unlock BL=Factory reset. Doing a factory reset=Restore ALL system files.
 

glehel

Senior Member
Jun 9, 2013
313
56
ASUS ZenFone 8
You should only delete gatekeeper.password.key and gatekeeper.pattern.key and you'll be able to enter in your phone. Isn't needed to delete locksettings.db and other.

---------- Post added at 05:02 PM ---------- Previous post was at 05:00 PM ----------



Good! I explain the process: When you unlock the bootloader, all your files will be deleted because the operation works as the factory reset. In fact: Unlock BL=Factory reset. Doing a factory reset=Restore ALL system files.
I just tried it and it was good as I wrote.
 

bobcee

Member
Jan 4, 2016
7
0
Seems complicated, I really don't know where to get such files :crying:
And I think a pattern is now mandatory on Marshmallow setup, no ?

---------- Post added at 05:26 PM ---------- Previous post was at 05:05 PM ----------

I just find another way !
First I've asked for a device lock on android manager website https://www.google.com/android/devicemanager
Then after unlocking my Nexus 5X with the given password, I was able to change (parameters/security) to a new pattern.
Great !
I was not able to set a pattern lock after deleting the 2 files. But i just wanted to get into the phone so that i could backup apps using titanium backup. I factory reset, which fixed the patten lock issue, and restored my apps.
 

Vulkaistos

Member
Dec 28, 2015
40
17
Did you already tried this??


The easy way to fix that issue:

1) Restore from Nandroid Backup
2) Go into ADB and use the following commands:
rm /data/system/locksettings.db
rm /data/system/*.key
Or delete them via the TWRP Filemanager
3) Boot and voila!

Note, it is recommended for you to restore your pin code afterwords.
 

Giovix92

Recognized Developer
Oct 22, 2015
1,722
1,773
22
Catanzaro, Italy
Did you already tried this??


The easy way to fix that issue:

1) Restore from Nandroid Backup
2) Go into ADB and use the following commands:
rm /data/system/locksettings.db
rm /data/system/*.key
Or delete them via the TWRP Filemanager
3) Boot and voila!

Note, it is recommended for you to restore your pin code afterwords.

He already deleted these files by my steps, he don't need to redelete it. ;)
 

lomistars

Senior Member
Jul 5, 2012
324
127
boot Twrp run file manager
only delete locksettings.db in /data/system/locksettings.db
reboot and it works!

Heisenberg wrote:
"Note: If you happened to forget to remove lockscreen security (PIN/Pattern/Fingerprint) before creating your backup, and you cannot get into your OS after restoring, you can do the following to fix the issue. Boot into TWRP and use the built in file manager to delete /data/sytem/locksettings.db. This should be enough to get you into your OS again. If it isn't you can also try deleting /data/system/locksettings.db-shm and /data/system/locksettings.db-wal. If this still doesn't fix your issue you can delete /data/system/gatekeeper.password.key and /data/system/gatekeeper.pattern.key."

This has worked well for me. i was able to bypass pattern security screen and reset a new one without any problems.
Thanks
 

lucfig

Senior Member
Feb 19, 2008
901
261
Rio das Ostras
For me, when deleting the "*.key" files I cannot set a new pattern as the system config craches.
When deleting "locksettings.db" I can set a new pattern but I lost the smart lock features.

I did not find any other sollution until now.
Will just Titanium Backup everything and format the phone.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Hey thanks for the reply, im up to step 5 at the moment currently looking in data/system and cannot find a gesture.key in there. The only .key files present are:
    1. gatekeeper.password.key and
    2. gatekeeper.pattern.key

    There is also locksettings.db, locksettings.db-shm and locksettings.db-wal. Im guessing they are to do with the lockscreen?

    Im under the impression that the TWRP restore somehow created a 'ghost' pattern that doesnt seem to exist, hence its not accepting any pattern that i try and is also not limiting the number of tries. (sorry for the terminology im learning haha).

    Hmmm... Try (via TWRP) to follow this steps:
    1: Go to /data/system/
    2: Copy in your internal/external sd card these files: gatekeeper.password.key and gatekeeper.pattern.key
    3: After you have pasted this files, return to /data/system/
    4: Delete (from /data/system) gatekeeper.password.key and gatekeeper.pattern.key
    5: Reboot
    6: If the nexus will stuck in bootloop, restore these files. :)

    Edit: locksettings.db.... I need to verify this file... I'll give you an update about this file asap.
    4
    Nexus 5X
    TWRP 2.8.7.2
    - Backup included: Boot, System, Vendor, Vendor image, Data, Recovery & EFS
    - Stock ROM rooted

    I created this backup because I wanted to try out the Pure Nexus ROM. Followed instructions before flashing (wipe data system etc..) everything was working fine but I later decided that I wanted to revert back for the time being. Booted into recovery, wiped data, system and so on before restoring backup. Once restored and at the lockscreen I placed my finger on the fingerprint scanner and was prompted for a pattern. Tried the only pattern I always use multiple times but it didnt work (as well as others) and it never locked me out. Did some reading online, followed an article on how to bypass-androids-pattern-lock-screen-access-its-files-from-pc, when i typed in adb shell rm /data/system/gesture.key I got this error "rm: can't remove '/data/system/gesture.key': No such file or directory. Don't know what to do from here.

    Any help would be much appreciated.

    Hmmm. Try to follow this steps:
    1: boot into TWRP
    2: Mount /system ; /data and others
    3: Go to Advanced-File Manager
    4: Go to /data/system/
    5: If exist the gesture.key file, copy it in your internal/external memory (in case of bootloop)
    6: Delete the gesture.key file from /data/system/
    7: Reboot and view if the pattern is removed
    3
    boot Twrp run file manager
    only delete locksettings.db in /data/system/locksettings.db
    reboot and it works!

    Heisenberg wrote:
    "Note: If you happened to forget to remove lockscreen security (PIN/Pattern/Fingerprint) before creating your backup, and you cannot get into your OS after restoring, you can do the following to fix the issue. Boot into TWRP and use the built in file manager to delete /data/sytem/locksettings.db. This should be enough to get you into your OS again. If it isn't you can also try deleting /data/system/locksettings.db-shm and /data/system/locksettings.db-wal. If this still doesn't fix your issue you can delete /data/system/gatekeeper.password.key and /data/system/gatekeeper.pattern.key."
    3
    I know this is an old thread but it my help someone else. If you delete "locksettings.dB" smart lock becomes disabled. However, if you just scroll to the bottom part in security , click on trusted agents and activate smart lock. All will be well again.
    2
    You're welcome. You should get a nandroid backup of another Nexus 5X without pattern. Then use nandroid manager to manage the system.img file and extract the two files. Then reboot into TWRP and replace these files. And you are done. :)

    Seems complicated, I really don't know where to get such files :crying:
    And I think a pattern is now mandatory on Marshmallow setup, no ?

    ---------- Post added at 05:26 PM ---------- Previous post was at 05:05 PM ----------

    I just find another way !
    First I've asked for a device lock on android manager website https://www.google.com/android/devicemanager
    Then after unlocking my Nexus 5X with the given password, I was able to change (parameters/security) to a new pattern.
    Great !