2011-10-02

How to fix the adb no permissions error on Ubuntu Lucid

This blog post explains how to fix the no permissions error the Android Debugger displays when running the adb devices command Linux. The solutions presented here have been tested and found working on Ubuntu Lucid, but they should also work on other Ubuntu and Linux versions as well.

This official help center page has many working and non-working answers to the problem, and many comments. The root cause of the problem is that the current user doesn't have sufficient permissions to access the USB device file created when the phone was connected in USB debug mode.

Killing all running adb server instances with sudo killall adb, disconnecting the phone, reconnecting the phone, and then running sudo adb devices instead (so adb gets run as root) fixes the problem.

Alternatively, it is possible to implement a long-term fix which doesn't require sudo, thus it works with e.g. IntelliJ IDE integration:

  • Create a file named /tmp/android.rules with the following contents (hex vendor numbers were taken from the vendor list page):
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
  • Run the following commands (without the leading $):
    $ sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules
    $ sudo chmod 644   /etc/udev/rules.d/51-android.rules
    $ sudo chown root. /etc/udev/rules.d/51-android.rules
    $ sudo service udev restart
    $ sudo killall adb
  • Disconnect the USB cable between the phone and the computer.
  • Reconnect the phone.
  • Run adb devices to confirm that now it has permission to access the phone.

Please note that it's possible to use , USER="$LOGINNAME" instead of , MODE="0666" in the .rules file, substituting $LOGINNAME for your login name, i.e. what id -nu prints.

49 comments:

Martin said...

Yay, it's working, thanks! :)

Anupam Shrivastava said...

Thank You very much. It helps.

Glogo said...

Thank you man, you rock :) I´ve read and tried 50 manuals like yours but each one was missing the most important step... : to unplug and plug in again the phone :D :) thx again

Renato said...

#pt-br
Muito bom. Funcionou perfeitamente por aqui. Obrigado pela dica.
#en
Very good. It worked perfectly here. Thanks for the tip.

Sneha Monteiro said...

Thanks :) helped me :)

Unknown said...

Thank you so much! Now to move forward...

Unknown said...

Thanks very much! If you want, you can add Archos devices to the list (ID: 0e79)

Unknown said...

Thanks a ton..it really worked...:)

Radůn said...

You made my day! Thanks a lot!

jalpesh rajani said...

Perfect :) Thank you

Gourab Chakraborty said...

Thanks buddy... :)

Brad Hein said...

You rock! Thank you!

marcus said...

Thank you very much : )

MidnightCoffee said...

Wonderful walk through

georges said...

This works too:
assuming adb is in your path etc:

sudo pkill -f adb (killall adb remaining)
sudo env PATH=$PATH adb devices

hav fun

pts said...

@georges: Your commands constitute a good short-term solution, but after a few hours adb stops working, and your commands have to be run again (... and again). The solution in my bog post solves the problem for good.

Tomàs Mallafré said...

@georges: after hours searching and nothing working, (previously I had no problems in ubuntu, but moved to Linux Mint Debian Edition) your solution worked for me. Thanks georges and pts!

Jomari said...

THIS WORKED PERFECTLY! Thank you. I wish I could point all the questions here

Teja Pedada said...

Thanks, It works.

Chris said...

Thank you so much.
It worked for my LG P970 perfectly !!!

Mmmary Ciminieri said...

Thanks!!

I was trying to fastboot (command not found) and with this min changes, you saved me.

Unknown said...

Thank you very much. It worked!!!

Brett said...

Thanks!!!! This worked for me :-)

Vijay Desai said...

Thank a ton... it works like a butter..

Anonymous said...

Thank you, it worked like a charm. :)

Şükrü Vahit said...

You are king :) Thanx very much

paratas said...

worked for me, thanks a lot

Χρήστος said...

thank you You saved my ass...
You rock man!

Sepero said...

I already have the file /etc/udev/rules.d/51-android.rules but I'm smart enough not to overwrite it. For those less knowledgeable, perhaps you might change your instructions to: cat tmpfile >> udevfile

Big thanks for the info.

juve said...

I am having problems and need help please

after typing in the command:
chown. root.....

i get:usage chown [:GROUP] [FILE2]....

then i typed command:

service udev restart

and i get:

unknown command udev
usage: service [-h|-?]
service list
service check SERVICE
service call SERVICE CODE [i32 INT |s16 STR]...
options:
i32 write the integer INT into the send parcel s16 write the utf-16 string STR into the send parcel

then i tried killall adb but i get: adb no process killed

any suggestions please?

Anonymous said...

Thank you! Working like a Charm on Ubuntu 14.04 and my Zopo Mobile

Daniel Perez said...

Thanks!!!!

Unknown said...

Many Thanks.

Unknown said...

It works!!!

Unknown said...

God Bless You man!

Unknown said...

THANX A LOT!!
GOD BLESS YOU!!

Shueb Dalvi said...

Thanks a lot. Works like a charm

kam said...

Thanks... it worked for me.... :)

QHu91_IT said...

Many thanks, it work :)

Abhishek said...

You are awesome! This old post helped me today! For anyone lost, Lava Iris 300 use HTC's vendor id: 0bb4

FX Bayu Anggara said...

Thank you very much... its saves my day :) ..

Unknown said...

Many thanks man! Finally a good fix! I was having a problem with ZTE V790 and Ubuntu 14.04, but now is all set :)

Unknown said...

Excelente.. me quieto el sombrero... Gracias

Anonymous said...

You ROCK ! it works!!!!!!!!!!

Medio81 said...

where is /tmp/android.rules ??

under what folder /tmp is? so i can create that android.rules file?

pts said...

@Medio81: Create a file named android.rules anywhere, with any text editor, and then copy it to /tmp: sudo cp android.rules /tmp/android.rules

Megh said...

Many thanks, it worked!

Unknown said...

You superman!

maje said...

Many thanks from Finland! :D