60

When I tried to push my apk file into a tablet, I got this error, please help me out.

adb server is out of date.  killing... 
* daemon started successfully * 
error: insufficient permissions for device.

Thanks in advance for the help.

Marcus
  • 730
  • 1
    The answer by user84207, which is supported by the reference to the official Android developer documentation, is much better than the accepted answer by Anwar Shah, since we should avoid running daemons as root whenever possible. Running adb as root makes the computer vulnerable to more attacks. – nealmcb Feb 02 '15 at 17:00

12 Answers12

63

I ran into this same problem. Adding a udev rule as indicated here did the trick:

Log in as root, create a file /etc/udev/rules.d/51-android.rules and add a line like this to give permissions to anyone in the plugdev group:

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

In this example, the vendor ID is HTC. You need to use the vendor ID for your device, which can be obtained by running lsusb and searching for a line like

Bus 002 Device 009: ID 2a47:9e18

In this example your vendor ID would be 2a47, so you would have to replace 0bb4 with 2a47. The correct line would thus read:

SUBSYSTEM=="usb", ATTR{idVendor}=="2a47", MODE="0666", GROUP="plugdev"

Now assign read permissions on the files, reload udev and reload the adb daemon:

sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo udevadm control --reload-rules
adb kill-server
adb start-server

You may have to disconnect and connect again your device to the USB port.

vidarlo
  • 22,691
erjoalgo
  • 1,041
  • 9
    You can get the USB vendor id by lsusb command. It is the first part of the colon separated pair. For example 18d1:4e22 would mean the vendor id is 18d1. – Peter Lamberg Sep 10 '14 at 19:14
  • You may need to "trigger" udev after adding the new rule file (though I'm not sure). Here's a way to "trigger" http://askubuntu.com/questions/82470/what-is-the-correct-way-to-restart-udev . – user29020 Jan 23 '15 at 00:47
  • 2
    and/or you may need to disconnect and reconnect the device? But this answer did work for me, and is much better than running adb as root. Your Ubuntu user must also be part of the plugdev group. Run id to find out. – nealmcb Feb 02 '15 at 16:58
  • 2
    This repo is extremely helpful if you have to work with a lot of devices https://github.com/M0Rf30/android-udev-rules – zamber Apr 08 '16 at 17:00
  • This didn't do it for me. The number "51" in the filename strikes me as very arbitrary. Can we use any filename we want? – Jack M Dec 14 '19 at 23:37
  • +1 fixed a big issue I mention on https://stackoverflow.com/a/28724457/5522344 – Doc Aug 28 '20 at 04:09
25

Jorch914's answer on Stack Overflow solved this issue for me:

Ok So I finally found the problem, apparently on this device you have to set to connect as camera(even after usb debugging is already enabled)

enter image description here

Also this link describes the setting up process

kas
  • 441
  • 2
    Yes, this was it! I had to "Select USB configuration" on Android N, which was by default set to "Charging". – Dan Dascalescu May 13 '17 at 00:28
  • 1
    for whatever reason I was always able to plug my pixel into a mac and start working but when i moved to a CentOS dev workstation i had to to this to get it to prompt for debugging permission. Thanks – bsautner Nov 21 '17 at 18:34
  • 2
    Worked for me. The trick seems to be to change it from "Charging" to something else, why.ever. – Bim Feb 01 '18 at 10:27
21

I've seen this same error sometimes on Ubuntu. A working workaround for this is running adb with sudo command. For example, if you're pushing app.apk on sdcard the command would be

sudo adb push app.apk /mnt/sdcard

Also, be sure you selected "USB debugging" mode in the Application settings (in GingerBread) or in Development section ( in IceCream Sandwich and above). If adb is already running, you should first kill it with the command sudo adb kill-server

Hope this will help.

Anwar
  • 76,649
  • I got it but still ll try this method too... thanks for the help – Neha Sharad Umachigi Jan 24 '13 at 10:53
  • 5
    "I got it"... Please have the courtesy to share if you found a solution, so that others may benefit (as you sought to benefit yourself when you asked the question). For example, I now have this problem, but I am forced to look elsewhere even though it is the same exact problem that you describe. – erjoalgo Sep 23 '13 at 18:27
  • 2
    This answer is risky since bugs in adb can take over the whole computer. The answer using udev rules by user84207, which is supported by the reference to the official Android developer documentation, avoids that problem. – nealmcb Feb 02 '15 at 17:03
  • This is the simplest and easiest and at least working workaround for the problem. – Anwar Feb 02 '15 at 17:10
  • Note: This worked for me because sudo finds a different installed version of adb than non-sudo. That's why this works, not because adb itself requires more privilege. – Kevin Cooper Nov 05 '18 at 03:00
11

These two simple commands solved the problem for me:

adb kill-server
adb start-server

Note that unlike semi-newbie's answer I don't need sudo.

Nicolas Raoul
  • 11,603
10

I just run through the same issue but here is how i was able to go through it:

  • you must kill the existing adb server by issuing the following command: adb kill-server (it may be wrong, but i issued it with AND without sudo
  • start the adb server with proper permissions by issuing: sudo adb start-server
  • voila. you may know issue any commands you need

Not sure if you know, but there is a package that includes adb. I mention this because i noticed that you are getting a reference to an older version of adb. You may install by issuing the following in your command line: sudo apt-get install android-tools-adb

I hope this helps.

2

Today I encountered the insufficient permissions for device error, even though adb had been working as expected just a few minutes before. Now I get:

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

$ adb shell
error: insufficient permissions for device

Shortly before encountering the error, I had disabled Media device (MTP), as I figured I would not need to use MTP. However, it appears that USB debugging, or at least some adb commands, require that Media device (MTP) be enabled.

To enable Media device (MTP) on Android 4.4, go to:

Settings
Storage
The "..." menu (in the upper right corner)
USB computer connection
Media device (MTP)

When MTP is disabled, lsusb shows the following:

Bus 002 Device 071: ID [idVendor1]:[idProduct1] Google Inc.

After enabling MTP, lsusb shows the following:

Bus 002 Device 072: ID [idVendor2]:[idProduct2] [idVendor string]

The idVendor and idProduct do change, based on whether or not MTP is enabled or disabled.

I am not an Android expert, so it is possible that the above behavior is specific to my particular model of phone.

mpb
  • 1,355
0

The answer to this problem is here : https://github.com/snowdream/51-android

As an Android developer i suggest you do NOT use "sudo" to force the use of adb anywhere. It's not what we should do. Rules, policies and restrictions are there for our own safety.

0

Yet another possibility: USB tethering also conflicts with adb. Disabling it solves the problem for me.

张实唯
  • 101
0

There are some specific things to do for Ubuntu to make USB debugging work, described in this page on developer.android.com about setting up a device for development.

What it suggests is to run these two commands in terminal:

sudo usermod -aG plugdev $LOGNAME
sudo apt-get install android-sdk-platform-tools-common

The above package contains udev rules for Android devices.

Rebooting may be needed for the changes to take effect.

Zanna
  • 70,465
0

It could be from another reason. I just get this error trying to install an apk on device:

$ adb install platforms/android/build/outputs/apk/android-armv7-release.apk 
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: insufficient permissions for device
- waiting for device -

It happened because the device was not ready on the correct mode. The device was sharing its 4G connexion via USB.

It can be known like that :

$ adb devices -l
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

33332EF19F3D00EC       no permissions usb:1-1.2

So it was enough to disable the connexion sharing on the phone and start again.

In general, make sure having the following result via the adb device command before trying to push files on the device

$ adb devices -l
List of devices attached
33332EF19F3D00EC       device usb:1-1.2

In these cases, no need to kill or restart the adb server.

It probably would be the same situation if you've mounted the device for data transfer via USB

Rémi B.
  • 944
  • 2
  • 9
  • 17
0

I had the same issue and received that insufficient permissions. What I did was revoke the USB authorities for my laptop. Then stopped and started USB debugging. Plugged it back into the laptop and granted usb debugging authorities.

  • 1
    Can you please provide more information about this process? Step by step would be ideal, so the OP can follow your example. :) – AnotherKiwiGuy Nov 18 '16 at 00:34
0

I have face the same problem and i have resolved this by Adding the path of your_android_sdk_path to the environment variable like

sudo export $PATH:/your_android_sdk_path/platform-tools/adb

its your wish how you want to add this to your account or system wide by editing these file ~/.bashrc file or ~/.profile or /etc/profile, /etc/bash.bashrc, or /etc/environment if u want to add to system wide access.

and then create the link of that in bin

sudo ln -s /your_android_sdk_path/platform-tools/adb /bin/adb

if you have used adb devices or any command then first kill the server like

adb kill-server

then start the server like

adb start-server
adb devices

now you can see your devices are listed properly without an issue