Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Ubuntu 12.10 and I have installed Android SDK, set it's path in my user .bashrc and it works.

The problem is that my phone requires adb to be ran by root for permissions, but running adb with sudo I get the following error:

sudo: adb: command not found

I tried to simply use sudo -E adb start-server, but it doesn't work. Tried to add the export path line to /root/.bashrc and (after realizing it didn't help) to /etc/bash.bashrc.

I remember I could set it on my Arch Linux, but I guess my problem now is connected to Ubuntu root account not behaving like I expect it.

What I don't understand is the following:

These don't work:

martin@alyx:~$ sudo adb devices
sudo: adb: command not found

This does (typing the full path):

martin@alyx:~$ sudo /opt/android-sdk-linux/platform-tools/adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
CM7-Blade   device

This doesn't work (using -E with sudo):

martin@alyx:~$ sudo -E adb devices
sudo: adb: command not found

This works (as root):

martin@alyx:~$ sudo su
root@alyx:/home/martin# adb devices
List of devices attached 
CM7-Blade   device

I'm totally confused now and I'd appreciate some clarifying on how to set a path for sudo or how else I could solve my problem.

(And please, don't say adb shouldn't be ran as root.)

Thanks in advance!

Edit: By requiring root permissions I mean that I need them because otherwise I get:

$ adb devices 
List of devices attached 
????????????    no permissions

which doesn't occur as superuser. Sorry if it was misunderstanding.

share|improve this question
I've noticed with both Windows and Ubuntu that Android devices often do not appear if you have them plugged into a USB 3 port, plugging them into a non-USB3 port alleviates the issue. – Paul Gregoire Apr 30 '14 at 15:17
up vote 29 down vote accepted

Please read the following first: How do I set up Android ADB?

Configuring USB access

First, you don't need root permissions to run ADB if you have set the permissions accordingly. The AOSP site provides examples for Configuring USB Access for Nexus devices. You can use the following scheme for non-Nexus devices:

SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", ATTR{idProduct}=="xxxx", MODE="0600", OWNER="<username>"

Vendor and product ID can be obtained by using lsusb and searching for your device. (Note: The device actually is a Galaxy Nexus.)

$ lsusb | grep -i samsung
Bus 002 Device 103: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II]

So my /etc/udev/rules.d/51-android-rules udev rule looks like this:

# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="username"

You may want to repeat this for the other phone states like fastboot if needed. To let the changes take effect either reload udev (sudo udevadm control --reload) or reboot (recommended).

Making programs available

Instead of modifying the path variable I would suggest adding a symbolic link to the executable either in ~/bin/ (user only) or in /usr/local/bin/ (system wide).

mkdir ~/bin/
ln -s /opt/android-sdk-linux/platform-tools/adb ~/bin/
share|improve this answer
I tried adding the udev rules for my phone, but it didn't help so I thought maybe I wasn't clear about my problem. Please, if you have the time, see the end of my question. – Martin Fejes Nov 7 '12 at 2:31
Have you added the correct IDs? Have rebooted your machine afterwards? adb devices works for me without root privileges. – LiveWireBT Nov 7 '12 at 3:36
Yay, it works! I added the udev rules to /etc/udev/rules.d/51-android-rules and apparently it was a mistake. After using /lib/udev/rules.d/11-android.rules, everything was fine! I don't need root persmissions! Thanks a lot! – Martin Fejes Nov 7 '12 at 10:37
Had the same ???????????? no permissions situation and your answer solved it, thanks. – Panthro Feb 24 '15 at 12:01
for some reason it did not work here, I had to start adb server with sudo; any idea where could I look to see why it did not work? – Aquarius Power May 6 '15 at 0:26

I bumped into the same issue with a tablet from China (some weird manufacturer).

In addition to /etc/udev/rules.d/51-android.rules file, I needed to change ~/.android/adb_usb.ini as well.

Run below on terminal;

sudo gedit ~/.android/adb_usb.ini

and your adb_usb.ini file should look like:

# USE 'android update adb' TO GENERATE.
# ie 0x2207
0x<!!!Your Vendor ID here!!!>

Disconnected and reconnected device and also needed to run below commands on terminal;

adb kill-server

and afterwards

adb start-server

And the device was detected.

share|improve this answer
I tried with your tip too but nothing changed, any idea where I could look to see why it did not work here? – Aquarius Power May 6 '15 at 0:27
Nice one. That worked for me. Along with that, I had to update my adb. – Waffle's Crazy Peanut Jun 1 '15 at 9:19
This solution does not work on Ubuntu 14.04. The list of devices still comes out empty. – Luís de Sousa Mar 20 at 17:16
Thanks a lot, Uygar, finally I've found the solution that works for me. – Dmitry Popov May 3 at 19:46
That's what I was missing. In fact, the 0x2207 in your example is the same vendor ID that my device uses. – ssokolow May 9 at 5:29

Try this command: sudo tools/android update sdk --no-ui


Welcome to the Android SDK! The Android SDK archive initially contains only the basic SDK tools. It does not contain an Android platform or any third-party libraries. In fact, it doesn't even have all the tools you need to develop an application. In order to start developing applications, you must install the Platform-tools and at least one version of the Android platform, using the SDK Manager. Platform-tools contains build tools that are periodically updated to support new features in the Android platform (which is why they are separate from basic SDK tools), including adb, dexdump, and others. To install Platform-tools, Android platforms and other add-ons, you must have an Internet connection, so if you plan to use the SDK while offline, please make sure to download the necessary components while online. To start the SDK Manager, please execute the program "android". From the command-line you can also directly trigger an update by executing: tools/android update sdk --no-ui

share|improve this answer
I'm not sure that this addresses the original question... – landroni Oct 26 '14 at 17:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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