87

I'm running Ubuntu 10.10 64 bit. I have ia32-libs installed along with Android Debug Bridge version 1.0.26.

My problem(s):

  1. adb devices >>> ???????????? no permissions
  2. sudo adb devices >>>> sudo: adb: command not found
  3. adb shell >>> error: insufficient permissions for device

I guess these are all related. Here's the relevant info.

$ echo $PATH
/home/me/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/android-sdk-linux_x86/tools:/opt/android-sdk-linux_x86/platform-tools

$ which adb
/opt/android-sdk-linux_x86/platform-tools/adb

$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
????????????    no permissions

$ sudo adb devices
sudo: adb: command not found

$ adb shell
error: insufficient permissions for device

I get the same results with a rooted Moto Droid running CM6.1 and a rooted G-Tab running a CM7-based ROM.

I have reviewed the following related posts:

I tried most (not all) of the suggestions and I have not been able to resolve my issue. The things I didn't try seemed inappropriate. I would appreciate a few more tips and I'll keep troubleshooting.

One thing I didn't try was editing /etc/udev/rules.d/70-android.rules. Is that likely to be the issue? I can't see how that would cause "sudo: adb: command not found". Maybe my problems are not all related. Anyway, at this point I think I need some input from other people because I don't believe I have a path problem or the other common problems discussed in those other posts.

EDIT: SOLVED thanks to EboMike and RivieraKid. This was actually two different problems:

  1. Item #2 above (sudo: adb: command not found) was solved by making a symlink as follows:

    $ sudo ln -s /opt/android-sdk-linux_x86/platform-tools/adb /usr/local/sbin/adb
    

    That allowed me to then do as EboMike suggested and use this solution. Doing that was required for my Moto Droid. (Running adb as sudo was not required for my Viewsonic G-Tablet, however.)

  2. My other two items were resolved by implementing the udev rule as RivieraKid suggested (from this link).

Community
  • 1
  • 1
MountainX
  • 5,773
  • 8
  • 41
  • 75

9 Answers9

87

One thing I didn't try was editing /etc/udev/rules.d/70-android.rules. Is that likely to be the issue?

Any particular reason why you didn't do that? To answer the question - YES! The udev rules are what informs Ubuntu what your device is and allows user-space tools to therefore access it.

You will not be able to use adb without correctly following the instructions.

With that in mind however, you don't say what version of Ubuntu you're using but I had issues with 10.10 - let me know if you need me to post the contents of my rules file.

Don't worry about running adb via sudo, you don't need it. The MODE="0666" from the udev rule allows you to access the device as any user.


EDIT:

Don't forget to reload the rules:

sudo udevadm control --reload-rules

EDIT #2:

As @Jesse Glick correctly points out, if adb is already running in daemon mode, you'll also need to restart it for this to work:

sudo adb kill-server

I've used sudo here, since that will guarantee that adb will be killed , and it's the officially supported method to stop the server. It will be automatically restarted the next time adb is used, but this time with the correct environment.

Alex P.
  • 27,029
  • 16
  • 103
  • 156
RivieraKid
  • 5,867
  • 4
  • 36
  • 47
  • 1
    Thank you for the [link](http://developer.android.com/guide/developing/device.html). Not sure how I missed the fact that those instructions were official. I thought people were doing that as a work-around. I found the vendor code for my Viewsonic GTablet and added the udev rule and now it works! Thanks. – MountainX Apr 01 '11 at 08:40
  • 1
    for some reason I can't get the Motorola Droid to show up with adb devices. Now I can get the GTab and an emulator to show up, but not the Droid. – MountainX Apr 01 '11 at 08:43
  • See above. Running adb as root caused the Moto Droid to show up. – MountainX Apr 01 '11 at 08:46
  • $ cat /etc/udev/rules.d/51-android.rules SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666" SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666" – MountainX Apr 01 '11 at 08:48
  • Strange - the instructions should enable all users read/write access to the phone. Glad it's working for you now though. – RivieraKid Apr 01 '11 at 08:49
  • Hey EboMike and RivieraKid, I need to pick both your responses as answers. I'm not sure if I can select two answers, however. Thanks for your help! – MountainX Apr 01 '11 at 08:59
  • @MountainX: aren't you missing {idProduct}? – IgorGanapolsky Apr 09 '12 at 21:08
  • @igor-g - no, that wasn't it. Many of those attributes are optional. You can write the udev rules a lot of different ways. And I gave the exact steps for my solution in the edit to my OP. Thanks. – MountainX Apr 10 '12 at 00:28
  • Note also the need to unplug/replug the phone after changing all this and restarting udev..... – nealmcb Jun 15 '12 at 12:32
  • 1
    …and you need to restart the `adb` daemon, if it was running before. – Jesse Glick Mar 29 '14 at 21:27
  • hi guys can anyone think of some other blocker, using GT-I9305 with rule: SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev", followed all steps here, ensured my user is in plugdev group,restarted adb,udev,reconnected device... but still no permissions in ubuntu 14.04 64bit – tomasb May 14 '14 at 19:19
  • btw i need to use the phone booted to clockworkmod cause its touch screen is not working, another samsung works just fine but it has debugging enabled, now im trying to enable usb debugging outside the broken device with setprop persist.service.adb.enable 1 ... any ideas please? – tomasb May 14 '14 at 19:27
  • even more strange, it worked on windows so i solved it but still i am curious whats happening in linux – tomasb May 14 '14 at 23:33
  • frankly, I never needed special udev rules, always worked automatically so far.. however I needed to start the server as root (for newer SDK versions?), I believe this previously worked as normal user. – Gregor Feb 21 '15 at 21:27
  • I had to run `adb start-server` after `kill-server` or it does not seem to start. – Ciro Santilli新疆棉花TRUMP BAN BAD Jan 24 '16 at 01:24
  • Your link (to setup udev) is broken. – Gavin S. Yancey Jun 14 '16 at 02:16
  • The instructions link has now changed, here's the new page: https://developer.android.com/studio/run/device.html – Ash Apr 23 '17 at 12:10
22

You need to restart the adb server as root. See here.

Community
  • 1
  • 1
EboMike
  • 72,990
  • 14
  • 152
  • 157
  • didn't work. Details: `me@desktop:/opt/android-sdk-linux_x86/platform-tools$ sudo adb kill-server sudo: adb: command not found me@desktop:/opt/android-sdk-linux_x86/platform-tools$ adb kill-server me@desktop:/opt/android-sdk-linux_x86/platform-tools$ sudo adb start-server sudo: adb: command not found` – MountainX Apr 01 '11 at 07:37
  • `adb` is not in the path of your superuser. Enter `which adb` to find out which path it's in, then add that to root's path. – EboMike Apr 01 '11 at 07:48
  • Hope you can read this. (I don't know how to format comments to include newlines.) adb IS in the path of my root user. I pasted the which adb command in my original post. The path is /opt/android-sdk-linux_x86/platform-tools/adb. $ sudo -s root@desktop:# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/android-sdk-linux_x86/tools:/opt/android-sdk-linux_x86/platform-tools – MountainX Apr 01 '11 at 08:00
  • 1
    Here's a strange thing. I get different results from "which adb" depending on whether I run it as root or run it with sudo. Here's output $ sudo which adb $ – MountainX Apr 01 '11 at 08:02
  • Specify the full path then when you run adb as root. – EboMike Apr 01 '11 at 08:16
  • This resolved item #2 of my original 3. $ sudo ln -s /opt/android-sdk-linux_x86/platform-tools/adb adb me@desktop:/usr/local/sbin$ ls -la lrwxrwxrwx 1 root root 45 2011-04-01 04:26 adb -> /opt/android-sdk-linux_x86/platform-tools/adb – MountainX Apr 01 '11 at 08:28
  • now I see the problem from my #1 all the time: $ sudo adb devices List of devices attached ???????????? no permissions – MountainX Apr 01 '11 at 08:29
  • Did restart the adb server as root? – EboMike Apr 01 '11 at 08:31
  • Strange... I could access the GTablet without running adb server as root. But I had to run adb as root to see the Moto Droid. – MountainX Apr 01 '11 at 08:46
  • Hey EboMike and RivieraKid, I need to pick both your responses as answers. I'm not sure if I can select two answers, however. Thanks for your help! – MountainX Apr 01 '11 at 08:59
13

On my Gentoo/Funtoo linux system I am having similar problems:

I gotting always not the correct device description and insufficient permissions:

# sudo ./adb devices
List of devices attached 
????????????    no permissions
# ./adb usb
error: insufficient permissions for device

For me helps the howto from Google. In my case I needed to add the udev rule:

# cat /etc/udev/rules.d/51-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" 

and setting up the filesystem rights

# chmod a+r /etc/udev/rules.d/51-android.rules

After replugging my smartphone the access to the phone was successful, it also appears now in Eclipse' Android Device Chooser:

# sudo ./adb devices
List of devices attached 
3XXXXXXXXXXXXXC device
# sudo ./adb usb
restarting in USB mode

You also have to check the membership of your user to the plugdev-group.

larkee
  • 480
  • 8
  • 15
3

Every answer I've read indicates the SUBSYSTEM=="usb". However, my (perhaps ancient) udev needed this to be changed to DRIVER=="usb". At last I can run the adb server as a non-root user... yay.

It can be instructive to look at the output of udevmonitor --env, followed by the output of

udevinfo -a -p <DEVICE_PATH_AS_REPORTED_BY-udevmonitor>
anon
  • 31
  • 2
  • If `udevmonitor` and `udevinfo` do not exist on your machine, use `udevadm monitor` and `udevadm info -a -p ...` instead. – Ash Apr 23 '17 at 12:16
2

Please note that IDEs like IntelliJ IDEA tend to start their own adb-server.

Even manually killing the server and running an new instance with sudo won't help here until you make your IDE kill the server itself.

sebastianwagner
  • 398
  • 2
  • 9
2

restarting the adb server as root worked for me. see:

derek@zoe:~/Downloads$ adb sideload angler-ota-mtc20f-5a1e93e9.zip 
loading: 'angler-ota-mtc20f-5a1e93e9.zip'
error: insufficient permissions for device
derek@zoe:~/Downloads$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX    no permissions

derek@zoe:~/Downloads$ adb kill-server
derek@zoe:~/Downloads$ sudo adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
derek@zoe:~/Downloads$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX    sideload
keredson
  • 2,524
  • 1
  • 14
  • 18
  • Me too: Linux Mint Serena 18.1 with HTC Sensation. Noob alert: I have been faffing about for 2 days with this so stuff is almost certainly snafu'd – Aethelbald Mar 30 '18 at 16:20
1

I fixed this issue on my debian GNU/Linux system by overiding system rules that way :

mv  /etc/udev/rules.d/51-android.rules /etc/udev/rules.d/99-android.rules

I used contents from files linked at : http://rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/

Chand Priyankara
  • 6,485
  • 1
  • 38
  • 59
RzR
  • 2,889
  • 26
  • 25
  • http://rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/ – RzR Mar 29 '14 at 19:50
0

HTC One m7 running fresh Cyanogenmod 11.

Phone is connected USB and tethering my data connection.

Then I get this surprise:

cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb shell
error: insufficient permissions for device

cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
????????????    no permissions

SOLUTION: Turn tethering OFF on phone.

cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
HT36AW908858    device
cinderman
  • 1
  • 1
-3

I just got the same situation, Factory data reset worked well for me.