[FIX] Wrong Pin/Pattern when restoring TWRP Nandroid Backup

  1. EpicLPer
    Honeycomb Jun 24, 2016

    EpicLPer , Jun 24, 2016 :
    When you create and restore a TWRP backup (as example because you tried out a custom ROM and saw that it's not good) you'll be greeted with:

    a) A "enter PIN before boot" screen
    b) A wrong lockscreen code (either PIN or Pattern) when booted to Android

    1. Simply boot into TWRP and enter your PIN (if you've set one) to decrypt the stroage. If you don't have TWRP (for whatever reason) you can do so via ADB too but ONLY if you've connected your phone to your PC beforehand and also accepted it's fingerprint on the phone itself.
    2. Delete (or rename) the following files inside /data/system (note that probably not all of them exist for you, simply delete those you can find):
      • password.key
      • pattern.key
      • locksettings.db-wal
      • locksettings.db-shm
      • locksettings.db
    3. Reboot the phone and (if you've set a PIN) enter it to decrypt the storage one more time. After that you can simply unlock your phone with a swipe.
    4. Go into Settings > Security and set your preferred unlock method again, Android will ask you if you want to set a boot-time code too. Select whatever you want here, it's a nice security addition but can be annoying sometimes.
    5. Enjoy your phone again!
    I hope this helps some people here since I was searching on how to fix this for almost an hour after restoring a backup. This is probably due to another ROM overwriting existing lockdata when you set a code there, then again you'd wipe the /data partition anyways so I have no clue why it's still acting up like this...
    Last edited: Jun 24, 2016

  2. lindahl85
    Eclair Jul 11, 2016

    lindahl85 , Jul 11, 2016 :
    What about those two? Should they be removed?

  3. eddiekhor
    Cupcake Jul 11, 2016

  4. gueuhb
    Ice Cream Sandwich Jul 27, 2016

  5. hunter29m
    Cupcake Jul 30, 2016

  6. Nitheesh Reddy M
    Honeycomb Sep 13, 2016

    Nitheesh Reddy M , Sep 13, 2016 :
    Hey, i just sideloaded the OOS 3.5.1 but i had set the 6 digit pin 809080, but now its only 4. please tell me how to unlock via ADB because im not on TWRP. Files inside the phone are very important. I didnot get what you said about connecting phone to pc 'beforehand' and regestering FP.

    ath.peppas likes this.
  7. ath.peppas
    Gingerbread Sep 15, 2016

    ath.peppas , Sep 15, 2016 :
    I have got the same issue. Have you found a solution?

  8. Nitheesh Reddy M
    Honeycomb Sep 16, 2016

    Nitheesh Reddy M , Sep 16, 2016 :
    Yes. I've. Download the recommended build ie 3.2.2 or 3.2.4. Sideload it using the ADB then you'll be asked to enter 6 digits pin, then back up whatever you want. Now Notification panel will not work even recent and home key will not work. Now Wipe data and cache or Factory reset which will fix these issues.

  9. ath.peppas
    Gingerbread Sep 16, 2016

    ath.peppas , Sep 16, 2016 :
    I flashed 3.5.2 and my 8pin worked again.

  10. Nitheesh Reddy M
    Honeycomb Sep 16, 2016

  11. derlegion
    Froyo Sep 18, 2016

  12. Tavinek
    Cupcake Sep 24, 2016

    Tavinek , Sep 24, 2016 :
    Reflash old radio

  13. mibjt
    Eclair Sep 30, 2016

    mibjt , Sep 30, 2016 :
    Bro/Sis. You have literally saved me from wiping my phone! Thank You so much :)

  14. Vaggramma
    Cupcake Oct 2, 2016

  15. F_Cristian_Gutiérrez_Ma
    Cupcake Oct 4, 2016

    F_Cristian_Gutiérrez_Ma , Oct 4, 2016 :
    For some reason restoring Nandroid, disables the fingerprint sensor and the home button functions. If you go to your settings, you'll realize that there's no way to set up a fingerprint. What worked for me, was, apart from the method above, downloading the same version of the rom that's installed on your device from the support section of oneplus and flashing with TWRP. No need to factory reset and loose all your configuration. Hope that this work for you too.

  16. manuhalliwell
    Cupcake Oct 7, 2016

    manuhalliwell , Oct 7, 2016 :
    Already dirty flashed the version I have on the phone but no luck setting back again FP as unlocking method, even if I'm able to add new fingerprints, when I go to the unlock method choosing, FP is not on the list. Any help?

  17. JetzNicht
    Eclair Nov 10, 2016

    JetzNicht , Nov 10, 2016 :
    Thanks for this instruction, you made my day and probably saved my phone from flying out of the Window.
    Had the same problem and tried deleting both .key files but not the other ones.
    I needed to delete these files too:
    Last edited: Nov 14, 2016

  18. gazza1888
    Gingerbread Nov 10, 2016

    gazza1888 , Nov 10, 2016 :
    download the twrp 3020 and use the command in fastboot, place the twrp inside the adb and fastboot files, then enter fastboot devices, when it shows connected, fastboot flash recover filename.zip.

  19. M3ntoR
    Gingerbread Dec 14, 2016

    M3ntoR , Dec 14, 2016 :
    Is after flashing Open_Beta 8 moded storage encrypted ?
    Can I flash Beta 9 over it ?

  20. nerdynick
    Eclair Dec 28, 2016

    nerdynick , Dec 28, 2016 :
    I flashed a RR ROM from xda and didn't like it (no theme support, atm), decided to restore my OOS backup and had this PIN problem. Then read this post and everything is working now!

    Thank you!!!

    BTW, can anyone suggest good ROMS that I could try out on my 1+3T ????