[HOWTO] Get over lock screen when code/password/pattern don't work anymore

After typing your password, your phone refuses to unlock, or you’re stuck on lock screen ?
A solution is to rename or delete your lockscreen settings.


  • Having TWRP installed
  • A backup is recommended, mainly if your device is encrypted

How to bypass lock screen

  1. Boot to TWRP
    You may need to enter in the bootloader of your device, then enter in recovery mode.
  2. In TWRP, click on Advanced then File Manager
  3. Go to /data then system, find and press the locksettings.db file
  4. Now press Delete file (you can also Rename file ), then Swipe to Confirm
  5. Ended ! Click Reboot System.

Source : u/monteverde_org on Reddit [archive]
On forum : How can I reset my Trust-PIN?


@Manoj Is this bug ever going to be resolved, or is it a feature now? bug

Ideally it should be resolved but as always I will share the lack of developers excuse…it would be great if users with development experience can code and merge such changes / fixes.

It is needed after a TWRP restore from/to a lock-enabled phone.

If phone is encrypted TWRP is asking for unlock scheme at startup, before user could access any file.

So I think that recommendations in @GaelDuval post (here) are perfectly relevant.

I lost the PIN for the lock screen. To rename or delete the lockscreen settings I have to install TWRP - and therefore I need access to the phone… A diabolic circle.
Are there any other suggestions?

Hi @cwachter57 welcome,

can you use adb?

Also, if you can power down the device from the unlock screen (using button), you could reboot to fastboot/bootloader using the key combo, and boot or install TWRP from there.


To the phone, yes. To the lock screen, probably not.
Please have a look at the official TWRP documentation for your device at https://twrp.me/Devices/ for different ways to install or just boot TWRP on your device.