M0Rf30 / android-udev-rules

Android udev rules list aimed to be the most comprehensive on the net
GNU General Public License v3.0
1.19k stars 438 forks source link

"no permissions" for fastboot on Debian 12.2 #296

Closed fuyukihidekii closed 11 months ago

fuyukihidekii commented 12 months ago

hi there,

i installed it using the 'automatic install script' and i'm experiencing a similar issue, if not the same, as reported on #293 :

fuyukihidekii@RV415:~$ fastboot devices
no permissions (missing udev rules? user is in the plugdev group); see [http://developer.android.com/tools/device.html]  fastboot

i believe by installing the android-sdk-platform-tools-common package from Debian repositories would solve my issue; instead i prefer help there as i can.

My platform-tools binaries are handled by Android Studio and are exposed on my $PATH, i don't have any other android-related SDK binaries installed or managed outside Android Studio scope.

ADB work without root privileges, either by calling it directly or from $PATH; while fastboot requires special privileges on both ways.

Information about the environment, Android SDK and smartphone models and USB IDs:

OS

``` fuyukihidekii@RV415:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm ```

Android SDK

``` fuyukihidekii@RV415:~$ fastboot --version fastboot version 34.0.5-10900879 Installed as /home/fuyukihidekii/.local/bin/android/sdk/platform-tools/fastboot ``` ``` fuyukihidekii@RV415:~$ adb --version Android Debug Bridge version 1.0.41 Version 34.0.5-10900879 Installed as /home/fuyukihidekii/.local/bin/android/sdk/platform-tools/adb Running on Linux 6.1.0-13-amd64 (x86_64) ```

Smartphone

``` # Market name, platform (board) codename GLOBAL: motorola moto g(60) SKU: XT2135-1, XT2135-2 INDIA: motorola moto g(40) fusion SKU: XT2147-1 Both are codenamed "hanoip" officialy, although during development, the G40F was identified by 'hanoi' while G60 was 'hanoip'. G40F and G60 are the same device with few differences (SIM Slots, NFC, Main camera sensor); i'll ask for someone actually with G40F to report their IDs. For regulatory entities, both are identified as HanoiPlus21. Firmware: Android 12.0 S (Snow Cone V1) Build ID: S2RI32.32-20-9-9-2 ``` ``` *** "lsusb -v" output from BOOTLOADER *** Bus 001 Device 031: ID 22b8:2e80 Motorola PCS Fastboot hanoip S Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x22b8 Motorola PCS idProduct 0x2e80 bcdDevice 1.00 iManufacturer 1 Motorola Mobility LLC. iProduct 2 Fastboot hanoip S iSerial 3 ZF523NM43G bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x0020 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 66 bInterfaceProtocol 3 iInterface 4 fastboot Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 1 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered) ```

Smartphone USB IDs

> NOTICE: I didn't included "BP Tools" and "QCOM" modes as they aren't expected to be used by a 'end-user'. > * "BP Tools" enable the moto-factory-testing mode and the 'CQA Test' suite; > * I'm not aware of the use of "QCOM" mode.

AP Fastboot Flash Mode (BOOTLOADER)

``` [117926.461898] usb 1-5: new high-speed USB device number 31 using ehci-pci [117926.619499] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e80, bcdDevice= 4.14 [117926.619530] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [117926.619541] usb 1-5: Product: Fastboot hanoip S [117926.619549] usb 1-5: Manufacturer: Motorola Mobility LLC. [117926.619558] usb 1-5: SerialNumber: ZF523NM43G ```

ANDROID: Recovery

``` [124644.457362] usb 1-5: new high-speed USB device number 68 using ehci-pci [124644.615600] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e81, bcdDevice= 4.14 [124644.615631] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [124644.615642] usb 1-5: Product: moto g(60) [124644.615651] usb 1-5: Manufacturer: motorola [124644.615659] usb 1-5: SerialNumber: ZF523NM43G ```

ANDROID: MTP

``` *** USB DEBUG DISABLED *** [121597.820649] usb 1-5: new high-speed USB device number 44 using ehci-pci [121597.979081] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e82, bcdDevice= 4.14 [121597.979112] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [121597.979123] usb 1-5: Product: moto g(60) [121597.979131] usb 1-5: Manufacturer: motorola [121597.979140] usb 1-5: SerialNumber: ZF523NM43G ``` ``` *** USB DEBUG ENABLED *** [123827.558465] usb 1-5: new high-speed USB device number 62 using ehci-pci [123827.718308] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e76, bcdDevice= 4.14 [123827.718388] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [123827.718400] usb 1-5: Product: moto g(60) [123827.718409] usb 1-5: Manufacturer: motorola [123827.718417] usb 1-5: SerialNumber: ZF523NM43G ```

ANDROID: Tethering

``` *** USB DEBUG DISABLED *** [122076.131507] usb 1-5: new high-speed USB device number 47 using ehci-pci [122076.291116] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e24, bcdDevice= 4.14 [122076.291147] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [122076.291158] usb 1-5: Product: moto g(60) [122076.291167] usb 1-5: Manufacturer: motorola [122076.291175] usb 1-5: SerialNumber: ZF523NM43G [122076.301358] rndis_host 1-5:1.0 usb0: register 'rndis_host' at usb-0000:00:12.2-5, RNDIS device, ba:48:d1:80:ad:fa [122076.427710] rndis_host 1-5:1.0 enxba48d180adfa: renamed from usb0 ``` ``` *** USB DEBUG ENABLED *** [123913.135974] usb 1-5: new high-speed USB device number 63 using ehci-pci [123913.294344] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e25, bcdDevice= 4.14 [123913.294375] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [123913.294387] usb 1-5: Product: moto g(60) [123913.294395] usb 1-5: Manufacturer: motorola [123913.294404] usb 1-5: SerialNumber: ZF523NM43G [123913.304230] rndis_host 1-5:1.0 usb0: register 'rndis_host' at usb-0000:00:12.2-5, RNDIS device, 5e:7d:18:34:26:d3 [123913.452845] rndis_host 1-5:1.0 enx5e7d183426d3: renamed from usb0 ```

ANDROID: MIDI

``` *** USB DEBUG DISABLED *** [122192.644272] usb 1-5: new high-speed USB device number 48 using ehci-pci [122192.803497] usb 1-5: New USB device found, idVendor=18d1, idProduct=4ee8, bcdDevice= 4.14 [122192.803530] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [122192.803541] usb 1-5: Product: moto g(60) [122192.803550] usb 1-5: Manufacturer: motorola [122192.803558] usb 1-5: SerialNumber: ZF523NM43G [122193.242746] usbcore: registered new interface driver snd-usb-audio ``` ``` *** USB DEBUG ENABLED *** [124005.557017] usb 1-5: new high-speed USB device number 66 using ehci-pci [124005.715548] usb 1-5: New USB device found, idVendor=18d1, idProduct=4ee9, bcdDevice= 4.14 [124005.715578] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [124005.715590] usb 1-5: Product: moto g(60) [124005.715598] usb 1-5: Manufacturer: motorola [124005.715607] usb 1-5: SerialNumber: ZF523NM43G ```

ANDROID: PTP

``` *** USB DEBUG DISABLED *** [122249.730906] usb 1-5: new high-speed USB device number 49 using ehci-pci [122249.889523] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e83, bcdDevice= 4.14 [122249.889553] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [122249.889564] usb 1-5: Product: moto g(60) [122249.889573] usb 1-5: Manufacturer: motorola [122249.889581] usb 1-5: SerialNumber: ZF523NM43G ``` ``` *** USB DEBUG ENABLED *** [124129.945103] usb 1-5: new high-speed USB device number 67 using ehci-pci [124130.105247] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e84, bcdDevice= 4.14 [124130.105277] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [124130.105288] usb 1-5: Product: moto g(60) [124130.105297] usb 1-5: Manufacturer: motorola [124130.105306] usb 1-5: SerialNumber: ZF523NM43G ```

ANDROID: no-file-transfer

``` *** USB DEBUG DISABLED *** [120256.167001] usb 1-5: new high-speed USB device number 38 using ehci-pci [120256.326434] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e82, bcdDevice= 4.14 [120256.326465] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [120256.326476] usb 1-5: Product: moto g(60) [120256.326485] usb 1-5: Manufacturer: motorola [120256.326493] usb 1-5: SerialNumber: ZF523NM43G ``` ``` *** USB DEBUG ENABLED *** [123692.099075] usb 1-5: new high-speed USB device number 61 using ehci-pci [123692.261823] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e81, bcdDevice= 4.14 [123692.261854] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [123692.261866] usb 1-5: Product: moto g(60) [123692.261874] usb 1-5: Manufacturer: motorola [123692.261883] usb 1-5: SerialNumber: ZF523NM43G ```

If you need, I can provide the data from "BP" and "QCOM" modes and `lsusb -v` for all, listed there.

Originally posted by @fuyukihidekii in https://github.com/M0Rf30/android-udev-rules/issues/293#issuecomment-1820090035

JoesCat commented 12 months ago

Thanks @fuyukihidekii for making a seperate issue, sometimes issues appear similar, but end-up requiring different solutions, and one problem may complete, while another still hangs waiting. Let's see what we have here.

What model of mobile phone, or android device are you using? I bet it's not the same as the Motorola mentioned in #293 :-)

I assume you are using Debian 12.2 ?

On the command line, please run the command lsusb after you have plugged-in your android phone/device. We should see something like this:

[me@mycomputer ~]$ lsusb
Bus 001 Device 005: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode)
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[me@mycomputer ~]$ 

If you do not see something sort of like this, you may need to try another USB cable, or try a slower USB connection on your PC, since the USB may be too-fast for your mobile/android/device - so try on a USB1, or USB2 plug if you are having problems on a fast USB connection, like USB3 or faster.

So? what did you see for lsusb?

fuyukihidekii commented 12 months ago

All relevant info, including lsusb -v is listed under my first comment.

JoesCat commented 12 months ago

Sorry about that, I did not realize those little triangles were expandable. Your message is the first time I've seen this. Impressive. This is new to me. :-)

Looking at the information contained, it looks like you know plenty about the topic - sorry about that. I thought you were a newbie hijacking the other issue and asking a question - which is why I asked if you can ask in another issue.

i believe by installing the android-sdk-platform-tools-common package from Debian repositories would solve my issue; instead i prefer help there as i can.

Looking at the above URL, debian's latest sdk is at 28.0, which is from 2018, while you have 34.0 right now, which is the most recent version. Also, your smartphone is running android 12, which was released in 2021. I think you are better off where you are now, and not go backwards to an older tool that might not work well with your phone.

Please ensure that you added yourself to the plugdev group

Checking the older release, and this latest release, looks like I made an error with 51-android.rules. Can you change this line at approx line 516 from "fast" to "adbfast":

 ATTR{idProduct}=="2e33", GOTO="adbmtp"
 ATTR{idProduct}=="2e51", GOTO="adbmtp"
 ATTR{idProduct}=="2e76", GOTO="adbmtp"
-ATTR{idProduct}=="2e80", GOTO="fast"
+ATTR{idProduct}=="2e80", GOTO="adbfast"
 ATTR{idProduct}=="2e81", GOTO="adb"
 ATTR{idProduct}=="2e82", GOTO="mtp"
fuyukihidekii commented 12 months ago

Checking the older release, and this latest release, looks like I made an error with 51-android.rules. Can you change this line at approx line 516 from "fast" to "adbfast":

 ATTR{idProduct}=="2e33", GOTO="adbmtp"
 ATTR{idProduct}=="2e51", GOTO="adbmtp"
 ATTR{idProduct}=="2e76", GOTO="adbmtp"
-ATTR{idProduct}=="2e80", GOTO="fast"
+ATTR{idProduct}=="2e80", GOTO="adbfast"
 ATTR{idProduct}=="2e81", GOTO="adb"
 ATTR{idProduct}=="2e82", GOTO="mtp"

I confirm it is working after applying this change. ADB functionality remains working.

Debian 12:

[main] and [backports] repositories ships SDKs ranging from 28 to 33 - both with the downstream rules from SDK 28.

[non-free] repo has the package google-android-platform-tools-installer providing upstream binaries and rules, which includes the error on 2e80 product.

Looking at the above URL, debian's latest sdk is at 28.0, which is from 2018, while you have 34.0 right now, which is the most recent version. Also, your smartphone is running android 12, which was released in 2021. I think you are better off where you are now, and not go backwards to an older tool that might not work well with your phone.

Since android-sdk-platform-tools-common provides only UDEV rules, it should be safe to use with platform-tools upstream releases.

fuyukihidekii commented 12 months ago

Additional info:

i'm a member of both groups, created by 'auto installer' and required by Android SDK:

root@RV415:~#  getent group adbusers
adbusers:x:1001:fuyukihidekii
root@RV415:~#  getent group plugdev
plugdev:x:46:fuyukihidekii

After applying the change on 2e80 product, i reloaded UDEV with:

root@RV415:~# udevadm control --reload-rules
root@RV415:~# systemctl restart systemd-udevd.service
JoesCat commented 12 months ago

Thank you for the added information about debian 12, when I saw sid at only 28.0, I thought that was as far as it went.

I'm not 100% sure, but I am guessing your problem is now resolved with fast mode too. If yes, that is great. and thank you for the added information about the Motorola G60 modes - this is additional confidence in having added the right codes to 51-android.rules for the motorola phones.

fuyukihidekii commented 11 months ago

Yes, it is solved. Thanks.

i'll close as completed.

May this help in future...

> On Android devices, USB IDs and device features may be set-up at runtime, usually during system boot-up operation. > With SU access in-device (not on host machine, i.e your computer), you catch all IDs by analising `.rc` files on device's RAMDISK ("/" - filesystem root) or on other partitions (e.g system, system_ext, product, vendor). > If you can't root your device, there's a plenty of Android system dumps on GitLab and GitHub - given the nature and purpose of these IDs, they are unlikely to change between software updates - so a somewhat "old dump" is still useful. > For reference: [RAMDISK: init.recovery.qcom.rc](https://github.com/M0Rf30/android-udev-rules/issues/296), which is the same as this [file](https://github.com/M0Rf30/android-udev-rules/issues/296). [VENDOR: init.mmi.usb.rc](https://github.com/M0Rf30/android-udev-rules/issues/296) [VENDOR: init.qcom.usb.rc](https://github.com/M0Rf30/android-udev-rules/issues/296) > an example of what it looks like on my device; ``` on init mkdir /config mount configfs none /config mkdir /config/usb_gadget/g1 0770 shell shell write /config/usb_gadget/g1/bcdUSB 0x0200 write /config/usb_gadget/g1/idVendor 0x22b8 write /config/usb_gadget/g1/idProduct 0x2e81 mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} mkdir /config/usb_gadget/g1/functions/ffs.adb mkdir /config/usb_gadget/g1/functions/ffs.fastboot write /config/usb_gadget/g1/os_desc/use 1 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell setprop sys.usb.configfs 1 ``` > Above, it is setting up its "USB stuff" for the Android Recovery Mode, which results in it being detected on host machine as: ``` [124644.457362] usb 1-5: new high-speed USB device number 68 using ehci-pci [124644.615600] usb 1-5: New USB device found, idVendor=22b8, idProduct=2e81, bcdDevice= 4.14 [124644.615631] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [124644.615642] usb 1-5: Product: moto g(60) [124644.615651] usb 1-5: Manufacturer: motorola [124644.615659] usb 1-5: SerialNumber: ZF523NM43G ``` > Altough some props are defined at-runtime, USB ID has a static value, and it is set by the OS as required by the user or boot/desired mode. > I'm not aware of where exactly the BOOTLOADER (AP Fastboot Flash Mode), store or fetch these informations. > Presumably, these are predefined on the source code and build statically; not fetched from the Linux Kernel or either the OS.

JoesCat commented 11 months ago

May this help in future...

Sorry about that, but the first rc file I saw was full of javascript, obscure variables and references to webURLs which were seen as unsafe. I didn't look any further and therefore changed the URLs to those RC files referenced to point back to this issue instead: https://github.com/M0Rf30/android-udev-rules/issues/296 to prevent someone accidentally clicking the links with their browser.

Most users on this site are still better helped using the plain old lsusb. Thanks again for help with the idProduct:idVendor - it was appreciated.