I have an issue with mounting a cheap smart watch in #linux: Device is seen by the kernel, but never registered as a storage device /dev/sd*:

usb 1-2: new full-speed USB device number 3 using xhci_hcd
usb 1-2: New USB device found, idVendor=0e8d, idProduct=0002, bcdDevice= 1.00
...
usb-storage 1-2:1.0: USB Mass Storage device detected
scsi host0: usb-storage 1-2:1.0

Ok, the plot thickens. When booting from the Linux Mint USB stick, the USB ports work. But when booting the installed version, USB ports are broken. Why??
So my current working hypothesis is: Live Linux Mint uses kernel 6.14, my installation uses kernel 6.17. This is probably what causes the regression?
So I might want to downgrade the kernel...
#linux #linuxmint
Nope, that was not it. I downgraded to Linux 6.14.0-37, but USB still doesn't work. So it must be something with my installation! But what?
I am onto something: Attaching an OLD Apple keyboard with a USB-C to A adapter WORKS. But all my USB3.x devices do NOT work!
So how do I tell the USB controller to also work with USB3 devices...? Which works on the live thumbdrive!
Yes, so it seems the controller is stuck in EHCI mode, instead of switching to xHCI for USB3 devices. Bummer... how to switch it back...?
Next hypothesis: These are Thunderbolt ports. And if a device connects in Thunderbolt mode (USB3/4), it will not work. Only the old USB1 devices work.
boltctl doesn't show anything, except for the controller. So my guess is that something in the bolt configuration is wonky. There IS a bit of a hint in the dmesg about this:
thunderbolt 0000:06:00.0: device links to tunneled native ports are missing!
So I think I have a workaround. If I do "sudo lsusb -v", the devices start working! Without sudo and without -v nothing happens. It seems sudo lsusb -v does some magic that kickstarts the device detection. What is it and how can I make it happen automatically...?
@root42 Reading all this reminds me of a really weird Thinkpad I had years back. It had Thunderbolt ports and those had really weird compatibility issues with random devices in Linux. But only with the TB ports, the standard USB-C ports were fine. I assume the device you have is an Apple laptop, which most likely has even more undocumented and standard breaking behind the scenes firmware magic built into it as per their style.
@apzpins the Thinkpads used to have messed up controllers. Intel screwed them up and after a certain number of uses they would get bricked. Was the T480s if I remember correctly.
@root42 That's... interesting. Just for fun I opened the lsusb source code and there is actually one place which calls `dumpdev` only when `verblevel > 0` which is increased by `-v` https://github.com/gregkh/usbutils/blob/master/lsusb.c#L3828 Actually the same thing should be happening when you want info of only one device by using `-D` https://github.com/gregkh/usbutils/blob/master/lsusb.c#L3759 I'm not claiming I understand any of this, I just thought it might be easy to see what `-v` does differently.
usbutils/lsusb.c at master · gregkh/usbutils

USB utilities for Linux, including lsusb. Contribute to gregkh/usbutils development by creating an account on GitHub.

GitHub

@root42 Is your USB controller properly listed in `lspci`? And if it is, what kernel options does it use (see with `lspci -s <address of controller> -k`. For example, here's mine:

04:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1
Subsystem: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci

@sebastiaanfranken Seems so:

07:00.0 USB controller: Intel Corporation JHL6540 Thunderbolt 3 USB Controller (C step) [Alpine Ridge 4C
2016] (rev 02)
Subsystem: Intel Corporation JHL6540 Thunderbolt 3 USB Controller (C step) [Alpine Ridge 4C 2016]
Kernel driver in use: xhci_hcd

@root42 Ok, so that's good. Also the fact the proper hcd (xhci_hcd) module is loaded is good. Anything related to it in your system journal? And if you want you can get more output / info with

> sudo lspci -s 07:00.0 -k -v

@sebastiaanfranken First the lspci output
PrivateBin

Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.

PrivateBin
@root42 Check the pins in the connectors. I had a problem like this where in a thumb drive some pins belonging to USB3 were bent / damaged and it would not work in a USB3 port. Although it worked fine in a USB2 port, those 4 pins were not damaged.
@root42 with USB-C it could also be the wrong type of cable.
@robert no. It works in the Live thumbdrive. Only the proper install on the ssd is botched. The ports work fine.
@robert the USB C thumbdrive connects without a cable. It works in the live system, not in the installed system.
@root42 I still have some problemas mounting usb from friends in Ubuntu Focal. Can you believe that?
May it be a permissions issue?
@root42 it sounds like it does not load some usb drivers. But for default usb never seen that happen.
@root42 lack of USB modules for the kernel that boots?
@zeri could be! Which modules are required? Which package do they come in?
@root42 don't know. But that's something it is probably safe to ask a chatbot ... worst case you load a module you don't need. Might also be that there are no modules because a kernel update failed.

@root42 @zeri compare the output of `lsmod` from both kernels.

Capture `dmesg` too.

One or both (sets) should get you on the correct path.

@drscriptt @zeri yes, that’s my plan. Hope to find it’s just a module that’s missing.
@drscriptt So the output of lsmod is very similar on both. I installed an extra Intel sound driver, but that shouldn't interfere with USB, I think.

@root42 try `lsusb` (?) when it’s working.

Maybe add `-v` (?) to see if you can see the driver that’s being used.

@drscriptt the driver is usb-xhci. As expected. Which is also loaded in the broken install…
@root42 some udev rule in the installed version?
@mbpaz maybe…? Would that influence lsusb not showing the attached devices?
@root42 @mbpaz potentially if usb_modeswitch is involved
@cheesefox I have to look that up. My active desktop Linux times have been 15 years ago. Quite a bit has changed since then.
@root42 Does it work with Windows or macOS without needing special drivers?
@dr_laemmerbein Yes, it works fine in macOS as mass storage. No issue. However I just noticed that no other USB mass storage gets detected either. This is on the 2017 13" MacBook Pro. I have tried a USB thumb drive (That I installed Mint off of!) and a card reader with an SD card. No dice. Something is seriously wrong.
@root42 Did you install a kernel update by any chance? Then you might need a reboot to make it work again, I ran into that a few times...
@dr_laemmerbein lots of reboots...
@root42 Maybe you can get some hints by running `dmesg -w` in a terminal as root. This will show you all the kernel events and if you plug in your USB drive you should see some logs related to that. Maybe you'll get an error message or something like that.
@dr_laemmerbein I am doing that. No logs when plugging in USB 3 devices. Zip. Zilch. Nada. That’s the weird thing.
@root42 A USB storage device isn't mapped to /dev/sd*, since those are SATA devices. A USB flash drive reports itself as a SATA disk type so it gets mounted there, but this is probably under `/dev/mmcblk`
@root42 I also had this problem once where the kernel showed the usb drive was plugged in but no /dev/sd* showed up, the problem was the usb kernel modules weren't loaded so 'modeprobe usb' or a similar modeprobe command to that fixed it