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.


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. If you can't afford to donate then sharing this on social networks such as Facebook, Twitter, etc. will also help a lot.

About the author


I'm working to create an organized and easy to follow central repository of Android tips, tutorials, guides and everything you need to know. With a focus on device specific tutorials now, my goal is to branch out and do more universal tips and tricks that will work on all Android devices.