adb devices 命令不起作用

发布于 2024-10-29 03:41:17 字数 2289 浏览 6 评论 0原文

我正在运行 Ubuntu 10.10 64 位。我已随 Android 调试桥版本 1.0.26 一起安装了 ia32-libs。

我的问题:

  1. adb devices >>> ????????????没有权限
  2. sudo adb devices >>>> sudo:adb:找不到命令
  3. adb shell>>>>错误:设备权限不足

我想这些都是相关的。这是相关信息。

$ 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

我使用运行 CM6.1 的 root Moto Droid 和运行基于 CM7 的 ROM 的 root G-Tab 得到了相同的结果。

我已查看以下相关帖子:

我尝试了大部分(不是全部)建议,但无法解决我的问题。我没有尝试的事情似乎不合适。我希望得到更多提示,并且我会继续排除故障。

我没有尝试的一件事是编辑/etc/udev/rules.d/70-android.rules。这可能是问题所在吗?我看不出这会如何导致“sudo:adb:找不到命令”。也许我的问题并不都是相关的。无论如何,在这一点上,我认为我需要其他人的一些意见,因为我不相信我有路径问题或其他帖子中讨论的其他常见问题。

编辑:已解决感谢 EboMike 和 RivieraKid。这实际上是两个不同的问题:

  1. 上面的第 2 项(sudo:adb:未找到命令)是通过创建符号链接解决的,如下所示:

    $ sudo ln -s /opt/android-sdk-linux_x86/platform-tools/adb /usr/local/sbin/adb
    

    这使我能够按照 EboMike 的建议进行操作并使用此解决方案 。我的 Moto Droid 需要这样做。 (然而,对于我的 Viewsonic G-Tablet,不需要以 sudo 身份运行 adb。)

  2. 按照 RivieraKid 的建议,通过实施 udev 规则解决了我的其他两项问题(来自此 链接)。

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):

  1. adb devices >>> ???????????? no permissions
  2. sudo adb devices >>>> sudo: adb: command not found
  3. 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:

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:

  1. 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.)

  2. My other two items were resolved by implementing the udev rule as RivieraKid suggested (from this link).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

最好是你 2024-11-05 03:41:18

在我的 Gentoo/Funtoo linux 系统上,我遇到了类似的问题:

我总是得到不正确的设备描述和权限不足:

# sudo ./adb devices
List of devices attached 
????????????    no permissions
# ./adb usb
error: insufficient permissions for device

对我来说有助于 howto
就我而言,我需要添加 udev 规则:

# cat /etc/udev/rules.d/51-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" 

并设置文件系统权限

# chmod a+r /etc/udev/rules.d/51-android.rules

重新插入智能手机后,对手机的访问成功,它现在也出现在 Eclipse 的 Android 设备选择器中:

# sudo ./adb devices
List of devices attached 
3XXXXXXXXXXXXXC device
# sudo ./adb usb
restarting in USB mode

您还必须检查用户的成员身份到 plugdev 组。

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.

几度春秋 2024-11-05 03:41:18

我读过的每个答案都表明SUBSYSTEM==“usb”。然而,我的(也许是古老的)udev 需要将其更改为 DRIVER==“usb”。最后我可以以非 root 用户身份运行 adb 服务器...耶。

查看 udevmonitor --env 的输出以及后面的输出可能会很有启发性

udevinfo -a -p <DEVICE_PATH_AS_REPORTED_BY-udevmonitor>

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>
谁许谁一生繁华 2024-11-05 03:41:18

请注意,像 IntelliJ IDEA 这样的 IDE 往往会启动自己的 adb-server。

即使手动终止服务器并使用 sudo 运行新实例也无济于事,除非您让 IDE 终止服务器本身。

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.

不知在何时 2024-11-05 03:41:18

以 root 身份重新启动 adb 服务器对我有用。看:

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

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
忘年祭陌 2024-11-05 03:41:18

我通过这种方式覆盖系统规则在我的 debian GNU/Linux 系统上解决了这个问题:

mv  /etc/udev/rules.d/51-android.rules /etc/udev/rules.d/99-android.rules

我使用了链接到的文件中的内容:
http:// rootzwiki.com/topic/258-udev-rules-for-any-device-no-more-starting-adb-with-sudo/

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/

一抹苦笑 2024-11-05 03:41:18

HTC One m7 运行新的 Cyanogenmod 11。

手机已连接 USB 并限制我的数据连接。

然后我得到了这个惊喜:

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

解决方案:关闭手机上的网络共享。

cinder@ultrabook:~/temp/htc_m7/2015-11-11$ adb devices
List of devices attached
HT36AW908858    device

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
泅人 2024-11-05 03:41:18

我刚刚遇到了同样的情况,恢复出厂设置对我来说效果很好。

I just got the same situation, Factory data reset worked well for me.

灯下孤影 2024-11-05 03:41:17

我没有尝试的一件事是编辑
/etc/udev/rules.d/70-android.rules。是
这可能是问题所在?

你没有这样做的具体原因是什么?回答这个问题——是的! udev 规则告诉 Ubuntu 你的设备是什么,并允许用户空间工具访问它。

如果不正确遵循说明,您将无法使用 adb。

然而,考虑到这一点,你没有说你正在使用哪个版本的 Ubuntu,但我在 10.10 上遇到了问题 - 如果你需要我发布我的规则文件的内容,请告诉我。

不用担心通过 sudo 运行 adb,你不需要它。 udev 规则中的 MODE="0666" 允许您以任何用户身份访问设备。


编辑:

不要忘记重新加载规则:

sudo udevadm control --reload-rules

编辑#2:

正如 @Jesse Glick 正确指出的那样,如果 adb 已经在守护进程模式下运行,您还需要重新启动它才能正常工作:

sudo adb kill-server

我使用了 sudo在这里,因为这将保证 adb 将被终止,并且这是官方支持的停止服务器的方法。下次使用 adb 时它将自动重新启动,但这次使用了正确的环境。

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.

醉酒的小男人 2024-11-05 03:41:17

您需要以 root 身份重新启动 adb 服务器。请参阅此处

You need to restart the adb server as root. See here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文