I got an Android Nexus 7 (2013, Wi-Fi) device a short while ago. I attached
the device to my computer and tried to list the devices with adb
devices
command. But, unfortunately, I got the following error message:
$ adb devices
List of devices attached
???????????? no permissions
In the following of the post, I would like to explain how did I fix the problem.
ADB Server with Root Permission
First, we can run adb
command with root permission, and check
whether we can list the devices with sudo
:
# Stop the adb server (which will be restarted later.)
$ adb kill-server
# Open a root shell.
$ sudo -s
# Run "adb device" with in the root shell.
> adb devices
List of devices attached
057d7cxx device
# Stop the adb server with root permission.
> adb kill-server
# Leave the root shell.
> exit
OK. It seems that everything works fine with root permission. If we can see the device with root permission, then the underlying problem is that the user is not allowed to access the USB device.
Configure udev for USB Access
To grant the USB access to an user, you can follow the instructions in Configuring USB Access. In short, there are following steps:
Create a new udev configuration file at
/etc/udev/rules.d/51-android.rules
.Copy the settings from Configuring USB Access and replace
<username>
with your Linux username.Reload the udev configuration with:
$ sudo udevadm control --reload-rules
Re-plug the Android device.
If you are lucky, this should work for you.
However, it doesn't work for me because the vendor ID and product ID of my device are not listed in Configuring USB Access. I have to figure out the vendor ID and product ID by myself.
Find USB Vendor and Product ID for udev Rules
We can check the USB vendor ID and product ID with lsusb
:
$ lsusb
Bus 003 Device 013: ID 18d1:4ee7 Google Inc.
In this example, 18d1
is the vendor ID and 4ee7
is the
product ID for my Android device. Thus, I added the following rule:
# adb protocol on flo (Nexus 7 2013)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0600", OWNER="<username>"
Now, we can reload the udev rules with:
$ sudo udevadm control --reload-rules
After re-pluging the device, we should be able to see the devices with:
$ adb devices
List of devices attached
057d7cxx device
However, notice that the bootloader has different product ID, thus we have have to reboot to bootloader mode:
$ adb reboot bootloader
$ lsusb
Bus 003 Device 013: ID 18d1:4ee0 Google Inc.
It seems that we have to add 18d1:4ee0
to udev rules as well:
# fastboot protocol on flo (Nexus 7 2013)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
Reload the udev configuration again.
$ sudo udevadm control --reload-rules
Finally, re-plug the USB device again. Everything should work now!
If this still doesn't work, then restart the udev service with:
$ sudo service udev restart
Hoping this post will help.
Reference
- StackExchange: How to reload udev rules without reboot?