Enable ADB under Ubuntu/Linux

Search This thread

Sblood86

Inactive Recognized Developer
Apr 18, 2011
415
407
Middle of nowhere, Texas
Alright so it turns out making ADB work for the Kindle Fire under Ubuntu is just a touch more difficult than in Windows.

Thanks to Gbhil (@ AndroidCentral) for the write up on windows it was a great jumping off point to try to figure this out.
Also thanks to the guys on chat.andirc.net (Skourg3 in particular for helping me figure this out the first time).

Let's get down to the nitty gritty yeah?

First you will still need the entry provided by Gbhil, go ahead and set it using the echo command in a terminal.
Code:
echo 0x1949 >> ~/.android/adb_usb.ini

You can confirm that it took by using the cat command
Code:
cat ~/.android/adb_usb.ini

You should get a return of '0x1949' (plus any other rules that you may have added in the past).

Now really that should work but everytime you run adb you will have to either run it as root or using the sudo command. To allow standard user access we have to setup a udev rule.
Code:
sudo gedit /etc/udev/rules.d/51-android.rules

That should open up gedit for you to edit the file 51-android.rules. If this is the first time you have added any udev rules the file will be empty as gedit will have just created it for you. go ahead and add in the following.
Code:
# adb/fastboot protocols for blaze / otter (Amazon Kindle Fire)
SUBSYSTEM=="usb", ATTR{idVendor}=="1949", ATTRS{idProduct}=="0006", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTRS{idProduct}=="0100", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"

Save that than add in the user group androiddev.
Code:
sudo addgroup --system androiddev

And add your username to that group.
Code:
sudo adduser <username> androiddev

Replace <username> with your primary username without the <> around it.

After that you will need to logout and log back in for these values to apply. You will probably need to restart the adb server as well.

Change directory to your platform-tools directory and run the following.
Code:
./adb kill-server
./adb start-server

Assuming all went well that should work properly and you can than connect through adb, if for some reason this doesn't work try restarting your computer (though I do not believe this is necessary).

If you don't want to type the "./" before all of your adb and fastboot commands, you need to add their parent directory into your PATH environment variable. For example, (assuming you are using the bash shell) if you have adb and fastboot in your /home/<username>/bin directory, you want to define...

Code:
PATH=~/bin:${PATH}
or
Code:
PATH=${PATH}:~/bin

It just depends on whether you want your own binaries to be used before the system equivalents or after. Most people would probably use the first one to have your own binaries be the preferred ones, but either one should work for adb and fastboot since there are no system binaries by the same names.

If you don't want to have to do this for every shell you open, you can place the definition at the end of your ~/.bashrc file. If you need it for you your login shell, you also need to put it into your ~/.bash_profile file. If you don't want to maintain two parallel files with much of the same information, take a look at this post.
 
Last edited:

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
First you will still need the entry provided by Gbhil, go ahead and set it using the echo command in a terminal.
Code:
echo ~/.android/adb_usb.ini 0x1949

Thanks for the guide on setting this up for linux. I just wanted to point out a small error in the instructions. The echo command above is incorrect and will not do what you intended. It should be corrected to

Code:
echo 0x1949 >> ~/.android/adb_usb.ini

That will create or append to the file as necessary.
 

freefaling

Senior Member
Dec 9, 2010
97
20
Lahore
no adb_usb.ini file

Thanks for the guide on setting this up for linux. I just wanted to point out a small error in the instructions. The echo command above is incorrect and will not do what you intended. It should be corrected to

Code:
echo 0x1949 >> ~/.android/adb_usb.ini

That will create or append to the file as necessary.

Somehow the guide I followed for setting up adb/fastboot on Ubuntu did not create the udb_usb.ini file.

I had to go into android-sdk-linux folder on my home directory and copy the one provided with KFU. Only then I could use the echo command.
 

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
Somehow the guide I followed for setting up adb/fastboot on Ubuntu did not create the udb_usb.ini file.

I had to go into android-sdk-linux folder on my home directory and copy the one provided with KFU. Only then I could use the echo command.

This...

Code:
echo 0x1949 >> ~/.android/adb_usb.ini

will definitely create the file if it doesn't exist, but only if the ~/.android/ directory exists (with the correct permissions). It won't make those directories if they don't exist. I'm guessing the .android directory wasn't there when you ran the command.
 
Last edited:

freefaling

Senior Member
Dec 9, 2010
97
20
Lahore
This...

Code:
echo 0x1949 >> ~/.android/adb_usb.ini

will definitely create the file if it doesn't exist, but only if the ~/.android/ directory exists (with the correct permissions). It won't make those directories if they don't exist. I'm guessing the .android directory wasn't there when you ran the command.

I read a lot of guides and did what they all said and ended up with a working adb command but my kindle was still not detected. At the end it was this thing that solved the issue.

I dont think I had that "android" folder (i did not unhide the home folder to check but since i setup the android sdk inside "android-sdk-linux" folder, i doubt "android" folder was there).

It's because of these tiny details I was sugesting that you, sir, create a how-to for setting up adb on ubuntu (only if you feel comfortable doing it, that is).

Thanks.

Sent from my Amazon Kindle Fire using XDA
 

Lotek

Senior Member
Dec 25, 2008
70
29
Boston
My OS is Mint 12, so same as Ubuntu (except for Unity and a bit of non open-source software) and setting up ADB was also a little bit more difficult than I anticipated. I don't know how other distros are.

The guide that got me most of the way there was this one http://xdaforums.com/showpost.php?p=19446284&postcount=62, and then I hit the same problems as the OP. I had to do a bit of mostly useless searching and reading before I found the entry provided by Gbhil and .adb/ devices made the legend "0123456789ABCDEF device" pop up.

I updated every platform in the sdk while I was at it, oops, must get that 4 or 5 gigs of space in my Home folder back sometime.

A kindle fire specific guide for Ubuntu would be awesome, I hereby second freefaling's nomination of you, Sblood86, as author of said guide, if you're into it, because you seem pretty good at it.
 

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
Someone asked me about my Ubuntu setup last night and I thought that I should contribute back to this thread with the same information.

You can add another udev rule to cover fastboot commands on FFF so they don't have to be run as root...

Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTRS{idProduct}=="0100", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"

If you don't want to type the "./" before all of your adb and fastboot commands, you need to add their parent directory into your PATH environment variable. For example, (assuming you are using the bash shell) if you have adb and fastboot in your /home/<username>/bin directory, you want to define...

Code:
PATH=~/bin:${PATH}

or

Code:
PATH=${PATH}:~/bin

It just depends on whether you want your own binaries to be used before the system equivalents or after. Most people would probably use the first one to have your own binaries be the preferred ones, but either one should work for adb and fastboot since there are no system binaries by the same names.

If you don't want to have to do this for every shell you open, you can place the definition at the end of your ~/.bashrc file. If you need it for you your login shell, you also need to put it into your ~/.bash_profile file. If you don't want to maintain two parallel files with much of the same information, take a look at this link.

http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

I follow the recommendation at the end.

Hope that helps someone.
 
  • Like
Reactions: Sblood86

Sblood86

Inactive Recognized Developer
Apr 18, 2011
415
407
Middle of nowhere, Texas
Someone asked me about my Ubuntu setup last night and I thought that I should contribute back to this thread with the same information.

You can add another udev rule to cover fastboot commands on FFF so they don't have to be run as root...

Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTRS{idProduct}=="0100", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"

If you don't want to type the "./" before all of your adb and fastboot commands, you need to add their parent directory into your PATH environment variable. For example, (assuming you are using the bash shell) if you have adb and fastboot in your /home/<username>/bin directory, you want to define...

Code:
PATH=~/bin:${PATH}

or

Code:
PATH=${PATH}:~/bin

It just depends on whether you want your own binaries to be used before the system equivalents or after. Most people would probably use the first one to have your own binaries be the preferred ones, but either one should work for adb and fastboot since there are no system binaries by the same names.

If you don't want to have to do this for every shell you open, you can place the definition at the end of your ~/.bashrc file. If you need it for you your login shell, you also need to put it into your ~/.bash_profile file. If you don't want to maintain two parallel files with much of the same information, take a look at this link.

http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

I follow the recommendation at the end.

Hope that helps someone.

I spent something like 3 weeks trying to find the rule that worked with fastboot lol... thanks!

Your link is dead btw.
 
Last edited:

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
I spent something like 3 weeks trying to find the rule that worked with fastboot lol... thanks!

Your link is dead btw.

Well it worked a couple of days ago when I made my post. It's not my fault it took you so long to read it. ;)

All it really said was to add...

Code:
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

to the .bash_profile file so that it will source the .bashrc file regardless of the way you got to the shell. Then you only have to maintain the .bashrc file and only put login shell specific info into .bash_profile

I picked up another tidbit yesterday while engrossed in the whole CWMR bricking thread. Ubuntu has a plugdev group that's used for (mounting?) hot-pluggable firewire/USB devices... sounds a lot like the KF. The first user created on the system is automatically put into that group. Since most Ubuntu desktop are going to be single user machines anyway, that's going to be THE user for the majority of these cases. So, creating a androiddev group just for the KF is probably not necessary most of the time. You can just skip the addgroup and adduser to group commands if you just want to adjust your rules to use the plugdev group instead.
 
  • Like
Reactions: Sblood86

hortstu

Senior Member
Sep 7, 2010
69
3
First I'm going to apologize for not being good with this stuff. Now I'm going to ask questions that will probably frustrate some readers. If you aren't irritated by them please help me out.

First you will still need the entry provided by Gbhil, go ahead and set it using the echo command in a terminal.
Code:
echo 0x1949 >> ~/.android/adb_usb.ini

What is the entry provided by gbhil? Where do I get it? I thought I had adb in here but apparently I don't because when I run the echo command I'm getting "no such file or directory."

Can anyone dumb this down for me just a bit. Add the steps I'm obviously going to need as a newb?

Thanks
 

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
First I'm going to apologize for not being good with this stuff. Now I'm going to ask questions that will probably frustrate some readers. If you aren't irritated by them please help me out.



What is the entry provided by gbhil? Where do I get it? I thought I had adb in here but apparently I don't because when I run the echo command I'm getting "no such file or directory."

Can anyone dumb this down for me just a bit. Add the steps I'm obviously going to need as a newb?

Thanks

The most likely cause of that error is you don't have a .android directory in your home directory. You'll need to run the following command before that echo command...

Code:
mkdir ~/.android

That will create a ".android" directory in your home directory (~ is shorthand for your home directory). Then you can create that adb_usb.ini file with the "0x1949" line in it.
 
  • Like
Reactions: hortstu

hortstu

Senior Member
Sep 7, 2010
69
3
Thanks for the help. Stuck again.

After that you will need to logout and log back in for these values to apply. You will probably need to restart the adb server as well.

Change directory to your platform-tools directory and run the following.
Code:

./adb kill-server
./adb start-server

logged out and in. what is the name of the "platform-tools" directory?

OK found them and realize they're 2 directories. How to I write to 2 directories at once? I'm going to try one at a time. Looking forward to the elaboration on this.

---------- Post added at 06:16 AM ---------- Previous post was at 06:03 AM ----------

ok followed all the steps except this one.

Code:
PATH=~/bin:${PATH}

Code:
PATH=${PATH}:~/bin

Seems like that's for people that not only know what they're doing in the terminal but spend a lot of time there.

Is there a way to confirm that I've enabled adb before I proceed?

Will I need to follow the latter half of these step everytime I want to enable adb or just the start server command?

Again sorry for newb questions and many thanks for the help.

Tried to push pokey's 9000 fb and it didnt work. I don't think I have adb enabled or something.
 
Last edited:

tedr108

Senior Member
Dec 3, 2011
416
138
Los Angeles area, CA
What is the entry provided by gbhil? Where do I get it? I thought I had adb in here but apparently I don't because when I run the echo command I'm getting "no such file or directory."

Can anyone dumb this down for me just a bit. Add the steps I'm obviously going to need as a newb?

Thanks

I'm guessing Gbhil is a user who originally posted this information, but not sure...

If you go into a Terminal program, like UXTerm or whatever, you simply type that echo command as shown. It will append the 0x1949 to that .ini file in the hidden folder (.android), so adb can see your device. Of course, this is assuming you have a .android folder. It should be in your Home directory.

When I was playing around with custom ROMs and recovery, my KF stopped registering at 0x1949 at one point. Just in case that is happening to you, plug in your KF to your Linux PC. Go into a terminal program and type lsusb. You will get a list of devices and your KF will be there somewhere. If it is not 0x1949, you will see the correct number. If you get a different number (0x whatever), run the echo command for that number, too. No problem having more than one id num in your adb_usb.ini file.
 
  • Like
Reactions: hortstu

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
Thanks for the help. Stuck again.

Don't take this the wrong way, but you might want to take a step back from this and learn a little bit about getting around in Linux before you tackle this project with the Kindle Fire. If this is your primary OS, at least knowing how to navigate around the directory structures, how the PATH variable affects how you run commands, and many other things will be invaluable in your day to day use of the operating system. Linux has come a long way to being user-friendly, but it's still reliant on the users knowing their way around the command line interface... much more than the other two big OS's.

There are countless primers and introductions on the basics of getting around the unix/linux command line. I suggest you search for some and familiarize yourself with them.

In the meantime... the "platform-tools" directory the OP refers to in his post is part of Google's Android SDK distribution...

http://developer.android.com/sdk/index.html
 
  • Like
Reactions: hortstu

freefaling

Senior Member
Dec 9, 2010
97
20
Lahore
Don't take this the wrong way, but you might want to take a step back from this and learn a little bit about getting around in Linux before you tackle this project with the Kindle Fire. If this is your primary OS, at least knowing how to navigate around the directory structures, how the PATH variable affects how you run commands, and many other things will be invaluable in your day to day use of the operating system. Linux has come a long way to being user-friendly, but it's still reliant on the users knowing their way around the command line interface... much more than the other two big OS's.

There are countless primers and introductions on the basics of getting around the unix/linux command line. I suggest you search for some and familiarize yourself with them.

In the meantime... the "platform-tools" directory the OP refers to in his post is part of Google's Android SDK distribution...

http://developer.android.com/sdk/index.html

This would be a good start:
vic.gedris.org/Manual-ShellIntro/1.2/ShellIntro.pdf

Sent from my Amazon Kindle Fire using XDA
 
  • Like
Reactions: hortstu

hortstu

Senior Member
Sep 7, 2010
69
3
OK thanks for the help. Realize I should probably know more about this stuff.

Really want to root for the sake of swype and google store. Tough to commit hours to this stuff since I have a family and a job that is non tech.

I have rooted my evo but that was a while back. Seems a little more complicated on the kindle. Thanks again. Not taken the wrong way.
 

majexy033

Member
Jun 25, 2012
6
0
Alright so it turns out making ADB work for the Kindle Fire under Ubuntu is just a touch more difficult than in Windows.

Thanks to Gbhil (@ AndroidCentral) for the write up on windows it was a great jumping off point to try to figure this out.
Also thanks to the guys on chat.andirc.net (Skourg3 in particular for helping me figure this out the first time).

Let's get down to the nitty gritty yeah?

First you will still need the entry provided by Gbhil, go ahead and set it using the echo command in a terminal.
Code:
echo 0x1949 >> ~/.android/adb_usb.ini

You can confirm that it took by using the cat command
Code:
cat ~/.android/adb_usb.ini

You should get a return of '0x1949' (plus any other rules that you may have added in the past).

Now really that should work but everytime you run adb you will have to either run it as root or using the sudo command. To allow standard user access we have to setup a udev rule.
Code:
sudo gedit /etc/udev/rules.d/51-android.rules

That should open up gedit for you to edit the file 51-android.rules. If this is the first time you have added any udev rules the file will be empty as gedit will have just created it for you. go ahead and add in the following.
Code:
# adb/fastboot protocols for blaze / otter (Amazon Kindle Fire)
SUBSYSTEM=="usb", ATTR{idVendor}=="1949", ATTRS{idProduct}=="0006", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTRS{idProduct}=="0100", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"

Save that than add in the user group androiddev.
Code:
sudo addgroup --system androiddev

And add your username to that group.
Code:
sudo adduser <username> androiddev

Replace <username> with your primary username without the <> around it.

After that you will need to logout and log back in for these values to apply. You will probably need to restart the adb server as well.

Change directory to your platform-tools directory and run the following.
Code:
./adb kill-server
./adb start-server


Thanks for the post and the guide.
I have a little problem. i.e How do i change the directory to platform-tools directory before i ru the code u gave me. Please dont be mad at me becouse the truth is i am a new user.
 

Sblood86

Inactive Recognized Developer
Apr 18, 2011
415
407
Middle of nowhere, Texas
Thanks for the post and the guide.
I have a little problem. i.e How do i change the directory to platform-tools directory before i ru the code u gave me. Please dont be mad at me becouse the truth is i am a new user.

As in; from your terminal use the 'cd' command to change directory to where-ever platform-tools is actually installed on your PC.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Alright so it turns out making ADB work for the Kindle Fire under Ubuntu is just a touch more difficult than in Windows.

    Thanks to Gbhil (@ AndroidCentral) for the write up on windows it was a great jumping off point to try to figure this out.
    Also thanks to the guys on chat.andirc.net (Skourg3 in particular for helping me figure this out the first time).

    Let's get down to the nitty gritty yeah?

    First you will still need the entry provided by Gbhil, go ahead and set it using the echo command in a terminal.
    Code:
    echo 0x1949 >> ~/.android/adb_usb.ini

    You can confirm that it took by using the cat command
    Code:
    cat ~/.android/adb_usb.ini

    You should get a return of '0x1949' (plus any other rules that you may have added in the past).

    Now really that should work but everytime you run adb you will have to either run it as root or using the sudo command. To allow standard user access we have to setup a udev rule.
    Code:
    sudo gedit /etc/udev/rules.d/51-android.rules

    That should open up gedit for you to edit the file 51-android.rules. If this is the first time you have added any udev rules the file will be empty as gedit will have just created it for you. go ahead and add in the following.
    Code:
    # adb/fastboot protocols for blaze / otter (Amazon Kindle Fire)
    SUBSYSTEM=="usb", ATTR{idVendor}=="1949", ATTRS{idProduct}=="0006", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTRS{idProduct}=="0100", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"

    Save that than add in the user group androiddev.
    Code:
    sudo addgroup --system androiddev

    And add your username to that group.
    Code:
    sudo adduser <username> androiddev

    Replace <username> with your primary username without the <> around it.

    After that you will need to logout and log back in for these values to apply. You will probably need to restart the adb server as well.

    Change directory to your platform-tools directory and run the following.
    Code:
    ./adb kill-server
    ./adb start-server

    Assuming all went well that should work properly and you can than connect through adb, if for some reason this doesn't work try restarting your computer (though I do not believe this is necessary).

    If you don't want to type the "./" before all of your adb and fastboot commands, you need to add their parent directory into your PATH environment variable. For example, (assuming you are using the bash shell) if you have adb and fastboot in your /home/<username>/bin directory, you want to define...

    Code:
    PATH=~/bin:${PATH}
    or
    Code:
    PATH=${PATH}:~/bin

    It just depends on whether you want your own binaries to be used before the system equivalents or after. Most people would probably use the first one to have your own binaries be the preferred ones, but either one should work for adb and fastboot since there are no system binaries by the same names.

    If you don't want to have to do this for every shell you open, you can place the definition at the end of your ~/.bashrc file. If you need it for you your login shell, you also need to put it into your ~/.bash_profile file. If you don't want to maintain two parallel files with much of the same information, take a look at this post.
    3
    First you will still need the entry provided by Gbhil, go ahead and set it using the echo command in a terminal.
    Code:
    echo ~/.android/adb_usb.ini 0x1949

    Thanks for the guide on setting this up for linux. I just wanted to point out a small error in the instructions. The echo command above is incorrect and will not do what you intended. It should be corrected to

    Code:
    echo 0x1949 >> ~/.android/adb_usb.ini

    That will create or append to the file as necessary.
    1
    Someone asked me about my Ubuntu setup last night and I thought that I should contribute back to this thread with the same information.

    You can add another udev rule to cover fastboot commands on FFF so they don't have to be run as root...

    Code:
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTRS{idProduct}=="0100", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"

    If you don't want to type the "./" before all of your adb and fastboot commands, you need to add their parent directory into your PATH environment variable. For example, (assuming you are using the bash shell) if you have adb and fastboot in your /home/<username>/bin directory, you want to define...

    Code:
    PATH=~/bin:${PATH}

    or

    Code:
    PATH=${PATH}:~/bin

    It just depends on whether you want your own binaries to be used before the system equivalents or after. Most people would probably use the first one to have your own binaries be the preferred ones, but either one should work for adb and fastboot since there are no system binaries by the same names.

    If you don't want to have to do this for every shell you open, you can place the definition at the end of your ~/.bashrc file. If you need it for you your login shell, you also need to put it into your ~/.bash_profile file. If you don't want to maintain two parallel files with much of the same information, take a look at this link.

    http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

    I follow the recommendation at the end.

    Hope that helps someone.
    1
    I spent something like 3 weeks trying to find the rule that worked with fastboot lol... thanks!

    Your link is dead btw.

    Well it worked a couple of days ago when I made my post. It's not my fault it took you so long to read it. ;)

    All it really said was to add...

    Code:
    if [ -f ~/.bashrc ]; then
       source ~/.bashrc
    fi

    to the .bash_profile file so that it will source the .bashrc file regardless of the way you got to the shell. Then you only have to maintain the .bashrc file and only put login shell specific info into .bash_profile

    I picked up another tidbit yesterday while engrossed in the whole CWMR bricking thread. Ubuntu has a plugdev group that's used for (mounting?) hot-pluggable firewire/USB devices... sounds a lot like the KF. The first user created on the system is automatically put into that group. Since most Ubuntu desktop are going to be single user machines anyway, that's going to be THE user for the majority of these cases. So, creating a androiddev group just for the KF is probably not necessary most of the time. You can just skip the addgroup and adduser to group commands if you just want to adjust your rules to use the plugdev group instead.
    1
    First I'm going to apologize for not being good with this stuff. Now I'm going to ask questions that will probably frustrate some readers. If you aren't irritated by them please help me out.



    What is the entry provided by gbhil? Where do I get it? I thought I had adb in here but apparently I don't because when I run the echo command I'm getting "no such file or directory."

    Can anyone dumb this down for me just a bit. Add the steps I'm obviously going to need as a newb?

    Thanks

    The most likely cause of that error is you don't have a .android directory in your home directory. You'll need to run the following command before that echo command...

    Code:
    mkdir ~/.android

    That will create a ".android" directory in your home directory (~ is shorthand for your home directory). Then you can create that adb_usb.ini file with the "0x1949" line in it.