Sophie LaBüf

  • Home
  • Recommended Apps
  • XDA
  • Facebook
  • About Me
  • Privacy Policy

Make ADB localhost Work on Your Jelly Bean 4.2.2 Device

Posted by egingell on Jul 14, 2013
Posted in: Android.

Last Updated on Dec 26, 2022


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 →
  • Join Discover: get $50
  • Latest

    • FFXV Jan 29, 2025
    • Final Fantasy X-2 Sep 11, 2024
    • Final Fantasy XII Jul 9, 2024
    • TLoU Game vs TV Series Mar 7, 2024
    • EA Customer Support Jan 22, 2024
    • FFX-2 Matchmaking & Publicity Dec 2, 2023
    • Classic Word Streak Nov 3, 2023
    • Final Fantasy X-2 - Via Infinito Oct 20, 2023
    • Getting Screenshots from Switch to Smart Device Oct 20, 2023
    • Spams & Scams Oct 6, 2023
  • Info

    • About Me Jun 24, 2024
    • About Jeckle Apr 30, 2023
    • About Heckle Apr 30, 2023
    • Privacy Policy Dec 25, 2022
  • Categories

    • Android (38)
    • Gaming (15)
    • Nintendo (2)
    • Social Networking (1)
    • Sophie (9)
    • Television (1)
    • Uncategorized (1)
    • Weird Things Nerds Do (3)
  • Tools

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