Once your device is rooted and you begin tinkering with mods and custom ROMs, a nandroid backup will start coming very handy. Who knows when your device will suddenly malfunction? But now with your backup, you will always have a fail-safe ‘undo’ button. If you don’t know how to create a nandroid backup, the steps are very simple.

Also read: How to Bypass Lock Screen Security on Android (Pattern /Pin /Password)

You must have a custom recovery (TWRP is the current favorite), and there will be an option to create a backup in the recovery main screen itself. Don’t do anything with the check boxes, just swipe right at the bottom to start creating a backup. Based on installed apps and data, a nandroid backup can take up several gigs of SD Card storage. When the process is complete, go back to the main screen and reboot.

Everything works fine until now, but then you choose to encrypt your phone with a password. Now if you wish to restore another backup with a different password, several problems may arise. At times, you will need both the new password (during boot) and the old password (screen unlock), to use your device. This can be easily fixed, simply head over to Settings, Security and reset your password.

Don’t miss: How to Change Android Device Model Name on Marshmallow and Nougat

Steps to Fix PIN Errors After Restoring Nandroid Backup in TWRP

Another more complicated scenario may arise when none of the passwords can unlock the lock screen. There are two ways to fix this problem:

Using TWRP File Manager

  1. Reboot into recovery mode. If asked for a password, enter the recent one.
  2. Select Advanced, then tap File Manager.
  3. Navigate to /data/system directory.
  4. Now delete the files with .key extension as well as those containing the word ‘locksettings’. In total, it should be five files.
  5. Now reboot your device again. If prompted to install SuperSU, choose do not install.

When the phone finishes rebooting, you will find the lock-screen unprotected. Now you can head over to Settings-> security to create a new password.

Flash a zip file

Instead of shuffling through tons of files and folders, you can simply flash a package to do the same things, only faster. This package was created by Primokorn, a recognized XDA contributor, specifically for One Plus 3T, but it should also work in other stock ROMs.

The package deletes the following files:

  • password.key
  • pattern.key
  • locksettings.db
  • locksettings.db_shm
  • locksettings.db_wal


If your phone uses these files for security, the package will work. Simply download the zip file from this link and transfer it to your SD Card. Open TWRP, select install, and flash the given file. Reboot and voilà! Your phone is unlocked, finally. Take a deep breath, and be more consistent with your passwords!

Related article: How to get past the Android lock screen security measures

This site uses Akismet to reduce spam. Learn how your comment data is processed.