There are numerous reports that adb (Android debug bridge) fails to see Android devices attached to a Fedora box via USB. If you encounter this problem, this guide may give you some hints and ideas about how to set-up adb with workarounds.

1. Install adb
This is simple; just pull it from Fedora's repo:

$ sudo yum install android-tools

The adb package installs a systemd service (adb.service) which is disabled by default. Usually this is not needed, as adb runs fine as a user-owned daemon process automatically when you start it.

2. Enable USB debugging on the device
This may vary from device to device, and this part is not really related to Fedora. Some phones may lack the option of USB debugging at all. Please refer to the device's support material or online resources. On my Nexus 5 phone, this is done by clicking the "Build number" section in "Settings -> About phone" many times, which unlocks the "Developer options" hidden feature, and selects "USB debugging".

3. Determine the USB ID of the Android device
Install `usbutils' if you don't have it yet:

$ sudo yum install usbutils
Connect the device to a USB port on the Fedora box and check the device ID using `lsusb':

$ lsusb
The output should include your device, with a record that looks like this:

Bus 003 Device 002: ID 18d1:4ee2 Google Inc. Nexus 4 (debug)

4. Check the permission on the USB device character special file

$ ls -l /dev/bus/usb/MMM/NNN
where MMM is the No. of "Bus" from the previous section's `lsusb' output, and NNN is the "Device" number from the same line.

If the device is owned by user root and group root, while lacking group- and other- readwrite permission bits, adb as a user-owned process will not have enough permissions to use the device.

(This is usually the problem encountered by the "adb doesn't work" folk 9 of 10 times.)

If this is the case, only the root user will be able to use adb, but using the root user for anything other than basic system configuration is Considered Harmful™ (http://www.catb.org/jargon/html/C/considered-harmful.html). We need to allow user-access on this device.

5. Create a user group and tell udev to create USB device file for this group
First create a group for normal users who should be allowed to access the device:

$ sudo groupadd androiddev
Here `androiddev' is used as a group name. Of course you can choose your own name for such a group as long as it has not been taken already.

Now, as root, create the file `/etc/udev/rules.d/99-android-debug.rules` and fill it with the following content:

SUBSYSTEM=="usb", ATTR{idVendor}=="AAAA", ATTR{idProduct}=="BBBB", GROUP="androiddev", MODE="0664"
Replace the `AAAA' and `BBBB' strings with the real Vendor:Product IDs of the device, cf. the output of `lsusb' in Section 3.

6. Refresh group enumeration for yourself
Simply log off and log in again, or use this terrible hack (for your current shell session):

After that, `adb devices' command should give you something like this in the output:

List of devices attached
0011223344aabbcc device

P.S.
There is no need to practise the voodoo (http://www.catb.org/jargon/html/V/voodoo-programming.html) stuff such as turning the device off and on, turning the computer off and on, repeatedly unplugging/changing USB ports, repeatedly killing and restarting adb, upgrading Android SDK, cycling through the device's debug permissions, starting adb with root privilege, sacrifice a lamb and limb, etc., as suggested all over the Internet. See also: Skinner's pigeons (https://en.wikipedia.org/wiki/B._F._Skinner#Superstitious_pigeons).

stevea

11th May 2014, 09:57 AM

P.S.
There is no need to practise the voodoo stuff such as turning the device off and on, turning the computer off and on, repeatedly unplugging/changing USB ports, repeatedly killing and restarting adb, upgrading Android SDK, cycling through the device's debug permissions, starting adb with root privilege, sacrifice a lamb and limb, etc., as suggested all over the Internet. See also: Skinner's pigeons.

+1 x2

That paragraph should be a separate thread or even a topic area. Well said.

nated

4th June 2014, 10:16 PM

In step 7 you need to run the following code to restart udev otherwise it won't work and you will get confused like me:confused:

sudo udevadm control --reload

aleph

5th June 2014, 04:36 AM

In step 7 you need to run the following code to restart udev otherwise it won't work and you will get confused like me:confused:

sudo udevadm control --reload

Thanks for pointing that out :cool:

aatifmoin

4th August 2014, 06:12 AM

I've done everything u said but adb does'nt work although fastboot does work fine:confused:

CronoCloud

4th August 2014, 07:27 PM

Just a quick tip. Make sure to enable debugging in your device before you plug it in to do the lsusb. Some devices report different device numbers depending on if it is enabled or not.

CronoCloud

aatifmoin

7th August 2014, 05:55 PM

I did it all it just doesn't work but as I said, fastboot works well

lexonight

9th February 2015, 12:00 AM

digging up old thread, but this worked for my lg optimus f3 and fedora 21, the debugging mode had to be on for my phone. Thanks