OnePlus 3 Tutorials

How to Fix the TWRP Restore Unlock Bug on the OnePlus 3 and OnePlus 3T

OnePlus 3 TWRP Restore Unlock

If you forgot to remove the PIN, Pattern, Password before creating your backup in TWRP, then follow these steps to bypass the error on the OnePlus and OnePlus 3T.

This week, I’ve been showing you how to create a Nandroid backup on the OnePlus 3. Then I showed you how to restore a Nandroid backup on the OnePlus 3, and lastly I showed you how to delete a Nandroid backup on the OnePlus 3. One the tutorials where I showed you how to create and restore the backup, I made a note that warned you about a bug some people are experiencing on the OnePlus 3 with TWRP.

It’s been advised to delete your PIN, Pattern or Password before you create your Nandroid back with the OnePlus 3 (this bug also effected other devices like the Nexus 5X and 6P too). If you don’t, then when you restore the Nandroid backup, Android might not recognize your PIN, Pattern or Password. It doesn’t matter if you enter it correctly, this bug is preventing people from logging back into Android and making them panic.

There is a quick and easy way around this though and that’s what I want to show you today.

OnePlus 3 TWRP Restore Unlock

  1. Boot the OnePlus 3 into Recovery Mode
  2. Tap on the ‘Mount’ Button
  3. Tap on the ‘System’ Partition to Mount it
  4. Tap the Home Button at the Bottom
  5. Tap on the ‘Advanced’ Button
  6. Tap on the ‘File Manager’ Button
  7. Tap on the ‘data’ Folder
  8. Scroll Down and Tap on the ‘system’ Folder
  9. Scroll Down and Tap on the ‘locksettings.db’ File
  10. Tap on the ‘Delete’ Button
  11. Swipe the White Arrows to the Right to Confirm
  12. Tap the ‘Back’ Button and Make Sure the File is Deleted
  13. Tap the Home Button at the Bottom
  14. Tap the ‘Reboot’ Button
  15. Then Tap on the ‘System’ Button to Reboot into Android

Note – If you still can’t boot into Android, you may need to go back into the OnePlus 3 Recovery Mode and go through these same steps again. Except this time, you’ll want to delete the locksettings.db-shm, locksettings.db-wal, gatekeeper.password.key, and gatekeeper.pattern.key. I wasn’t required to do that in the video shown below, but some people have needed to delete all of these files to get it to work on their setup.


Explanation

This bug has been present with TWRP for a little while now. I know it was very prevalent on the Nexus 5X as well as the Nexus 6P and it seems to be because of the way Android is handling this PIN/Pattern/Password data (I’m assuming it’s because of encryption). Not everyone is experiencing this though. When I tested this issue the first time, it didn’t happen to me. It wasn’t until I tried it a few more times (after tinkering with the settings) that I was able to get the bug to trigger.

If you are experiencing this, you have probably already done the restore process and now you’re unable to boot into Android. So go ahead and power down the OnePlus 3 and then boot it up into Recovery Mode as described in the tutorial that I linked in the guide above. Once you are back into TWRP, tap on the Mount button and then make sure the System partition is mounted/checked. From here, tap on the Home button so we can go back to the TWRP main menu.

OnePlus 3 Root Swipe

Swipe the white arrows to delete the file.

Next, you’ll want to tap on the Advanced button, then the File Manager button and then you’ll be shown a list of the folders in the root directory. Simply tap on the data folder, then scroll down and tap on the system folder. Now, you’ll need to scroll down and tap on the locksettings.db so that you can bring up the various actions you can do with it. Since we want to delete it, tap on the Delete button and then swipe the white arrows to the right to confirm.

From here, I recommend tapping the Back button so you can make sure that locksettings.db is actually gone. If it is, then simply tap on the Home button, tap on the Restart button and lastly tap on the System button to reboot the OnePlus 3 back into Android. If you can reboot back into Android then your issue has been resolved and you can go ahead and setup your PIN, Pattern, or Password again.

If you still can’t get into Android, which some people do experience, then you’ll want to boot back into Recovery Mode on the OnePlus 3 and delete some additional files related to the lock screen and your PIN/Pattern/Password. As mentioned above, the additional files are locksettings.db-shm, locksettings.db-wal, gatekeeper.password.key, and gatekeeper.pattern.key. And just make sure those are deleted before you boot back into the Android OS.

If this tutorial helped you in any way, please consider donating at Patreon or PayPal. Any and all donations will help keep the website alive and allow me to continue making Android tutorials and videos.

  • Jey Nessuno

    My data folder is empty…

    • Jey Nessuno

      Solved mounting system AND data plus rebooting twrp

      • Thanks for that feedback Jey. Hopefully this will help anyone else who experiences this issue in the future

  • Ryan Edwards

    This tutorial was a lifesaver. I was playing with MultiRom and for some reason, after I installed a new secondary rom, my daily driver secondary rom began refusing to accept my PIN. In order to use this technique in that situation, I needed to swap my primary and daily driver secondary in MR-TWRP because in TWRP you can only use File Manager on your primary ROM and i couldn’t access the file on my secondary rom.

    • Thanks for the feedback, Ryan. This bug has made many people feel they have to wipe everything and start over. Thankfully there’s a workaround for it :)

  • Ilgaz Gülaydın

    What if this bug appeared after i re-locked bootloader so all my data and settings are back to factory settings, so no recovery mode, no USB debugging… i am stuck with this screen and even if i want to reset the phone to factory settings i cant do it. What the hell do i do someone please help me omg….

  • Amr Fouda

    my data file i showing empty, i am stuck now i cant reset my phone to remove TWRP or install the super SU cuz the TWRP is asking for password and i try every password i know but no way , i try my pattern also
    pls help

    • For the password, can you try “default_password” without quotes?

      • Amr Fouda

        i try i, it didnot work
        pls try to help me, i need to remove twrp and start from begining again but i cannot

        • To start from the beginning, you’ll want to remove TWRP and install stock recovery. You can do that by following this guide

          https://www.androidexplained.com/oneplus-3-stock-recovery/

          • Amr Fouda

            mine is oneplus 3t, i did install stock recovery and i but nougat in internal storage but when trying to press install from internal storage nothing happens it is not active
            i try also to install nougat using adb sideload but every time reach to 45% then stop and giving failed message

      • Amr Fouda

        even i cannot but my phone in recovery mode cuz it is opening in twrp and ywrp is asking for the password otherwise nothing else is working in twrp

  • Ignatius Danang

    After updating AdAway host and reboot, I experienced this problems. I’m not forgot my PIN, but the keyboard won’t shown so I can’t enter the PIN. But when I boot TWRP and ask for PIN, my default keyboard shown. I tried this tutorial and deleting all the file mentioned but still can’t boot into system.

  • Jill

    If I use fingerprint, do i still need to remove the these, or only if i use Pw, Pin or pattern?? What about backup PIN for the fingerprint? Can I just set security to “none” or screen swipe before doing a NANDROID B/U or do I have to delete al fingerprints in settings? Thanks! ove your guides! Just getting the guts up to unlock and root my OP3T and get to modding!