I'm running Ubuntu 10.10 64 bit. I have ia32-libs installed along with Android Debug Bridge version 1.0.26.
My problem(s):
adb devices >>> ???????????? no permissions
sudo adb devices >>>> sudo: adb: command not found
adb shell >>> error: insufficient permissions for device
I guess these are all related. Here's the relevant info.
$ echo $PATH
/home/me/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/android-sdk-linux_x86/tools:/opt/android-sdk-linux_x86/platform-tools
$ which adb
/opt/android-sdk-linux_x86/platform-tools/adb
$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
???????????? no permissions
$ sudo adb devices
sudo: adb: command not found
$ adb shell
error: insufficient permissions for device
I get the same results with a rooted Moto Droid running CM6.1 and a rooted G-Tab running a CM7-based ROM.
I have reviewed the following related posts:
http://forum.xda-developers.com/archive/index.php/t-522827.html
http://ubuntuforums.org/archive/index.php/t-1164359.html
adb command not found in linux environment
I tried most (not all) of the suggestions and I have not been able to resolve my issue. The things I didn't try seemed inappropriate. I would appreciate a few more tips and I'll keep troubleshooting.
One thing I didn't try was editing /etc/udev/rules.d/70-android.rules. Is that likely to be the issue? I can't see how that would cause "sudo: adb: command not found". Maybe my problems are not all related. Anyway, at this point I think I need some input from other people because I don't believe I have a path problem or the other common problems discussed in those other posts.
EDIT: SOLVED thanks to EboMike and RivieraKid. This was actually two different problems:
Item #2 above (sudo: adb: command not found) was solved by making a symlink as follows:
$ sudo ln -s /opt/android-sdk-linux_x86/platform-tools/adb /usr/local/sbin/adb
That allowed me to then do as EboMike suggested and use this solution. Doing that was required for my Moto Droid. (Running adb as sudo was not required for my Viewsonic G-Tablet, however.)
My other two items were resolved by implementing the udev rule as RivieraKid suggested (from this link).
One thing I didn't try was editing
/etc/udev/rules.d/70-android.rules. Is
that likely to be the issue?
Any particular reason why you didn't do that? To answer the question - YES! The udev rules are what informs Ubuntu what your device is and allows user-space tools to therefore access it.
You will not be able to use adb without correctly following the instructions.
With that in mind however, you don't say what version of Ubuntu you're using but I had issues with 10.10 - let me know if you need me to post the contents of my rules file.
Don't worry about running adb via sudo, you don't need it. The MODE="0666" from the udev rule allows you to access the device as any user.
EDIT:
Don't forget to reload the rules:
sudo udevadm control --reload-rules
EDIT #2:
As #Jesse Glick correctly points out, if adb is already running in daemon mode, you'll also need to restart it for this to work:
sudo adb kill-server
I've used sudo here, since that will guarantee that adb will be killed , and it's the officially supported method to stop the server. It will be automatically restarted the next time adb is used, but this time with the correct environment.
You need to restart the adb server as root. See here.
On my Gentoo/Funtoo linux system I am having similar problems:
I gotting always not the correct device description and insufficient permissions:
# sudo ./adb devices
List of devices attached
???????????? no permissions
# ./adb usb
error: insufficient permissions for device
For me helps the howto from Google.
In my case I needed to add the udev rule:
# cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
and setting up the filesystem rights
# chmod a+r /etc/udev/rules.d/51-android.rules
After replugging my smartphone the access to the phone was successful, it also appears now in Eclipse' Android Device Chooser:
# sudo ./adb devices
List of devices attached
3XXXXXXXXXXXXXC device
# sudo ./adb usb
restarting in USB mode
You also have to check the membership of your user to the plugdev-group.
Every answer I've read indicates the SUBSYSTEM=="usb". However, my (perhaps ancient) udev needed this to be changed to DRIVER=="usb". At last I can run the adb server as a non-root user... yay.
It can be instructive to look at the output of udevmonitor --env, followed by the output of
udevinfo -a -p <DEVICE_PATH_AS_REPORTED_BY-udevmonitor>
Please note that IDEs like IntelliJ IDEA tend to start their own adb-server.
Even manually killing the server and running an new instance with sudo won't help here until you make your IDE kill the server itself.
restarting the adb server as root worked for me. see:
derek#zoe:~/Downloads$ adb sideload angler-ota-mtc20f-5a1e93e9.zip
loading: 'angler-ota-mtc20f-5a1e93e9.zip'
error: insufficient permissions for device
derek#zoe:~/Downloads$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX no permissions
derek#zoe:~/Downloads$ adb kill-server
derek#zoe:~/Downloads$ sudo adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
derek#zoe:~/Downloads$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX sideload
I fixed this issue on my debian GNU/Linux system by overiding system rules that way :
mv /etc/udev/rules.d/51-android.rules /etc/udev/rules.d/99-android.rules
I used contents from files linked at :
http://rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/
HTC One m7 running fresh Cyanogenmod 11.
Phone is connected USB and tethering my data connection.
Then I get this surprise:
cinder#ultrabook:~/temp/htc_m7/2015-11-11$ adb shell
error: insufficient permissions for device
cinder#ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
???????????? no permissions
SOLUTION: Turn tethering OFF on phone.
cinder#ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
HT36AW908858 device
I just got the same situation, Factory data reset worked well for me.
Related
I rooted my unlocked Galaxy S3 (SGH-T999)
Now, I'm trying to run adb root from Windows Command Prompt, however, I'm getting adbd cannot run as root in production builds error. So, the very first thing I checked was whether my phone was really rooted?
So I tried the following:
Open Command prompt
$adb devices // lists my device
$adb shell //goes to shell
$su // opens a 'SuperSu' prompt on my phone and I 'Grant' permission
# // Before following the rooting instructions, I was getting 'no su command found' in the previous step. So, I believe my phone is ROOTED. **Correct me if I'm wrong.**
However, when I do adb root, I get adbd cannot run as root in production builds error.
So, I thought, I might have to do some additional stuff beyond what I did above. I tried all the solutions in the following SO questions:
Launch a script as root through ADB
adb remount permission denied, but able to access super user in shell -- android
Unable to run 'adb root' on a rooted Android phone
None of the above worked for me. All they do is give the ROOT access INSIDE of SHELL. I want adb root to work so that I can execute various adb commands WITHOUT going into shell.
By design adb root command works in development builds only (i.e. eng and userdebug which have ro.debuggable=1 by default). So to enable the adb root command on your otherwise rooted device just add the ro.debuggable=1 line to one of the following files:
/system/build.prop
/system/default.prop
/data/local.prop
If you want adb shell to start as root by default - then add ro.secure=0 as well.
Alternatively you could use modified adbd binary (which does not check for ro.debuggable)
From https://android.googlesource.com/platform/system/core/+/master/adb/daemon/main.cpp
#if defined(ALLOW_ADBD_ROOT)
// The properties that affect `adb root` and `adb unroot` are ro.secure and
// ro.debuggable. In this context the names don't make the expected behavior
// particularly obvious.
//
// ro.debuggable:
// Allowed to become root, but not necessarily the default. Set to 1 on
// eng and userdebug builds.
//
// ro.secure:
// Drop privileges by default. Set to 1 on userdebug and user builds.
In some developer-friendly ROMs you could just enable Root Access in Settings > Developer option > Root access. After that adb root becomes available. Unfortunately it does not work for most stock ROMs on the market.
I ran into this issue when trying to root the emulator, I found out it was because I was running the Nexus 5x emulator which had Google Play on it. Created a different emulator that didn't have google play and adb root will root the device for you. Hope this helps someone.
I use for enter su mode in abd shell
adb shell "su"
I have a rooted Samsung Galaxy Trend Plus (GT-S7580).
Running 'adb root' gives me the same 'adbd cannot run as root in production builds' error.
For devices that have Developer Options -> Root access, choose "ADB only" to provide adb root access to the device (as suggested by NgaNguyenDuy).
Then try to run the command as per the solution at Launch a script as root through ADB.
In my case, I just wanted to run the 'netcfg rndis0 dhcp' command, and I did it this way:
adb shell "su -c netcfg rndis0 dhcp"
Please check whether you are making any mistakes while running it this way.
If it still does not work, check whether you rooted the device correctly.
If still no luck, try installing a custom ROM such as Cyanogen Mod in order for 'adb root' to work.
You need to replace the adbd binary in the boot.img/sbin/ folder to one that is su capable. You will also have to make some default.prop edits too.
Samsung seems to make this more difficult than other vendors. I have some adbd binaries you can try but it will require the knowledge of de-compiling and re-compiling the boot.img with the new binary. Also, if you have a locked bootloader... this is not gonna happen.
Also Chainfire has an app that will grant adbd root permission in the play store: https://play.google.com/store/apps/details?id=eu.chainfire.adbd&hl=en
Lastly, if you are trying to write a windows script with SU permissions you can do this buy using the following command style... However, you will at least need to grant (on the phone) SU permissions the frist time its ran...
adb shell "su -c ls" <-list working directory with su rights.
adb shell "su -c echo anytext > /data/test.file"
These are just some examples. If you state specifically what you are trying to accomplish I may be able to give more specific advice
-scosler
adbd has a compilation flag/option to enable root access: ALLOW_ADBD_ROOT=1.
Up to Android 9: If adbd on your device is compiled without that flag, it will always drop privileges when starting up and thus "adb root" will not help at all.
I had to patch the calls to setuid(), setgid(), setgroups() and the capability drops out of the binary myself to get a permanently rooted adbd on my ebook reader.
With Android 10 this changed; when the phone/tablet is unlocked (ro.boot.verifiedbootstate == "orange"), then adb root mode is possible in any case.
If you really need to have ADB running as root, the quickest and easiest way is to install Android Custom ROMs and the most popular is CyanogenMod for it has the Root Access options in developer options menu where you can choose to give root access to apps and ADB. I used CM before but since it wasn't developed anymore, I tried looking for some solutions out there. Although CyanogenMod is still a good alternative because it does not have bloatware.
One alternative I found out from a friend is using adbd insecure app which you could try from here: https://forum.xda-developers.com/showthread.php?t=1687590. In my case, it works perferct with an Android custom kernel, but not with the Android stock ROM (vanilla android only). You may try other alternatives too like modifying boot.img of the Android ROM.
in my case, ( device is rooted )
linux$ adb shell # in linux shell
mobile$ su root #=> notice the $ will become #
mobile# whoami #=> root
if you installed "adb root" module in Magisk, you still have to manually switch to root by su root, otherwise, it just LOOKS LIKE you are root, but actually you are NOT root.
I have a Samsung Galaxy Tab S2 running Android 7.0.
Here's how I rooted it today:
Root the device using Odin
Read Alex P.'s answer in this thread regarding editing system\build.prop file.
download onto your tablet: v1.3.9 System Tools Android: All-In-One toolbox
run the app; under "System Utilities" confirm your Odin root worked using "Root Check"
in the same app goto "Root Manager" and use the "Build.prop editor" to effect the changes in the system\build.prop (as specified by Alex P.).
Final Confirmation:
C:\Android\sdk\platform-tools>adb shell
gts28vewifi:/ $ whoami
shell
gts28vewifi:/ $ su
gts28vewifi:/ # su root
gts28vewifi:/ # whoami
root
Upvote Alex P.'s answer.
Further info
and here
and here too
Root Access in Windows Command: adb shell su
Root Access in MacOS Command: ./adb shell su
On a Ubuntu 13.10 Linux I am trying to add an Android device to be able to debug it. The device is a 'Vodafone Smart II' (alcatel smart 2 II) and the interesting line of lsusb is as follows:
Bus 002 Device 006: ID 18d1:0002 Google Inc.
I therefore added the following line to the file /etc/udev/rules.d/51-android.rules according to some similar posts found on the web and on SO:
SUBSYSTEM=="usb",SYSFS{idVendor}=="18d1",MODE="0666",GROUP="plugdev"
Then I change file permissions, reloaded the table and tried again with no success:
> sudo chmod a+r /etc/udev/rules.d/51-android.rules
> sudo service udev reload
> adb devices
List of devices attached
???????????? no permissions
I also tried to reconnect the device, and to leave out the SYSFS part and the GROUP part as well. But I always get a list of question marks.
How can I properly add this device to Linux for debugging?
Relaunch adb daemon as root. Simply go to android-sdk/platforms-tools via shell and type:
sudo adb kill-server
sudo adb start-server
It should work correctly from that moment.
I am currently using RHEL 5 and need to connect my Nexus 4 to my PC with USB debugging enabled (done) so that I can run my android projects directly on the phone rather than the emulator which is very slow and painfully time consuming. I have updated my Android SDK manager and noticed that I did not find any Google USB drivers as those available in Windows. Some more Googling and I came across some steps to be followed to accomplish this in Ubuntu:
1. sudo lsusb
2. get the two hex values sepearetd by a ':'(This is the manufacturerID:deviceID you need to tell the system to handle)
3. Then as root, do the following:
sudo su -
cd /etc/udev/rules.d
vi 51-android.rules
In this file, add a line that enables you to handle your device. Problem is: I do not have this file in my rules.d folder. So what is the procedure for making my device recognizable in any other linux distro (in my case RHEL 5).
Also, when I do this :
adb devices
output:
List of devices attached
???????????? no permissions
Please Help. Thanks in Advance :)
You can change the permissions of adb executable to be able to access usb.
Try first, if adb works properly, when using it with root permission:
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb devices
If you do not have 'sudo' installed on your system, just do the operations above with the root user. If it works, you can use the following workaround to make it work permanently:
chown root:user_group adb
chmod 4550 adb
After this it should work.
You'll have to create the file from scratch and insert the line, otherwise it won't work.
Follow the instructions that you have found and you are safe.
The adb devices will show your device properly if you follow the steps.
I've run into this problem too, when using RHEL/CentOS 6.6, where no plugdev group is present.
I run adb with unprivileged user account myuser.
My solution was to create the /etc/udev/rules.d/50-android.rules file with the rules:
# udev rules for USB android devices
# samsung: 04e8
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="myuser"
# LG: 1004
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="myuser"
After which I did (as root):
udevadm control --reload-rules ; udevadm trigger
and then, as myuser:
adb kill-server
adb devices -l
The explanation: the GROUP= option in the udev rules file specifies the group which will own the device when plugged in. In Debian-based distributions there is a plugdev group which fulfills this purpose, but some newer RHEL-based distros don't have it. This creates a permissions problem when adb is run with a regular (non-root) user, since it won't have access to the devices.
The solution is to assign the USB devices to a group which exists, and to which your linux user belongs. In my case I chose to assign the device to my user's "personal" group, to which it has the proper permissions.
Another solution (untested, but should work the same) would be to create the plugdev group and add your user to it.
I am on Ubuntu 12.04. And I need to use 'adb shell' to connect to my device on linux:
I get Insufficient permission when running 'adb shell'as myself.
But when I run it as 'root', it works.
How can I fix 'adb shell' so that I don' need to run it as root everytime?
I guess, the problem and solution are the same as in question "adb devices command not working".
In short: you must inform Ubuntu that android device, connected to USB can be used by unprivileged users (that's forbidden by default).
That's even decribed in official Android Developer's Guide: Configuring USB Access, but I prefer a bit simplier 51-android.rules file.
Can You try changing the owner of the file adb ?
sudo chown <usergroup>.<username> adb
This is may work for you!
Adb devices is not listing my Samsung Pop 5570 wen connected in with USB debugging on in ubuntu 10.10
adb devices
?????????? no permissions
i did add the 51-android.rules file in /etc/udev/rules.d folder but still adb devices shows that devices wit ?????? no permissions.
51-android.rules file has the following contents:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="04e8", MODE="0666"
please let me know if i am missing something
I resolved the issue by appending #samsung in the 51-android.rules file and copying the "adb" command to /bin folder.
$ restart udev
$ cp adb /bin
$ sudo adb kill-server
$ sudo adb start-server
$ sudo adb devices
List of devices attached
S5570e905be1c device
Edit: I suspect your subsystem name is the culprit (simply try "usb" instead). However, I am unable to comment as to whether or not that subsystem name is still valid in 10.10 as I do not know what changes have been made to udev.
First step would be to verify that your vendor id is correct with lsusb (that appears to be Samsung's vendor id, but it can't hurt to check).
I am also running 10.10, but I have an HTC device. Here is my rule file's content:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
After editing the file, I unplugged my device. Just in case, I kill adb's daemon:
sudo adb kill-server
I then reconnected my device and executed "adb devices". adb started the daemon without sudo. My device was listed properly.
I resolved the above problem by prefixing the 51-android-rules file with #samsung, i mean,
'#samsung SUBSYSTEM=="usb_device", SYSFS{idVendor}=="04e8", MODE="0666"'.
I killed the adb server and restarted in SU mode and then ran
$sudo adb devices,
i was able to see my device listed.