Monday, December 10, 2018

cyanogenmod - Clear or reset my lock screen password/PIN


I have a similar problem as the one described in this question, but that question doesn't solve my problem. Summarized here:


I recently installed CyanogenMod 10 on my Galaxy Nexus. I enabled encryption. The first time I rebooted the phone, I was able to get past the lock screen with no trouble. I tried to change the screen lock PIN, but the settings app wouldn't accept my PIN.


Later, the screen locked due to the timeout being reached, and I wasn't able to unlock it. My password kept being rejected, and the "Forgot password" button that I read should come up never appeared. I rebooted my phone, and though I can easily decrypt it, I can't unlock it.


This answer suggested going through adb to fiddle with an SQLite database. However, I can't seem to access /data on my phone. I get the following error when I try to do an ls:


opendir failed, Permission denied

I tried to use su, but again, I got a Permission denied error. The phone is most definitely rooted, as I regularly use several root-only apps.



I really don't want to have to wipe the phone. Is there any other way to unlock this phone?



After posting this question, I came across this answer. I was able to get my phone unlocked by exploiting the phone hole mentioned (involving calling the phone and mashing the keys repeatedly--though instead of hitting the non-existent home key I swiped up Google Now). I deleted the password using the SQL mentioned in the answer I cited earlier. However, upon rebooting the phone, I'm back in an non-unlockable state.


In other words, I can exploit a hole to unlock my phone, but I can't reset the PIN, and I have to make sure to turn my screen on before 30 minutes elapses and avoid rebooting, or I'm toast.



Answer



I got it fixed. Here are the steps I took:



  1. Use the exploit here entitled "Phone: Use a hole to disable your lock". For me, it didn't work exactly as documented, though. I had to mash the password keys for a long time (calling my phone was unnecessary), then swipe up Google Now, mash the password a few more times, and hit Enter. With that, Google Now pops up and the phone is unlocked. I didn't test to find out how much of this is necessary and how much isn't.

  2. Fire up a terminal app on the phone. I can't get root access from adb. Type su to become root. It should go without saying that this method will not work unless the phone has been rooted.



  3. Enter the following commands to clear the password (source). Each line represents a command to type, one at a time.


    sqlite3 /data/data/com.android.providers.settings/databases/settings.db
    delete from secure where name='lockscreen.password_type';
    delete from secure where name='lockscreen.password_salt';
    .exit

    Tip: These commands will be easier to type if you use Hacker's Keyboard and type with the phone in landscape orientation.



  4. Reboot the phone.

  5. The screen will still be locked and non-unlockable. So, repeat step 1 to unlock it.


  6. Go to the security screen and hit Screen lock. You will be asked to confirm your PIN. The new password is null. That means that instead of entering a password, just hit Next with a blank password.

  7. Now, you're in, so go ahead and change your PIN to whatever you want.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...