Jump to content

Welcome to CyanogenMod

Welcome to our forum. Like most online communities you must register to post, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of the CyanogenMod Forum by signing in or creating an account. You can even sign in with your Facebook or Twitter account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • Get your own profile and make new friends
  • Download files attached to the forum.
  • Customize your experience here
  • Share your CyanogenMod experience!
Guest Message by DevFuse
 

[Tutorial-Ubuntu] Android SDK/ADB/Fastboot - UPDATED


  • Please log in to reply
16 replies to this topic

#1 wilskywalker

wilskywalker
  • Members
  • 32 posts
  • Twitter:wilskywalker
  • Country:
    uk - United Kingdom
  • Device Model:
    Galaxy Nexus, Nexus One
  • CM Version:
    Latest Nightly
  • Recovery Image:
    ClockworkMod

Posted 29 May 2010 - 04:11 PM

Hi all,

I thought I would re-post this tutorial as I had a real nightmare setting this up originally, so I hope this helps at least someone out!

Ubuntu: Android SDK, ADB, Fastboot.

There are various great tutorials online to help you set these options for Windows, but the process of setting this up in Ubuntu Linux is rather fragmented across various different forums, and can be rather confusing! This is a tutorial I have put together after having real trouble setting it up myself, after trawling through numerous forums, and getting help from many very helpful folks on various forums!

Tutorial: This will show you how to complete the basic set up of the Android sdk, and then how to enable the 'adb' and 'fastboot' connections so as to allow you to issue commands from the terminal directly to your phone.

You will need to download the following files before you start:

android_sdk_r05-linux_86.tgz

Fastboot

Setting up the Android SDK

1. Extract the 'android_sdk_r05-linux_86.tgz' file to your 'Home' folder and rename it to 'sdk' to make things easier later on.

2. Move the fastboot file in to the 'Tools' folder inside the 'sdk' folder.

3. Now right click on both the 'fastboot' and 'adb' files (inside the tools folder) and choose 'Properties' and then the 'Permissions' tab, and ensure they both have the 'allow executing file as program' box is ticked...Now reboot the computer, sorted!

Now to set up ubuntu to recognize your phone, and the commands in the terminal:

1. Open your 'Home' folder. Press 'Ctrl' & 'H' at the same time to view hidden files, and then open the '.bashrc' file and add the following text to the top of the file:

#AndroidDev PATH 
export PATH=$PATH:/home/username/sdk/tools


Obviously you will need to replace 'username' with your own  

Save the file and exit.

2. Now log-in as root. Or use the following terminal command to open the 'root - File Browser':

gksudo nautilus

3. Navigate to the following directory in the root filesystem: /etc/udev/rules.d/

4. Create the following empty file: '70-android.rules' (ubuntu 9.10) '51-android.rules' (ubuntu 7.10/8.04)

5. You then need to edit the file with the following text (depending on your version of ubuntu):

ubuntu 7.10/8.04/9.10:

SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4”, MODE=”0666”


ubuntu 6.06:

SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”0bb4”, MODE=”0666”


6. Save this file, and then open the terminal and enter the following command:

chmod a+rx /etc/udev/rules.d/70-android.rules


Change the 70 to 51 depending on your version of ubuntu.

For a list of the vendor ID's go here: VendorID's

7. Now reboot the computer.

8. Open Terminal, and issue the following commands:


su 
cd /home/username/sdk/tools/ 
./adb kill-server 
./adb start-server

(I have found that you will sometimes have to re-do the above code if things aren't working at any point, for some reason it just seems to lose the connection after you have turned the PC off)

You will now be able to open a terminal and carry out 'adb' and 'fastboot' commands directly.

Credit and thanks to:

Cloverdale, wddglr, JgeZau, koalaboy, Apostasy,

UPDATE:

Ok, so I bought myself a Nexus One, and ran into some problems with adb and fastboot, I kept getting the following error:

List of devices attached
???????????	 no permissions

It seems that the Nexus One has a different vendor ID to the other HTC devices, and this is not listed on the Android developement site I linked to above.

Nexus One vendor ID: 18d1

Please follow these instructions to sort this problem ("cd" terminal commands are assuming you have read and set up using the above tutorial):

1. Open a terminal and issue the following command:

gksudo nautilus

This will open the 'root - File Browser'.

2. Navigate to the following file in the root filesystem: /etc/udev/rules.d/70-android.rules (Ubuntu 9.10) /etc/udev/rules.d/70-android.rules (Ubuntu 7.10/8.04).

3. Open the text file (This is an executable file, so choose the 'Display' option) and add the following line to the bottom:

SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"

This file should now look like this:

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"

Save the changes, and close.

4. Optionally at this point you may wish to restart your computer.

5. Open a terminal and issue the following commands:

su
cd /home/username/sdk/tools/
sudo restart udev
./adb kill-server
./adb start-server
./adb devices

And in fastboot mode you obviously need the following command:

./fastboot devices

Your Nexus One should now be detected! As always if anyone sees anything obviously wrong with this update please let me know, I can confirm I have used this method on both my desktop and laptop running Ubuntu 9.10, and it works fine!!

Hope this helps people out a bit!

Edited by wilskywalker, 22 August 2010 - 07:01 PM.


#2 bruslim

bruslim
  • Members
  • 119 posts
  • Twitter:bruslim
  • Country:
    us - United States
  • Device Model:
    HTC Magic 32B
  • CM Version:
    6.1.0 + pershoot
  • Recovery Image:
    ClockworkMod

Posted 29 May 2010 - 06:58 PM

Make a wiki page =D

#3 trenchtractor

trenchtractor
  • Members
  • 4 posts
  • Device Model:
    |1|
  • CM Version:
    4.2.15.1
  • Recovery Image:
    Cyanogen

Posted 29 May 2010 - 11:20 PM

I had major problems getting fastboot to work, yet adb worked fine in Karmic.

fastboot devices
returned nothing

adb devices
returned my device

Fortunately I have a really good Sun VirtualBox running XP that returned my device with both fastboot and adb, so I used virtual windows to fastboot v1.7.0 recovery.

Unfortunately, trying to push the recovery image to the SD card hung, but the USB indicator on the virtual machine was flashing, so I left it overnight.  This morning it was still hung, so I disconnected and used Ubuntu to adb push and it worked fine.

I don't know why I had drama's, but this is how I got around it.

#4 bruslim

bruslim
  • Members
  • 119 posts
  • Twitter:bruslim
  • Country:
    us - United States
  • Device Model:
    HTC Magic 32B
  • CM Version:
    6.1.0 + pershoot
  • Recovery Image:
    ClockworkMod

Posted 29 May 2010 - 11:25 PM

View Posttrenchtractor, on 29 May 2010 - 11:20 PM, said:

I had major problems getting fastboot to work, yet adb worked fine in Karmic.

fastboot devices
returned nothing

adb devices
returned my device

Fortunately I have a really good Sun VirtualBox running XP that returned my device with both fastboot and adb, so I used virtual windows to fastboot v1.7.0 recovery.

Unfortunately, trying to push the recovery image to the SD card hung, but the USB indicator on the virtual machine was flashing, so I left it overnight.  This morning it was still hung, so I disconnected and used Ubuntu to adb push and it worked fine.

I don't know why I had drama's, but this is how I got around it.
Karmic? 9.0x?

Upgrade to lucid. UDEV already has the rules set.

As for fastboot, check the md5 hash, could be corrupt.

Also check the permissions of the fastboot binary.

#5 PsychoI3oy

PsychoI3oy

    Bugmonkey

  • Administrators
  • 523 posts
  • Country:
    us - United States
  • Device Model:
    D2lte(tmo)
  • CM Version:
    11M*
  • Recovery Image:
    Cyanogen

Posted 30 May 2010 - 02:40 PM

View Postbruslim, on 29 May 2010 - 06:58 PM, said:

Make a wiki page =D
I could have sworn we had one already. Possibly 2 if you count the actual sdk page.

#6 wilskywalker

wilskywalker
  • Members
  • 32 posts
  • Twitter:wilskywalker
  • Country:
    uk - United Kingdom
  • Device Model:
    Galaxy Nexus, Nexus One
  • CM Version:
    Latest Nightly
  • Recovery Image:
    ClockworkMod

Posted 31 May 2010 - 02:41 PM

View PostPsychoI3oy, on 30 May 2010 - 02:40 PM, said:

I could have sworn we had one already. Possibly 2 if you count the actual sdk page.

Hey buddy,

We do, I wrote the "[Tutorial-Ubuntu] Android SDK/ADB/Fastboot" section, it's here:

[Tutorial-Ubuntu] Android SDK/ADB/Fastboot

:)

#7 wilskywalker

wilskywalker
  • Members
  • 32 posts
  • Twitter:wilskywalker
  • Country:
    uk - United Kingdom
  • Device Model:
    Galaxy Nexus, Nexus One
  • CM Version:
    Latest Nightly
  • Recovery Image:
    ClockworkMod

Posted 31 May 2010 - 02:45 PM

View Posttrenchtractor, on 29 May 2010 - 11:20 PM, said:

I had major problems getting fastboot to work, yet adb worked fine in Karmic.

fastboot devices
returned nothing

adb devices
returned my device

Fortunately I have a really good Sun VirtualBox running XP that returned my device with both fastboot and adb, so I used virtual windows to fastboot v1.7.0 recovery.

Unfortunately, trying to push the recovery image to the SD card hung, but the USB indicator on the virtual machine was flashing, so I left it overnight.  This morning it was still hung, so I disconnected and used Ubuntu to adb push and it worked fine.

I don't know why I had drama's, but this is how I got around it.

In the past when I have had problems getting fastboot to work, I use the following commands from the terminal:

su 
cd /home/username/sdk/tools/ 
./adb kill-server 
./adb start-server

This usually resolves the problem  :)

#8 bruslim

bruslim
  • Members
  • 119 posts
  • Twitter:bruslim
  • Country:
    us - United States
  • Device Model:
    HTC Magic 32B
  • CM Version:
    6.1.0 + pershoot
  • Recovery Image:
    ClockworkMod

Posted 31 May 2010 - 06:58 PM

View PostPsychoI3oy, on 30 May 2010 - 02:40 PM, said:

I could have sworn we had one already. Possibly 2 if you count the actual sdk page.


View Postwilskywalker, on 31 May 2010 - 02:41 PM, said:

Hey buddy,

We do, I wrote the "[Tutorial-Ubuntu] Android SDK/ADB/Fastboot" section, it's here:

[Tutorial-Ubuntu] Android SDK/ADB/Fastboot

:)

so why did you copy and paste it here? wouldn't a link just be as sufficient?

unless the wiki's db suddenly dies on us too...

#9 wilskywalker

wilskywalker
  • Members
  • 32 posts
  • Twitter:wilskywalker
  • Country:
    uk - United Kingdom
  • Device Model:
    Galaxy Nexus, Nexus One
  • CM Version:
    Latest Nightly
  • Recovery Image:
    ClockworkMod

Posted 05 June 2010 - 07:21 PM

View Postbruslim, on 31 May 2010 - 06:58 PM, said:

so why did you copy and paste it here? wouldn't a link just be as sufficient?

unless the wiki's db suddenly dies on us too...

Just for ease of access for folks having the same problems as I did, plus it's easier to 'quote' specific areas of the tutorial and ask for help if people are having problems following the tutorial!
:)

#10 jbhirst

jbhirst
  • Members
  • 3 posts
  • Device Model:
    |1|
  • CM Version:
    No current Mod
  • Recovery Image:
    Stock

Posted 08 June 2010 - 09:50 PM

I am using Ubuntu 10.4, android-sdk-linux_86, and I am unable to see my Nexus One device with either adb or fastboot.

I have created

70-android.rules in the /etc/udev/rules.d/ directory as indicated... (Also tried 99-android.rules which was indicated on [Tutorial-Ubuntu] Android SDK/ADB/Fastboot ... )

I have also tried various contents of the files as it was indicated in one place to use for 9.10

SUBSYSTEM==”usb”, ATTRS{idVendor}==”0bb4”, MODE=”0666”
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1”, MODE=”0666”
SUBSYSTEM==”usb”, ATTRS{idVendor}==”22b8”, MODE=”0666”

Yet in another location it indicates to use

SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”0bb4”, MODE=”0666”
SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”18d1”, MODE=”0666”
SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”22b8”, MODE=”0666”

So I have tried both...

My /etc/udev/rules.d/ folder contains other files... '70-persistent-cd.rules' and '70-persistent-net.rules' so if I were to guess, the filename should probably follow suit.?. which would mean '70-android.rules' should be correct, but does not yield a working solution...

Any more hints?

#11 majki

majki
  • Members
  • 16 posts
  • Country:
    de - Germany
  • Device Model:
    desire, magic 32b
  • CM Version:
    6.1.0RC2
  • Recovery Image:
    ClockworkMod

Posted 08 June 2010 - 10:20 PM

View Postjbhirst, on 08 June 2010 - 09:50 PM, said:

I am using Ubuntu 10.4, android-sdk-linux_86, and I am unable to see my Nexus One device with either adb or fastboot.

I have created

70-android.rules in the /etc/udev/rules.d/ directory as indicated... (Also tried 99-android.rules which was indicated on [Tutorial-Ubuntu] Android SDK/ADB/Fastboot ... )

I have also tried various contents of the files as it was indicated in one place to use for 9.10

SUBSYSTEM==”usb”, ATTRS{idVendor}==”0bb4”, MODE=”0666”
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1”, MODE=”0666”
SUBSYSTEM==”usb”, ATTRS{idVendor}==”22b8”, MODE=”0666”

Yet in another location it indicates to use

SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”0bb4”, MODE=”0666”
SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”18d1”, MODE=”0666”
SUBSYSTEM==”usb_device”, SYSFS{idvendor}==”22b8”, MODE=”0666”

So I have tried both...

My /etc/udev/rules.d/ folder contains other files... '70-persistent-cd.rules' and '70-persistent-net.rules' so if I were to guess, the filename should probably follow suit.?. which would mean '70-android.rules' should be correct, but does not yield a working solution...

Any more hints?

With 10.4 I had a problem to automount any device on usb. Also adb and fastboot didn't work. After starting PC in BIOS and disabling and reanabling all USB settings ewerything runs fine. It was posted in a german ubuntu forum

Fastboot only works on my pc if I run as sudo (sudo ./fastboot ...)

#12 bruslim

bruslim
  • Members
  • 119 posts
  • Twitter:bruslim
  • Country:
    us - United States
  • Device Model:
    HTC Magic 32B
  • CM Version:
    6.1.0 + pershoot
  • Recovery Image:
    ClockworkMod

Posted 08 June 2010 - 11:24 PM

View Postmajki, on 08 June 2010 - 10:20 PM, said:

Fastboot only works on my pc if I run as sudo (sudo ./fastboot ...)

create a new udev rule

http://wiki.cyanogen...est_Android_sdk

then:

sudo restart udev

#13 Tien Nguyen

Tien Nguyen
  • Donators
  • 310 posts
  • Twitter:tienhn
  • Country:
    us - United States
  • Device Model:
    |1|
  • CM Version:
    CM7 Nightly
  • Recovery Image:
    ClockworkMod

Posted 21 June 2010 - 05:06 PM

View Posttrenchtractor, on 29 May 2010 - 11:20 PM, said:

I had major problems getting fastboot to work, yet adb worked fine in Karmic.

fastboot devices
returned nothing

adb devices
returned my device

Fortunately I have a really good Sun VirtualBox running XP that returned my device with both fastboot and adb, so I used virtual windows to fastboot v1.7.0 recovery.

Unfortunately, trying to push the recovery image to the SD card hung, but the USB indicator on the virtual machine was flashing, so I left it overnight.  This morning it was still hung, so I disconnected and used Ubuntu to adb push and it worked fine.

I don't know why I had drama's, but this is how I got around it.

Your device must in in FASTBOOT mode for fastboot command to work. adb only requires your device to be in USB Debug mode. So it can see your device after it fully booted.

#14 wilskywalker

wilskywalker
  • Members
  • 32 posts
  • Twitter:wilskywalker
  • Country:
    uk - United Kingdom
  • Device Model:
    Galaxy Nexus, Nexus One
  • CM Version:
    Latest Nightly
  • Recovery Image:
    ClockworkMod

Posted 22 August 2010 - 05:01 PM

Top post updated to include a fix for Nexus One users!!  :)

Also: Note to Moderators, it may be worth moving this thread to another area of the forums as it is not really just for HTC Magic, I originally posted this before all the other forums popped up! Many thanks!

Edited by wilskywalker, 22 August 2010 - 05:11 PM.


#15 xhuman825

xhuman825
  • Members
  • 9 posts
  • Country:
    us - United States
  • Device Model:
    |2|
  • CM Version:
    none
  • Recovery Image:
    Cyanogen

Posted 25 October 2010 - 11:12 PM

thanks man this totally helped me

#16 nanostreak

nanostreak
  • Members
  • 1 posts
  • Device Model:
    Dell Streak
  • CM Version:
    Stephen Hyde
  • Recovery Image:
    ClockworkMod

Posted 26 November 2010 - 03:58 PM

Ubuntu 10.10 64bit: 5 hours of tinkering and still no dice to get fastboot to work. Amazing. ADB is just fine.

I have tried all sorts of variations, e.g. this one http://forum.xda-dev...ad.php?t=537508
but also the very own cyanogen wiki guide (http://wiki.cyanogen...the_Android_SDK):

I've replaced the vendor ID with the Dell Streak 413c:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c01", MODE="0666", OWNER="[user_name]" #Normal
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c02", MODE="0666", OWNER="[user_name]" #Recovery
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0fff", MODE="0666", OWNER="[user_name]" #Fastboot

I also created various rules in /etc/udev/rules.d (which apparently is only for older Ubuntu distros but some got it to work that way with 10.04) as well as /lib/udev/rules.d
I've given those rules names from 51-android.rules to 70-android.rules to 11-android.rules in my despair.
Creating new rules with udev or restarting adb just doesn't seem change the fact that fastboot doesn't see my phone at all.

Back to darn WinXP in virtualbox. And I thought I had finally gotten rid of Windows.

#17 pconwell

pconwell

    It's okay, I'm from the Internet.

  • Donators
  • 360 posts
  • Twitter:pconwell
  • Country:
    us - United States
  • Location:
    TN, USA
  • Device Model:
    Galaxy Nexus
  • CM Version:
    Nightlies
  • Recovery Image:
    ClockworkMod

Posted 10 December 2010 - 05:13 PM

I know this is an older post, but I'm having the same problem. Just started last night after installing some ubuntu updates...

ADB will only run under sudo. I've been running ADB for a while, so I know what I'm doing (mostly). But now, after the updates, ADB will only run under sudo.

The only thing I can figure is the udev rules for ubuntu have changed. Any thoughts?


Very odd, but here is what I had to change my udev to for my nexus one:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e11", MODE="0666", OWNER="patrick" #Norma
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e12", MODE="0666", OWNER="patrick" #Debug & Recovery
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0fff", MODE="0666", OWNER="patrick" #Fastboot

Very odd, considering it was working fine yesterday, then just magically stopped using HTC's vendor ID this morning. Anway... it's working now with (I assume) Google's vendor ID.