Posts Tagged With: Android tablet

Run adb shell and how to get # instead of $ for root permission : Android


Here is the solution when running adb shell and get $ instead of #, which is not the su command. I found this solution in a comment of my previous post. Lot of people have this problem and keep asking me this question. So I thought to post “ryo” ‘s (unknown author) solution here as it will help for many others.

Problem

April 8, 2013 by ryo :

My Samsung Ace 2 is rooted, but when I type ‘adb shell’, I get a $ instead of #, which I’ve found out is not the su command. So I’ve tried various ways to get the ‘#’ instead of ‘$’, like typing ‘adb shell’ and then ‘su’, which returns the cursor to the next line, is blank for 10 seconds, and then ‘$’ appears again (after 10 seconds). I’ve also tried typing ‘adb shell su’, and it waits for a few seconds, and then just returns to the android\sdk\platform-tools folder.

Running Gingerbread 2.3.6 – what am I doing wrong?! Just need to get a # instead of $……………..

Solution 

April 8, 2013 by ryo :

OK! So, after 2 hours of trying to unsuccessfully trying to get ‘sqlite3 settings.db’ to work through adb shell, I found an alternate method (I am using a rooted Samsung Ace 2 running Android 2.3 Gingerbread on Windows 7, with debugging mode on):

1. Download SDK Installer for windows and install BOTH tools (SDK tools + Platform-tools) – you don’t need any of the other stuff in there.
2. Launch cmd.exe, and navigate to the platform-tools folder (mine was C:/android/sdk/platform-tools
3. Use command: adb pull /data/data/com.android.providers.setting­s/databases/settings.db \some_folder_on_your_computer (all one line)

**NOTE**If permission is denied, then type ‘adb shell’, and ‘su’ to get superuser; it should show #, not $. Then type ‘chmod 666 /data/data/com.android.provide­rs.settings/databases /settings.db’ (don’t type the ” apostrophe). Then type exit, and exit, again until you’re back to …../platform-tools

4. use “adb pull /data/data…settings.db” command again. It should work this time, and the settings.db file should be in the folder you told it to push to
5. Get Firefox, and get add-on called “SQLite Manager”. Restart Firefox. Go up to top left Firefox tab and under ‘web developer’ menu, you should see ‘SQLite Manager’. Open it.
6. Open the settings.db with SQL Manager (you might have to change it from only showing .sqlite files, to show All Files *.*
7. After settings.db is open, go to Tables–>Secure, and look for lockscreen.lockedoutpermanently. If you’re phone was TOTALLY Locked out (e.g., after 20 pattern attempts…=damn kids), then it should show a value of “1″ (this means “on”). Select it, click the edit button up top, and change the value to “0″ (=”OFF”). Commit changes and close SQLite Manager.
8. go back to cmd.exe window (you should still be in the …./platform-tools folder), use the command:
adb push \some_folder_on_your_computer\settings.db /data/data/com.android.providers.setting­s/databases/
9. If this transfers successfully, you SHOULD be good to go.
10. Unplug phone, turn off, turn on = YOUR GOOD OLD SIM PIN SCREEN! :D

Big Credit due to AppsCatalog and the clues in his description in his youtube video (http://www.youtube.com/watch?v=pHs-Afd2lp0)

Thank You Very much “ryo” for your solution 🙂

Categories: Android | Tags: , , , , , , , , | 12 Comments

Unlock an Android Device without Internet Access – Using ADB commands


Problem

My Android tablet is  locked because too many wrong pattern attempts.  When entering a wrong pattern 20 times (you may be not stupid to enter it wrong 20 times, but your child or someone else who wants to lock your device what happen ? ) your devices is locked and asking to unlock it via your google username and password. You are lucky if the device locked with Wifi on or mobile data network on. Then you can simply log into the google account and unlock it. But I’m not that much lucky and my tablet was in “Airplane mode on” with “Wifi off”.

Android device lock with too many pattern attempts

Android device is locked with too many pattern attempts

Android should have a method to turn on wifi or mobile networks when device is locked. But no, there is no such a method :-/

Solution

I did lot of google searches and most of them end up with hard resetting the device. If you hard reset all the data are gone. I tried it too, but because of some problem(it may be the device model), my resetting was stuck in middle of the process. Finally I found a solution to access the device from a PC via a USB cable (ADB Commands). For this method you have to have enabled USB Debugging on the device before it is locked. Luckily I had enabled it before it is locked.  (As I saw, for rooted users USB Debugging is not required — but you might need to manually mount the/data partition. Actually I didn’t try it and don’t know how to do it as my USB debugging is enabled.)

Ok here is the solution for devices which have enabled USB debugging ,

Open the command prompt (cmd) in Windows

Change directory to the android SDK platform tools (cd C:\Program Files\Android\android-sdk\platform-tools)

Type following commands in cmd

  • adb devices (verify device is identified by pc. If not reconnect device and try again. it should display “device” with a serial no)
  • adb shell
  • cd /data/data/com.android.providers.settings/databases
  • sqlite3 settings.db
  • update system set value=0 where name='lock_pattern_autolock';
  • update secure set value=0 where name='lock_pattern_autolock'; (for some devices update “system” is enough but I had to update “secure” too)
  • update system set value=0 where name='lockscreen.lockedoutpermanently';
  • update secure set value=0 where name='lockscreen.lockedoutpermanently';
  • .quit
  • exit
  • adb reboot

Now your device should be unlocked. If not do this step too,

  • adb shell rm /data/system/gesture.key (I didn’t have to do it. But it had mentioned here)

Here what I have done is clear lock patterns and remove the permanent lock from the database. Yes here I have break the security, but saved my device as can be used again. If you are concern about the security of your device “Always keep off USB debugging mode“. But I don’t know what will happen to your important data when someone locked your device.

So did you solve your problem and save your device ? Then don’t forget to like my fb page. ONLY IF YOU HAD A SOLUTION FROM THIS 😉

If you know about a better solution, add it as a comment here. It will help others too.

Update 18-05-2013

Important Comments

ryo : https://chethaka.wordpress.com/2013/02/28/unlock-an-android-device/#comment-87

Ashutosh : https://chethaka.wordpress.com/2013/02/28/unlock-an-android-device/#comment-110

checky : https://chethaka.wordpress.com/2013/02/28/unlock-an-android-device/#comment-114

Categories: Android | Tags: , , , , , , , , , , , | 281 Comments

Create a free website or blog at WordPress.com.