Software & AppsOperating SystemLinux

Fixing Android adb “no permission” issue on Ubuntu

Ubuntu 11

In this article, we will delve into how to resolve the “no permission” issue that may occur when using Android Debug Bridge (adb) on Ubuntu. This problem typically arises when attempting to run adb without invoking sudo.

Quick Answer

To fix the Android adb "no permission" issue on Ubuntu, you need to edit the Android rules file, add a new rule with the device ID, save the file, restart the udev service, trigger the changes, reconnect the device, and check the device status with the adb devices command.

What is Android Debug Bridge (adb)?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. It facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

Understanding the “no permission” issue

When you connect your Android device to your Ubuntu machine and run the adb devices command, you might encounter a situation where the device is detected, but its status is listed as “no permissions”. This is a common issue that arises due to insufficient permissions for the adb to access the connected device.

Prerequisites

Before proceeding with the steps to fix the issue, ensure that you have adb installed on your Ubuntu machine. If not, you can install it by running the following command in the terminal:

sudo apt-get install adb

Steps to Fix the “no permission” issue

Step 1: Editing the Android Rules File

The first step is to edit the Android rules file. You can do this by running the following command in the terminal:

sudo nano /etc/udev/rules.d/51-android.rules

This command opens the 51-android.rules file in the nano text editor with sudo privileges.

Step 2: Adding a New Rule

Next, add the following line to the file:

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

In this line, replace YOUR_DEVICE_ID with the actual device ID of your Android device. This rule allows the adb to access the device when it is connected via USB.

  • SUBSYSTEM=="usb": This matches the device subsystem.
  • ATTR{idVendor}=="YOUR_DEVICE_ID": This matches the vendor ID attribute of the device.
  • MODE="0666": This sets the permissions to read and write for the owner, group, and others.
  • GROUP="plugdev": This assigns the device to the plugdev group.

Step 3: Saving the File and Exiting the Editor

After adding the new rule, save the file and exit the editor. In nano, you can do this by pressing Ctrl + X, then Y to confirm saving the changes, and finally Enter to confirm the file name.

Step 4: Restarting the udev Service

The next step is to restart the udev service for the changes to take effect. You can do this by running the following command:

sudo service udev restart

Step 5: Triggering the Changes

After restarting the udev service, trigger the changes by running the following command:

sudo udevadm trigger

This command reloads the udev configuration without requiring a system reboot.

Step 6: Reconnecting the Device

At this point, disconnect your Android device from the computer and then reconnect it.

Step 7: Checking the Device Status

Finally, check if the device is recognized by adb by running the following command:

adb devices

If the device is listed with the status “device,” then you have successfully resolved the “no permissions” issue and can now use adb without invoking sudo.

Conclusion

By following these steps, you should be able to fix the “no permission” issue when using adb on Ubuntu. If you are still encountering issues, consider restarting your computer or referring to the Android Stack Exchange for further troubleshooting steps.

Is it necessary to run adb commands with sudo after fixing the “no permission” issue?

No, it is not necessary to run adb commands with sudo after fixing the "no permission" issue. The steps outlined in this article allow adb to access the connected Android device without requiring sudo privileges. You should now be able to run adb commands without invoking sudo.

Leave a Comment

Your email address will not be published. Required fields are marked *