很久以前,我通过设置一个组,用我的手机(设备)为adb编写了一个udev规则。一切都很好,直到最近发生了一些变化:
- 设备ROM
- udev数据包
- 亚行数据包
现在我得到了用户:
$ adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: insufficient permissions for device: verify udev rules.
See [http://developer.android.com/tools/device.html] for more information.
$ adb devices -l
List of devices attached xxxxxxx no permissions (verify udev rules); see
[http://developer.android.com/tools/device.html] usb:2-1
$ lsusb
// here we have the mentioned device
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
// udev rules newly added after i received an error (did'd change anything - still error i can open adb only using root)
SUBSYSTEM=="usb", ATTR{idVendor}=="1d6b", MODE="0666", GROUP="adbusers"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", GROUP="adbusers"
// this rule was added very long time ago was working perfect till now
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0666", GROUP="adbusers"
listed now as Bus 002 Device 007: ID 18d1:4ee7 Google Inc.
// 用户属于 adbuser 组
附言。我确实检查了设备上的权限,我得到:
$ ls -l /dev/bus/usb/002/001
crw-rw-r-- 1 root root 189, 128 kwi 22 13:26 /dev/bus/usb/002/001
未应用 udev 规则?
PS2。 1) 启用 udev deug 2) 修改规则+添加符号链接以跟踪 udev 的更改
SUBSYSTEM=="usb", ATTR{idVendor}=="1d6b", MODE="0666", GROUP="adbusers", SYMLINK+="android%n"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", GROUP="adbusers", SYMLINK+="x-android%n"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0666", GROUP="adbusers", SYMLINK+="s-android%n"
设备插入后
Apr 22 18:50:04 et27 systemd-udevd[304]: seq 2437 queued, 'add' 'usb'
Apr 22 18:50:04 et27 systemd-udevd[304]: Validate module index
Apr 22 18:50:04 et27 systemd-udevd[304]: Check if link configuration needs reloading.
Apr 22 18:50:04 et27 systemd-udevd[304]: seq 2437 forked new worker [1143]
Apr 22 18:50:04 et27 systemd-udevd[1143]: seq 2437 running
Apr 22 18:50:04 et27 systemd-udevd[1143]: IMPORT builtin 'usb_id' /lib/udev/rules.d/50-udev-default.rules:13
Apr 22 18:50:04 et27 systemd-udevd[304]: seq 2438 queued, 'add' 'usb'
Apr 22 18:50:04 et27 systemd-udevd[1143]: IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:13
Apr 22 18:50:04 et27 systemd-udevd[1143]: MODE 0664 /lib/udev/rules.d/50-udev-default.rules:41
Apr 22 18:50:04 et27 systemd-udevd[1143]: GROUP 1008 /etc/udev/rules.d/51-android.rules:4
Apr 22 18:50:04 et27 systemd-udevd[1143]: MODE 0666 /etc/udev/rules.d/51-android.rules:4
Apr 22 18:50:04 et27 systemd-udevd[1143]: LINK 's-android1' /etc/udev/rules.d/51-android.rules:4
Apr 22 18:50:04 et27 systemd-udevd[1143]: RUN '/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}' /etc/udev/rules.d/60-vboxdrv.rules:5
Apr 22 18:50:04 et27 systemd-udevd[1143]: PROGRAM 'mtp-probe /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1 2 5' /lib/udev/rules.d/69-libmtp.rules:2283
Apr 22 18:50:04 et27 systemd-udevd[1144]: starting 'mtp-probe /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1 2 5'
Apr 22 18:50:04 et27 systemd-udevd[1144]: failed to execute '/lib/udev/mtp-probe' 'mtp-probe /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1 2 5': No such file or directory
Apr 22 18:50:04 et27 systemd-udevd[1143]: Process 'mtp-probe /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1 2 5' failed with exit code 2.
Apr 22 18:50:04 et27 systemd-udevd[1143]: handling device node '/dev/bus/usb/002/005', devnum=c189:132, mode=0666, uid=0, gid=1008
Apr 22 18:50:04 et27 systemd-udevd[1143]: set permissions /dev/bus/usb/002/005, 020666, uid=0, gid=1008
Apr 22 18:50:04 et27 systemd-udevd[1143]: creating symlink '/dev/char/189:132' to '../bus/usb/002/005'
Apr 22 18:50:04 et27 systemd-udevd[1143]: creating link '/dev/s-android1' to '/dev/bus/usb/002/005'
Apr 22 18:50:04 et27 systemd-udevd[1143]: creating symlink '/dev/s-android1' to 'bus/usb/002/005'
Apr 22 18:50:04 et27 systemd-udevd[1143]: created db file '/run/udev/data/c189:132' for '/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1'
Apr 22 18:50:04 et27 systemd-udevd[1145]: starting '/usr/lib/virtualbox/VBoxCreateUSBNode.sh 189 132 00'
Apr 22 18:50:04 et27 systemd-udevd[1143]: Process '/usr/lib/virtualbox/VBoxCreateUSBNode.sh 189 132 00' succeeded.
Apr 22 18:50:04 et27 systemd-udevd[1143]: passed device to netlink monitor 0x562b37096e00
Apr 22 18:50:04 et27 systemd-udevd[1143]: seq 2437 processed
Apr 22 18:50:04 et27 systemd-udevd[304]: passed 308 byte device to netlink monitor 0x562b37076610
Apr 22 18:50:04 et27 systemd-udevd[1143]: seq 2438 running
Apr 22 18:50:04 et27 systemd-udevd[1143]: IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:15
Apr 22 18:50:04 et27 systemd-udevd[1143]: IMPORT builtin 'usb_id' /lib/udev/rules.d/60-libgphoto2-6.rules:9
Apr 22 18:50:04 et27 systemd-udevd[1143]: unable to access usb_interface device of '/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1/2-1:1.0'
Apr 22 18:50:04 et27 systemd-udevd[1143]: IMPORT builtin 'usb_id' returned non-zero
Apr 22 18:50:04 et27 systemd-udevd[1143]: RUN 'kmod load $env{MODALIAS}' /lib/udev/rules.d/80-drivers.rules:5
Apr 22 18:50:04 et27 systemd-udevd[1143]: created db file '/run/udev/data/+usb:2-1:1.0' for '/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/usb2/2-1/2-1:1.0'
Apr 22 18:50:04 et27 systemd-udevd[1143]: Execute 'load' 'usb:v18D1p4EE7d0232dc00dsc00dp00icFFisc42ip01in00'
Apr 22 18:50:04 et27 systemd-udevd[1143]: No module matches 'usb:v18D1p4EE7d0232dc00dsc00dp00icFFisc42ip01in00'
Apr 22 18:50:04 et27 systemd-udevd[1143]: passed device to netlink monitor 0x562b37096e00
Apr 22 18:50:04 et27 systemd-udevd[1143]: seq 2438 processed
Apr 22 18:50:04 et27 systemd-udevd[304]: cleanup idle workers
Apr 22 18:50:04 et27 systemd-udevd[1143]: Unload module index
Apr 22 18:50:04 et27 systemd-udevd[1143]: Unloaded link configuration context.
Apr 22 18:50:04 et27 systemd-udevd[304]: worker [1143] exited
该组未应用于我得到的设备
$ ls -al /dev/android1
lrwxrwxrwx 1 root root 15 kwi 22 18:42 /dev/android1 -> bus/usb/001/001
$ ls -al /dev/s-android1
lrwxrwxrwx 1 root root 15 kwi 22 18:50 /dev/s-android1 -> bus/usb/002/005
可能是字符串而不是数字组值的问题?或 GROUP="" 代替 GROUP:="" ?如果是这样,为什么 udev 不屈服于此?
- 符号 no 因为符号链接适用于旧符号所以......
- 字符串而不是数字 no,因为它在日志中正确解析为 -> 1008
确定权限已按预期设置 - 因为符号链接未显示权限
$ ls -al /dev/bus/usb/002/001
crw-rw-rw- 1 root adbusers 189, 128 kwi 22 19:04 /dev/bus/usb/002/001
但我还是觉得不够
答案1
我遇到了同样的问题,(用户是plugdev组的成员)我缺少的部分是:
插入设备后,我必须启用 USB 才能进行数据交换(使用 Android 7.1.2)
答案2
好的,找到问题所在:
文件 ~/android 包含一些可能存储调试密钥的文件,这些文件在设备刷新/擦除后会有所不同 - 只需删除它们
确切地说:
~/.android/adbkey
答案3
最好的解决方案,对我来说效果更好的是从 ubuntu 包安装 adb。这为您提供了一组由社区维护的适用于所有 Android 设备的默认 udev 规则。
示例: sudo apt-get install adb