Sophie LaBüf

  • Home
  • Recommended Apps
  • XDA
  • Facebook
  • About

Make ADB localhost Work on Your Jelly Bean 4.2.2 Device

Posted by Eric Gingell on July 14, 2013
Posted in: Android.

Make ADB localhost Work on Your Jelly Bean 4.2.2 DeviceIn Jelly Bean 4.2.2, ADB now uses RSA keys to explicitly allow certain clients. This poses a problem when attempting to use ADB on your phone locally and the ADB daemon won’t write its RSA key to disk due to the file system being read-only. This is the easiest way to make it work.

Disclaimer: I am not responsible for you doing this wrong and breaking your phone.

This will not work on Android 4.1.2 or older.

  1. Make /data/.android.
  2. Do one of the following:
    1. If you’re using a custom ROM with init.d, put the following into an init.d script.
      #!/system/bin/sh
      if [ ! -e "/.android" ]; then
          busybox mount -o rw,remount /
          mkdir /.android
          mount -o bind /data/.android /.android
          busybox mount -o ro,remount /
      fi
    2. If you have hacked in init.d support by hooking the debuggerd binary, add the script above to your debuggerd script *or* an init.d script.
  3. Reboot the device (if you used option 2 in the previous step, restart the debugger (“stop debuggerd; start debuggerd“)).
  4. After the phone boots completely, check /.android for contents. If it’s empty, restart usb debugging (either from Developer Options (toggle USB Debugging off and back on) or via the command line (“stop adbd; start adbd“)). There should now be stuff in /.android.
  5. Append the contents of /.android/adbkey.pub to /data/misc/adb/adb_keys (“cat /.android/adbkey.pub >> /data/misc/adb/adb_keys; echo “” >> /data/misc/adb/adb_keys“).
  6. Start the ADB server on the phone from the command line using ADB on your PC or a terminal emulator.

    root@android:/ # adb start-server
  7. The phone should pop the authentication dialog – click OK. If the authentication dialog doesn’t pop, follow the striked out steps above.

Edit [08/02/2014]: Turns out two of the above steps aren’t required. Steps amended above.

Notes:

  • Don’t delete /data/.android or the contents therein.
  • Tested on my SGS4 with hacked-in init.d support.
  • You can also find the abdkey.pub file on your Windows’ PC here, C:\Users\[user name]\.android\abdkey.pub. Copy it to your device, then append it to /data/misc/adb/adb_keys and you won’t need to initially use the USB to allow the PC connection.

Before:

root@android:/ # adb shell ls
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device offline
255|root@android:/ #

 

After:

root@android:/ # adb shell ls
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
MSM8960_lpm.rc
acct
cache
carrier
charger
config
d
data
data_1
data_2
data_3
default.prop
dev
efs
etc
extSdCard
file_contexts
firmware
firmware-mdm
fstab.qcom
init
init.carrier.rc
init.goldfish.rc
init.qcom.class_core.sh
init.qcom.class_main.sh
init.qcom.early_boot.sh
init.qcom.lpm_boot.sh
init.qcom.rc
init.qcom.ril.sh
init.qcom.sh
init.qcom.syspart_fixup.sh
init.qcom.usb.rc
init.qcom.usb.sh
init.rc
init.target.rc
init.trace.rc
init.usb.rc
mnt
mnt_1
persdata
preload
proc
property_contexts
res
root
sbin
sdcard
seapp_contexts
sepolicy
storage
sys
system
tombstones
ueventd.goldfish.rc
ueventd.qcom.rc
ueventd.rc
vendor
root@android:/ #

Posts navigation

← Little Known Jelly Bean Features
Recommended Apps →
  • Latest

    • World of Final Fantasy June 5, 2022
    • Final Fantasy VI May 11, 2022
    • Android 8 Notifications July 2, 2019
    • Scopophobia February 13, 2018
    • How to spot clickbait and sharebait August 20, 2017
    • Supernatural quotes read by Google Text-To-Speech August 20, 2017
    • I found a thing in my phone August 17, 2017
    • Moto G5 Plus August 17, 2017
    • Netflix on a Nubia June 29, 2017
    • Nubia Z11 Mini June 17, 2017
  • Archives

    • June 2022 (1)
    • May 2022 (1)
    • July 2019 (1)
    • February 2018 (1)
    • August 2017 (4)
    • June 2017 (2)
    • January 2017 (1)
    • September 2016 (1)
    • August 2016 (2)
    • July 2016 (1)
    • June 2016 (1)
    • May 2016 (1)
    • February 2016 (2)
    • October 2015 (1)
    • August 2015 (1)
    • July 2015 (1)
    • May 2015 (4)
    • July 2014 (2)
    • June 2014 (1)
    • May 2014 (2)
    • January 2014 (2)
    • November 2013 (1)
    • October 2013 (1)
    • September 2013 (1)
    • August 2013 (2)
    • July 2013 (5)
    • June 2013 (3)
    • May 2013 (1)
  • Categories

    • Android (29)
    • Gaming (7)
    • Social Networking (1)
    • Sophie (9)
    • Weird Things Nerds Do (3)
  • Tools

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
Proudly powered by WordPress Theme: Parament by Automattic.