I have forgotten the PIN of a device but I do have access to a root shell with adb shell and su

Is there some way I could remove the screen PIN lock or change it?


3 Answers 3


if your device is not encrypted with login credentials you can delete locksettings.db

adb shell su -c "rm /data/system/locksettings.db*"

However, bear in mind the following files are required for FBE encryption. If you delete these files you won't be able to decrypt userdata partition, all data is lost


@alexcs solution can work without root / su (sorry I can't comment on his answer) :

adb reboot recovery

(wait for reboot)

adb shell rm /data/system/locksettings.db

and reboot into normal mode with :

adb reboot
  • Alas this isn't working on my phone either, In recovery mode, adb won't connect anymore. Reboot and it wiill. But in recover mode "error: no devices/emulators found". Recover mode offered a menu, and delete cache seemed safest but didn't help. Commented Mar 28, 2023 at 20:58

The big axe

A brute force solution existed as I had access to fastboot too.

To remove the PIN, removed the entire userdata partition with fastboot

fastboot erase userdata

as described here: https://android.stackexchange.com/a/175887/320098

  • 2
    To wipe the entire partition is pretty brute force to be - it removes everything
    – Simson
    Commented Apr 27, 2020 at 10:45
  • That is less brute force and more knock the building down....
    – Tank R.
    Commented Jun 16 at 5:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .