39

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?

2
77

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

5
  • 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
  • 1
    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 '19 at 13:12
  • 2
    Changing to file transfer mode worked for me. On android 7 – Abrar Mar 22 '19 at 1:20
  • Kindle Fire 8 2019 - "MTP mode" which is in USB configuration in Developer Options. – Bill McGonigle Jul 2 '19 at 15:46
  • 1
    I changed and then i was prompted on the device to allow usb debugging :D – Maxwell s.c Jul 26 '19 at 2:53
30
  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.
6
  • 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
  • 1
    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
6

If you restart the ADB server with sudo, it will work.

sudo adb kill-server
sudo adb start-server
1

remove adb package installed via apt

$sudo apt remove adb

download latest adb from
https://developer.android.com/studio/releases/platform-tools

set the path to platform tools(better put these two lines in ~/.bashrc file)

export PATH= /<path-to-android-sdk-folder>/android-sdk/tools/bin<br>
export PATH= /<path-to-android-sdk-folder>/android-sdk/platform-tools

run

$source ~/.bashrc

check adb path

$which adb

start adb in sudo(I needed to give absolute path to adb when running in sudo )

$sudo /<path-to-android-sdk-folder>/android-sdk/platform-tools/adb kill-server
$sudo /<path-to-android-sdk-folder>/android-sdk/platform-tools/adb start-server
$adb shell

DONE.
it works irrespective of what USB mode( MIDI, transferring files, charging) of android phone. It works in all.

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'
    }
  }
}
0

Best solution and what worked better for me is to install adb from Ubuntu package. This gives you a community-maintained default set of udev rules for all Android devices.

example:

$ sudo apt-get install adb
0
0

For Amazon Fire OS 8, an Android based OS, you can go to "Settings > Device Options > Developer Options". You may need to enable it.

Ensure "USB Debugging" is on (in your case, it is).

Then go to "Networking > Select USB Configuration". Choose "MTP (Media Transfer Protocol)". This allows the computer to send files back and forth.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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