85

When i try:

$ adb devices

i get the result:

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

what is the problem?

tried on an Ubuntu 16.04 machine and it worked perfectly. tried an 7.1.1 device and it also worked perfectly.

Nadav Tasher
  • 1,078

14 Answers14

113

Had same problem. Ensuring that device USB mode is NOT charging only has solved it.

Ivan Klass
  • 1,241
  • 7
    Same here, I had modified Udev rules with no results , changed USB to file sharing and presto. The device required no udev rules or specific USB modes in the previous ubuntu version. – Fco P. May 22 '17 at 06:31
  • 2
    Fixed problem on Fedora for me, thx! – F481 Jul 28 '19 at 09:32
  • I always forget this and need to search again. Can this be fixed in Ubuntu/Fedora/Android? – dreua Apr 06 '21 at 03:52
100

Try to restart the Adb server.

sudo adb kill-server

and then

sudo adb start-server

then connect your device turn Debugging on and type

adb devices
  • 2
    This does work.. sort of. After I do that, indeed, running adb devices now shows the device (and I do get the fingerprint dialog). However, it still doesn't work with android studio. Furthermore, when I run android studio, and I then run adb devices from a console, I get a "adb server is out of date" and the adb server restarts. After that, I get to the "no permissions" situation again. – Shade Aug 17 '17 at 19:47
  • This does not work. adb devices shows nothing and the headset never asks permission again. – Tyguy7 Oct 15 '19 at 01:57
  • What solves the issue here is very likely sudo. Restarting the server as a normal user won't work. See @Paul post below for the actual source of the permission issue. – jmon12 Nov 02 '23 at 13:27
59

Very likely udev is incorrectly adding your device. I too had this problem & came across a relatively simple solution.

Find your device in lsusb

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2b Intel Corp. 
Bus 001 Device 002: ID 05c8:03a2 Cheng Uei Precision Industry Co., Ltd (Foxlink) 
Bus 001 Device 006: ID 18d1:4ee7 Google Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Point of interest in this case:

Bus 001 Device 006: ID 18d1:4ee7 Google Inc.

Check out the corresponding device file

$ ls -l /dev/bus/usb/001/006

Likely you will see something like

crw-rw-r-- 1 root root 189, 5 Sep  8 21:47 /dev/bus/usb/001/006

This which means that the device file will be owned by the user root and the group root, which is why adb can access it as root but not as your standard user.

This can be solved by creating a new udev rule - I used /etc/udev/rules.d/51-android.rules- to add the device to the group plugdev, which adb already assumes you to be a member of (you shoukd be, check using id)

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0660", 
GROUP="plugdev", SYMLINK+="android%n"

**Remember to replace the ATTR{idProduct}=="4ee7" with your own product id that you found out in step one. ** (If your vendor isn't Google Inc., also replace the vendor id with the one before the colon in lsusb).

Now just unplug your device and plug it back in (udev should automatically respond to the new file) and tadaa:

$ adb devices
List of devices attached 
YC873P0G    device

Source: Adding udev rules for USB debugging Android devices - Janos Gyerik

Paul
  • 697
  • 5
  • 9
  • 1
    This answer solved my problem. Perfect, thanks. – alexmeia Apr 03 '18 at 15:15
  • 2
    Thanks @Paul It helped me. Well explained with reason. I think udev service restart is also required. – Gagan Apr 18 '18 at 10:16
  • this is most definitely the correct solution if you don't want to use sudo for stuff that you shouldn't need to use sudo for – aholt Jun 22 '18 at 14:02
  • 1
    This should be the accepted answer, as it's the correct answer. The highest-rated answer is really just a workaround. – Joel Cross Sep 09 '18 at 21:57
  • 1
    This solved it for me. It worked yesterday without the rules, but then after installing updates on ubuntu it stopped working and I had to do this. – simernes Oct 13 '18 at 09:28
  • This answer used to solve my problem but does not any more.... :( – Tyguy7 Oct 15 '19 at 02:06
  • Hey @Paul, I only put ATTR{idProduct}=="4ee7" as I want this rule to apply to all android devices. Is this a security risk? I don't really want to do this for all devices and I shouldn't have to do it. – Elias May 14 '20 at 12:30
  • Vysor users: In my case, adb devices was giving error adb server version doesn't match this client, so I had to kill vysor and adb processes (ps aux|grep ... ; kill ...). Then I edited Vysor.desktop to adb devices && ... to start adb manually before Vysor. – geekley Oct 26 '20 at 20:35
6

Changing the USB Mode from Phone did the trick for me. (I set it to File Transfer.)

Eliah Kagan
  • 117,780
NuttLoose
  • 991
2

Please DO NOT follow solutions suggesting to use sudo (sudo adb start-server)! This run adb as root (administrator) and it is NOT supposed to run like that!!! It's a BAD workaround!

Everything running as root can do anything in your system, if it creates or modify a file can change its permission to be only used by root. Again, DON'T!

The right thing to do is set up your system to make the USER have the permission, check out this guide i wrote on how to do it properly.

2

It did not work for me after I added myself to the plugdev group and rebooted the machine just to make sure the change takes effect in all my shell sessions. I then found that there is no 51-android.rules file in /etc/udev/rules.d and had to do the following to fix the problem:

# Here the vendor ID is of Google
$ echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0660", GROUP="plugdev"' | sudo tee —append /etc/udev/rules.d/51-android.rules
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
$ sudo udevadm control --reload-rules
$ sudo service udev restart

I also had to unplug and re-plug my Android device.

russoue
  • 141
2

You need to provide permission on your Android device. Go to Settings>Developer options. Try turning Usb Debugging off and then on again. Remove the cable and reconnect it. Also try deleting all saved authorizations from Developer options. It should now ask for debugging permission by a prompt on your phone. Accept it.

2

To expand Sumeet Deshmukh's answer, his approach does work in general - if you only want to use the adb command from console.

Android Studio, however, apparently starts its own adb server, killing ours. This means that after we have killed/started the server with sudo, Studio restarts it, which leads to the starting situation - no permissions.

The solution is to first start Studio, then perform the start/stop of the server. Doing that, I managed to get my Nexus 5X to show up as a valid run target in Studio.

This isn't the best situation (having to run commands every time you start Studio), but it does the trick in a quick and dirty way. If I find a more permanent solution, I will update this answer.

Shade
  • 259
  • 1
  • 2
  • 14
1

Make sure you have your udev rules in place, check /etc/udev/rules.d

You can find appropriate rules here: https://raw.githubusercontent.com/M0Rf30/android-udev-rules/master/51-android.rules

Just place them in /etc/udev/rules.d/, then:

sudo udevadm control --reload
sudo udevadm trigger

Now make sure adb server is not running:

sudo adb kill-server

Add your user to adbusers:

sudo usermod -a -G adbusers $USER

Now use su $USER (reference) so that your user actually belongs to adbusers (check using groups)

And then just start adb server again:

adb start-server

In case your device does not appear in adb devices, reconnect it.

xdevs23
  • 275
1

M0Rf30/android-udev-rules GitHub community maintained udev-rules

https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules

This is the most complete udev-rules list I've seen so far, even more than the currently recommended sudo apt-get install android-tools-adb on the official documentation, give it a try.

0

Go to Settings >> Maintenance >> Storage. Then check the top left menu and click on USB computer connection then change to Media device (MTP).

Eliah Kagan
  • 117,780
0

I had to do Paul's answer

Then I had to do NuttLoos's answer

THEN I had to take my phone and change USB port from into my keyboard hub, to straight into the computer :face-palm: (This is a Nokia 2.3 that won't work, but a Samsung A10 & a Galaxy Nexus both will work from the Kayboard usb port).

Zanna
  • 70,465
Blundell
  • 131
0

https://developer.android.com/studio/run/device

  • add yourself to the plugdev group: sudo usermod -aG plugdev $LOGNAME
  • install sudo apt-get install android-sdk-platform-tools-common
  • log out and log in again for the group changes to take effect

If it's still not working, try to:

  • disable and enable "USB-Debugging" on your developer settings of your Android phone
hb0
  • 221
0

I have no idea why this works, but this was the only solution that worked for me

Find where adb is running (if you are like me you have multiple versions installed). Keep in mind tools like react native may decide to use random other versions in order to make your life harder. For me it's ~/Android/Sdk/platform-tools/adb. So I'll run:

sudo chown root:YOUR_USERNAME ~/Android/Sdk/platform-tools/adb
sudo chmod 4550 ~/Android/Sdk/platform-tools/adb

Android tools are super annoying.

Hizqeel
  • 1,895
Bufke
  • 249