Featured image of post How To Enable ADB From Recovery

How To Enable ADB From Recovery

useful for debugging bootloops

Enable ADB From Recovery

Files changed:

  • /system_root/system/build.prop
  • /data/property/persist.sys.usb.config
  • /data/misc/adb/adb_keys

Enable ADB (1/2): enable USB debugging

same as “Settings » Developer Opcions » USB debugging” ON

Manual method

  • Connect the device to Mac or PC in recovery mode.
  • 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 partitions. You can also use the recovery to mount those partitions.
  • Get the persist.sys.usb.config file in your system using adb pull /data/property/persist.sys.usb.config /Your-directory/persist.sys.usb.config. If the persist.sys.usb.config does not exist, simply create an exmpty text file instead.
  • 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_root/system/build.prop /your-directory/build.prop
  • Add these lines:
  • Push build.prop back into the device; adb push /your-directory/build.prop /system_root/system/build.prop

Fast way

adb shell
mount data
echo -n 'mtp,adb' > /data/property/persist.sys.usb.config

Verify options are not present before do it: adb shell "grep 'persist.service.adb.enable' /system_root/system/build.prop"

adb shell
mount system
echo '' >> /system_root/system/build.prop
echo '# Enable ADB' >> /system_root/system/build.prop
echo 'persist.service.adb.enable=1' >> /system_root/system/build.prop 
echo 'persist.service.debuggable=1' >> /system_root/system/build.prop
echo 'persist.sys.usb.config=mtp,adb' >> /system_root/system/build.prop 

Enable ADB (2/2): RSA verification

The ADB keys (after authorization) are saved in /data/misc/adb/adb_keys. Your private key is saved on your 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.

adb push ~/.android/ /data/misc/adb/adb_keys

Credits to TheOnlyAnil on StackExchange.

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy