23

I'm trying to use adb from a Ubuntu(+Cinnamon) machine. The problem is that I get following message from adb devices:

List of devices attached
TA8830OIVO  no permissions

Where TA8830OIVO is my Motorola G device.

I changed android rules in /etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="2e76",
MODE="0666", GROUP="plugdev", SYMLINK+="android_adb", OWNER="axel"

I also restarted udev service and adb being installed on my personal laptop I'm the only user with all the priveledges needed (plugdev group and so on).

Is there a way to run adb without invoking sudo?

  • 1
    Restarting udev and sudo udevadm trigger didn't work for me. I had to restart the computer and then it worked just fine – Rafael Xavier Feb 19 '18 at 19:22
39

Change the USB mode in your phone to File Transfer. That's what worked for me.

  • The opposite is true for me: USB debugging does not work during file transfer mode on some old devices. – Miha_x64 Jul 16 '18 at 11:18
  • Update: just noticed that in my phone (android one), usb debugging can also be enabled while in charging mode in Developer Settings. – NuttLoose Jan 17 at 13:12
20
  1. Remember to run sudo udevadm trigger to get the changes applied (or reboot, but where's the fun in that).
  2. Instead of writing your own rules use https://github.com/M0Rf30/android-udev-rules
  3. Make sure you have the latest ADB version (1.0.35 102d0d1e73de-android). Earlier ones didn't work with USB-C for me.
  • Thanks but it's kinda old question. I switched to Mac 2 years ago. I find it stupid to do stuff like lsusb and then modify rules when it should be done automatically... I gave up after so many years of ubuntu use. Can't find a decent Linux Desktop system. – shadox Apr 8 '16 at 21:06
  • The question is 6 months old and still valid for posterity. 1y ago I dumped OS X after a 3y affair and went back to Linux for similar reasons ;). Linux has parts where it gets frustrating but there's a similar amount of tinkering required in OS X if you use homebrew+zsh+iTerm2. The difference is that stuff if mostly closed-source or outdated versions of FOSS but with a nice GUI and UX (for the most part). Using the rules from the repo makes it mostly a one-time setup step. Considering the arcana of getting the Android SDK to work in a sane way it's toddlers-play. – zamber Apr 10 '16 at 0:08
  • 1
    Running this and service udev restart didn't work for me. I had to restart the computer and then it worked just fine. – Rafael Xavier Feb 19 '18 at 19:21
  • On ubuntu 16.04 setting the udev rules, changing the usb mode on phone to file transfer worked like a charm. No restart needed. – Gautam Jun 22 '18 at 14:13
  • On ubuntu 16.04 with a Pixel 2 adding the rules from the gitbub of point 2 works without even going in to file transfer mode. – Mike Hanafey Oct 24 '18 at 15:21
0

Define custom gradle function:

task _adb_restart {
def adb = android.getAdbExe().toString()
group '__custom'
  doLast {
    exec {
      commandLine 'bash', '-c', '/bin/echo **root_password** | sudo -S ' + adb + ' kill-server'
    }
    exec {
      commandLine 'bash', '-c', '/bin/echo **root_password** | sudo -S ' + adb + ' devices'
    }
  }
}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.