2

I have an android phone and an android tablet. Both not rooted. I want to use adb as host on the tablet and as client on the phone, using an USB-OTG adapter.

I downloaded connectbot as terminal emulator on the tablet. I also downloaded the ARM binary for adb onto the tablet. However I'm getting the following error when I try to execute the binary:

user@tablet:/storage/sdcard0/download $ ./adb-arm-binary.bin devices
/system/bin/sh: ./adb-arm-binary.bin: can't execute: Permission denied

Is there anyway to get ADB as a host to run on an android 4.4.2 tablet without root?

OR: Is there any way to root said tablet without a PC?

The whole reason I need this is because I need to access dumpsys logs from the phone but I do not have a PC or laptop. A way to get dumpsys logs directly on the phone without root would suffice too, but AFAIK dumpsys is impossible to access for non-system application.

confetti
  • 602
  • 4
  • 11
  • 24
  • if somebody wants to root their phone, they'd use adb and run various commands, so no you don't need root to use adb. I can't comment much on the rest. But, you can download a terminal app and run linux commands like ls, see how far you can see without 'root', you may need to 'root' your phone, to see what you want to see, I don't know. You won't need a PC or adb to download a terminal app and ls and look around and see limitations e.g. try cd / see if it works – barlop Aug 07 '18 at 00:24
  • It's trickier than that. I need root to run adb as a host on android. I can't use a terminal app on the phone because they don't have the permission to use dumpsys, only system apps do. I need root to make an app a system app. – confetti Aug 07 '18 at 00:28
  • 1
    Just tried on my own device; dumpsys works as long as the app has root, no system application required. The permission problem is, the entire sdcard is mounted so that nothing on it is executable, so you can't run any binary from it. – Andy Yan Aug 07 '18 at 00:47
  • Thanks for that info, I only got my information from google and XDA-devs. Sadly, I don't have root on that phone. It's a motorola E4 by the way. AFAIK no way to root it without a computer. – confetti Aug 07 '18 at 01:02
  • Which tablet is this? – Firelord Aug 07 '18 at 06:46
  • See if this method works for rooting. I would be surprised if it does but give it a try please. https://forum.xda-developers.com/showpost.php?p=71218028&postcount=2 – Firelord Aug 07 '18 at 08:10
  • I actually got root using kingroot. Right now I'm trying to figure out another problem. I placed the binary for adb in /system/bin and chmod 755'd it. /system was mounted as rw. That did work and ls -l /system/bin/adb shows that it's there with correct permissions (everything done on tablet ofc) but when I try to run it adb or /system/bin/adb it says File not found. (Trying to run it as root). which adb also reports File not found. I'm not sure whether to make a new question or edit this one or what is even causing this or I dont know...... – confetti Aug 07 '18 at 08:13
  • 1
    Ask a new question please and self-answer this one on how you rooted your Android device. – Firelord Aug 07 '18 at 08:18
  • @Firelord I will post some comments from OP here on the wrong thing that rostami posted 'cos it had some info . "It is possible to create adb connections from android to android via USB-OTG, but it seems to require root on the host side. Is there a way to root a motorola E4 or an astar y3 without a computer? " I can't retrieve other comments – barlop Aug 11 '18 at 10:56
  • @Firelord yeah a new q, but with a note on this one that there is an issue he faced that might be connected to rooting it that way. – barlop Aug 11 '18 at 10:57
  • I won't be able to test it until tomorrow, but once I did I will either self-answer if it worked or open a new question with a link back to this one if it doesn't, and self-answer this one with rooting instructions that worked for me. – confetti Aug 11 '18 at 11:01
  • It's possible to do this without root, there are multiple solutions, such as using an app(https://play.google.com/store/apps/details?id=eu.sisik.hackendebug) or using it through WebUSB https://webadb.com through Chrome(you need to have relatively recent versions though) – LCZ Jan 12 '22 at 12:19

2 Answers2

2

Alright, I got it to work, here is what I did:

1. Rooted the tablet

I was able to use kingroot to root the tablet.

2. Install adb on the tablet

I basically followed these instructions, however the files in the OP there are outdated and not downloadable anymore. So I used a file someone posted much later in that thread, this file seems outdated though, but I'm unsure about that and will open a new question about that.

  1. Downloaded the adb.bin file on the tablet (in /storage/sdcard0/Download)
  2. Downloaded Connectbot from f-droid and setup a local shell connection to the tablet
  3. Ran the following commands (everything after (including) the # is just a comment)
su # gain root priviledges
cd /storage/sdcard0/Download # change working directory to download folder
mount -o remount,rw /system # re-mount /system partition so we can write on it
cp adb.bin /system/bin/adb # copy it to bin folder so it's accessible as a command
chmod 755 /system/bin/adb # make it executable
  1. Rebooted tablet

3. Enjoy adb as host on android!

This worked for me and got me an executable adb running. I still can't connect to my phone but since this is another issue I opened a new question.

confetti
  • 602
  • 4
  • 11
  • 24
0

Previously root may be the only option to use an Android device as an ADB host. However, there are applications that allow us to do this without root now.

You can achieve this through ADB through WebUSB. Chrome (including Chrome Android) supports WebUSB, which is a protocol for websites to access USB devices.

Note: I'm not the creator of this platform.

Make sure you're using Chrome, if not this wouldn't work.

  • Go to https://webadb.com
  • Click "Start"
  • Click "Add device" in the side menu add device link
  • Connect to your device connect device
  • Press the "Connect" button next to the "Add device" button.
  • Allow the ADB prompt on your client device
  • Press interactive shell at the left sidebar. shell

Enjoy your ADB access!

Edit: I found an ad-free version here: https://yume-chan.github.io/ya-webadb/

LCZ
  • 196
  • 2
  • 12