adb shell


Last Updated:

  1. mp3spy

    mp3spy Member This Topic's Starter

    Joined:
    Nov 7, 2009
    Messages:
    8
    Likes Received:
    0
    I've downloaded the Android SDK pkg on my linux box. Does the droid need to be rooted before or is there a developer mode in order to pull up a droid shell via the ADB using the SDK? I've connected the droid to my box but when I run ./adb shell it gives me an error: insufficient permissions for device, ran this as root..suggestions?:confused:
     

    Advertisement
  2. Telexen

    Telexen Well-Known Member

    Joined:
    Nov 1, 2009
    Messages:
    234
    Likes Received:
    13
    I haven't gotten into that with mine yet...there's some options in the Settings -> Development ... have you messed with those?

    There's no way they'd require a rooted phone for development...it's an Open Development OS.
     
  3. mp3spy

    mp3spy Member This Topic's Starter

    Joined:
    Nov 7, 2009
    Messages:
    8
    Likes Received:
    0
    yea, didn't see too many pertinent options in that development area. I heard you can atleast get a user prompt $
     
  4. WarlockLord

    WarlockLord Member

    Joined:
    Nov 6, 2009
    Messages:
    8
    Likes Received:
    0
    I've got mine working in Win7 X64. I used the drivers that came with the developer kit and modified the inf so that the PID and VID for the Droid were in it. I just type adb shell from a command prompt with debugging turned on and it connects no problem.
     
  5. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    I've spent a long time searching around to get through the various errors that I get while using adb, but I've gottem myself stuck in a loop:

    My Motorola Droid is rooted and running Froyo 2.2.1.
    I can successfully:
    adb shell
    su
    mount -o remount,rw.... etc
    exit
    exit

    But when I type:
    adb root
    abdb cannot run as root in production builds

    And I get permission denied when I try to push/pull files from my computer to the /system

    So I'm quite stuck, and wondering if anyone could help me with their expertise! Thx.
     
  6. NiceGuysFinishLast

    NiceGuysFinishLast Well-Known Member

    Joined:
    Dec 11, 2010
    Messages:
    472
    Likes Received:
    73
    Do you have USB debugging enabled?
     
  7. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    Yes.
     
  8. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    Are you in Linux also, or Mac or Windows?
     
  9. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    Windows 7, 32 bit, but I forget whether it's Pro, Enterprise, etc...
     
  10. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    Where are the instructions that you're using to do this?

    Whenver I have moved anything to /System I just ran

    Code (Text):
    1. adb shell
    2. su
    3. mount ...
    4. push {app} /system
    5. chmod app
    6. exit
    7. exit
    I never recall ever having to run
    Code (Text):
    1. adb root
     
  11. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    Once in the shell, is the source file assumed to be on the sdcard or can it be on the computer?

    I've tried 'push' but not with 'mount' first, and the command is not recognised. Are the '...' referring to the phone?

    Thanks for your help btw!

    EDIT: Ahhhhhh! disregard comment about 'mount' I *have* done 'mount -o remount,rw ...'
    EDIT: Other useful information: Windows 7 Ultimate, G.O.T 2.2.1 (2.6.32.9 kernel)
     
  12. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    Correct, source is assumed to be on the computer. With ADB Shell, you're pushing files from the computer (where adb is running) to the phone. If you were to pull, then you'd be copying files from the phone to the computer.

    I added the path to the adb.exe file to my system PATH variable so that I could be in any directory and run adb commands - makes pushing and pulling a lot easier. I open a command prompt, go to the directory where the file I want to push is located / where I want to pull the file to, and then I don't have to worry about local paths - just the path on the phone.

    if you haven't added the path to adb.exe to at least your user PATH variable, then you'll have ot use full paths if you run adb by going into the android SDK folders to run it. IOW, is adb is located at D:\Downloads\android-sdk_r08-windows\android-sdk-windows\platform-tools and you go to that folder and then run
    Code (Text):
    1. adb shell
    and the filename.apk is located at, say, C:\My Documents then you'll need to use the full path to the file in order to push it to the phone:

    Code (Text):
    1. push C:/My Documents/filename.apk /System/{location}
    See Android Debug Bridge | Android Developers for more info

    Also, you'll need to make sure to run this just after su:

    Code (Text):
    1. mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
    aka the "mount ..." statement :p

    Finally, I think you need to chmod the file to 644, but that may not always be the case. I haven't done it in a while and cannot find the step by step guide I used I thought it was here in the forums, but....*shrug*
     
  13. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    I have added the location of adb to the system Path.. saves a lot of typing!

    From within the shell, adb does not recognise push or pull "push: not found"

    Also when I check "cat /proc/mtd" from within the adb shell, it says that mtd4 refers to recovery, but shouldn't it be system?

    In any case, from within the shell, the files I reference on my computer keep turning up as "No such file or directory"

    Stuck!! :confused:
     
  14. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    Ooohhh, wait a minute. Are you running Gingerbread on your phone?

    If not, have you upgraded to the latest SDK? It moved the location of adb.exe to a new folder - and now I remember that I was getting the same problem.

    Yup - you get this, right?

    Android SDK no push.PNG
     
  15. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    You can use the Linux command
    Code (Text):
    1.  cp
    in its place, I believe - you'll still need to mount system as r/w which means running su as soon as you're in the shell.

    Code (Text):
    1. cp {local filename} {destination}
     
  16. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    No I'm not running Gingerbread, I'm running 2.2 (YET! I will get there I hope) and I'm running SDK version 8. Should I update to version 9? adb.exe is in the "tools" directory. Is there a file that I should move to that directory?

    When I use the cp command, i.e.:
    Code (Text):
    1. cp "C:\Program Files\....\android-sdk-windows\tools\filename.apk" /system/app
    I get this:
    Code (Text):
    1. cp: can't stat 'C:\Program Files\...\android-sdk-windows\tools\filename.apk':
    2. No such file or directory
     
  17. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    It's Linux - you cannot use Windows-specific \ for directories - you have to use /.

    You might also need to use single quotation marks around the path as opposed to the double quotation marks - I cannot remember for a fact. According to the error, though, it looks like it parsed the double quotes into single quotes, so it may work with the double.
     
  18. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    Also, if you're already in that directory you do not need to put the path at all - by default, adb will issue commands using that local directory.

    You only need the path if you're not in the same directory as the file.
     
  19. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    I was just in the C:\Users\ directory, so that's why I typed the whole path...

    I tried with "/" instead of "\" and tried both single and double quotation marks (same error as above - No such file or directory), as well as no quotation marks (the space between Program and Files screws it up). I also tried going to the location of the file I'm trying to move so that I didn't have to deal with slashes OR quotation marks, but it still says "No such file or directory."
     
  20. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    OK, next question - is the file you're trying to push named filename.apk? If it is named Q!W@E#R$T%Y^.apk the nyou use
    Code (Text):
    1. cp "C:\Program Files\....\android-sdk-windows\tools\Q!W@E#R$T%Y^.apk" /system/app
    If you enter filename.apk to push and filename.apk does not exist, that is what you're going to get.
     
  21. gigeoxy

    gigeoxy Member

    Joined:
    Dec 1, 2010
    Messages:
    13
    Likes Received:
    0
    The actual filename is WidgetLocker.apk (I know it's case sensitive) and I have been writing that filename in my code. I was just writing "filename.apk" in this forum for simplicity's sake.

    EDIT: OK I solved the problem of not being allowed to push/pull files quite by accident! So happy now I can finally make my own icons to replace the ugly ones or the ones that don't fit the UI. Here's what I had to do once I was in the adb shell:

    Code (Text):
    1. su
    2. mount -o rw,remount -t yaffs2 /dev/block/mtdblock6 /system
    3. chmod 777 /system
    4. exit
    5. exit
    6.  
    Only then was I allowed to push/pull files. It's mtdblock6 because my droid is actually a Milestone, not a Droid 1.

    Anyways thanks for all your help!
     

Share This Page

Loading...