23

I own a Samsung Galaxy S3 and the display is broken and USB debugging is set to off too.

How can I enable it using ./adb commands? I have done these steps already:

  • data/data/com.android.providers.settings/databases/settings.db changed adb_enabled value from 0 to 1.
  • Also edited build.prop in /system.

After doing all this, the phone seems bricked, it's not turning on. All I want to do is enable USB debugging and connect it to Vysor(beta) so I could control it on my computer.

4
  • 1
    Welcome! Good question. +1. Why do you want to remote-control the phone though? Commented Aug 26, 2015 at 23:35
  • Thanks...Because the screen is broken and I want to browse the data in it. Though I figured it out last night... :) Commented Aug 27, 2015 at 9:04
  • The proper way of enabling USB debugging would be to unpack the boot.img, edit init.rc (enable adb, then disable RSA verificaton), repack boot.img, and boot boot.img without flashing. Once edit has been confirmed working, then flash boot.img to the device.
    – HasH_BrowN
    Commented Mar 5, 2016 at 15:07
  • Hello, i just want share a Magisk Module to bypass adb, check this github.com/lexavey/Adb-Root-Enabler
    – Anas
    Commented Jul 28, 2023 at 20:15

2 Answers 2

18

I got it to work :)

NOTE: This requires unlocked bootloader.

  • Connect the device to Mac or PC in recovery mode. (I had to map the process in my mind as the screen was broken).
  • Now open terminal/CMD in computer and go to platform-tools/. type and enter ./adb devices to check if the device is connected in recovery mode.
  • Now type ./adb shell mount data and ./adb shell mount system to mount the respective directories.
  • Get the persist.sys.usb.config file in your system using ./adb pull /data/property/persist.sys.usb.config /Your directory
  • Now open that file in a texteditor and edit it to mtp,adb and save.
  • Now push the file back in the device; ./adb push /your-directory/persist.sys.usb.config /data/property
  • Get the build.prop file; ./adb pull /system/build.prop /your-directory
  • Add these lines:

    persist.service.adb.enable=1                                                    
    persist.service.debuggable=1
    persist.sys.usb.config=mtp,adb
  • Push build.prop back into the device; ./adb push /your-dir/build.prop /system/

This way you enabled USB debugging on your device. But you still can't connect. Why? Because it asks for RSA verification. If you could view your display then you could easily tap on YES to authorize the device. I am currently figuring out to bypass this. I want to revive my dead phone badly. If you know any way to do this, please share :)

11
  • Are you running a custom Recovery?
    – Firelord
    Commented Aug 27, 2015 at 11:20
  • No. Stock recovery it is. Commented Aug 27, 2015 at 11:26
  • 1
    About the RSA confirmation part by user, if you're booted into Android OS, and are confirmed somehow that the screen is displaying a dialog for confirmation then you may very well use adb shell input keyevent to choose YES. See Keyevent here. It's a shot in the dark but may very well be worth firing.
    – Firelord
    Commented Aug 27, 2015 at 11:31
  • 1
    Ahh! Sorry for suggesting something that would not work. What was I thinking? If ADB access is not authorized then no way adb shell input would work. Sorry again! I'll see if there is any way to bypass the authorization somehow.
    – Firelord
    Commented Aug 27, 2015 at 11:42
  • 1
    @sherrellbc, this is one of the exceptional cases where a person has a stock recovery running full-fledged ADB daemon providing shell access. A recovery can have an ADB daemon and can get detected by an ADB client regardless of the state of USB debugging in Android OS. In short, USB debugging matters as long as you're booted into Android OS. Outside it, the setting has no significance.
    – Firelord
    Commented Oct 22, 2015 at 17:10
5

For the RSA verification that you asked to bypass, I don't know whether it would work in your device, but it worked in my little experiment. In Lollipop, the ADB keys (after authorization) are saved in /data/misc/adb/adb_keys. Your private key is saved in computer. In Linux the directory location is $HOME/.android/. On Windows that usually translates to %USERPROFILE%\.android, but keys might end up in C:\Windows\System32\config\systemprofile\.android in some cases. (Source)

There is a method described here by ashoke which might help out in bypassing the authorization.

However, in my Lollipop, the method varies. I noticed that in my primary and secondary Lollipop ROM the adb_keys had the same key actually. All I did was revoke the authorization from the secondary ROM (file deleted automatically ), disconnected device from PC, copied adb_keys from Primary ROM into secondary ROM, connected the device into PC, and voila! I wasn't asked for that authorization. I double checked the authorization using adb devices and it was all good.

Try the linked answer first. Authorize a different Android phone, copy its keys into your device from Recovery mode and see if it works.

5
  • Hey thanks. I transferred adb_keys from note 2 to S3 and it worked :) Commented Aug 27, 2015 at 18:13
  • This is the needed info to make the accepted answer correct. Good job. +1
    – HasH_BrowN
    Commented Mar 5, 2016 at 15:02
  • 2
    For those running a Unix based OS, adb push ~/.android/adbkey.pub /data/misc/adb/adb_keys works reliably.
    – Chris Olin
    Commented Dec 16, 2016 at 19:32
  • @ChrisOlin: thank you for your input. But I do suppose that adb should be running in root mode (adb root), otherwise, the user won't be able to directly put a file under /data/misc/. Correct?
    – Firelord
    Commented Dec 16, 2016 at 21:42
  • Not exactly, but you raise a good question. If you're trying to enable USB debugging through ADB, you'll need to be booted into recovery to accomplish this. Recovery shells (least with TWRP) default to root. If they don't, then yes, the user won't be able to push directly to /data/misc.
    – Chris Olin
    Commented Dec 17, 2016 at 17:56

You must log in to answer this question.

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