Usbip troubleshooting - libusbip: error: no available usb controllers

I've been fighting with usbip over the past few days between two devices running OpenWrt 22.03.2. I've overcome a lot of hurdles but there is one last one that I can't seem to rule out is usbip just being broken. I found a scant few guides online to get it setup, none of them really dig into troubleshooting. The only post I found with this specific error basically says "version mismatch between the client and server," which is not the case here.

This Linux Magazine Tutorial - USB/IP seemed pretty complete, most of the articles, and main project docs seem pretty similar. I've got it to the point where I've got the server side bind completely successfully, and I can list the device from the client, but I only get errors when I attempt to attach. The story is similar when I run the attach locally, but I don't need it to work there.

root@sophos:~# usbip list -r 192.168.42.5
Exportable USB devices
======================
 - 192.168.42.5
        1-1: Realtek Semiconductor Corp. : unknown product (0bda:8771)
           : /sys/devices/platform/ahb/1b000000.usb/usb1/1-1
           : Wireless / Radio Frequency / Bluetooth (e0/01/01)

root@sophos:~# usbip --debug attach -r 192.168.42.5 -b 1-1
usbip: debug: usbip.c:129:[run_command] running command: `attach'
libusbip: debug: vhci_driver.c:269:[usbip_vhci_driver_open] available ports: 16
libusbip: debug: vhci_driver.c:281:[usbip_vhci_driver_open] available controllers: -1
libusbip: error: no available usb controllers
usbip: error: open vhci_driver

The problem indeed seems to be related to the the available controllers: -1. I think I see a controller or two. I'm pretty sure there was only one vchi_hcd device until I installed kmod-usb-ohci because I saw a post here regarding a missing dependency.

root@sophos:~# lsusb | grep vhci
Bus 002 Device 001: ID 1d6b:0002 Linux 5.10.146 vhci_hcd USB/IP Virtual Host Controller
Bus 003 Device 001: ID 1d6b:0003 Linux 5.10.146 vhci_hcd USB/IP Virtual Host Controller

The ultimate goal here is go get a remote Bluetooth adapter in a networked outbuilding available to a Docker image running Home Assistant on the main 'Sophos' router. If there is a better way to do this between two OpenWrt devices, such as sharing hci0 over network or whatnot, I'm happy to pursue that instead.

Thanks!

I found a little something more. Not sure why I didn't look at the logs previously. I'm now noticing the device seems to reset when usbip attach command is run.

Wed Feb  8 22:14:46 2023 kern.info kernel: [431651.905817] usbip-host 1-1: stub up
Wed Feb  8 22:14:46 2023 kern.err kernel: [431651.913847] usbip-host 1-1: recv a header, 0
Wed Feb  8 22:14:46 2023 kern.info kernel: [431652.067193] usbip-host 1-1: reset full-speed USB device number 2 using ehci-platform
Wed Feb  8 22:14:46 2023 kern.info kernel: [431652.270978] usbip-host 1-1: device reset

I might run out there and try and stick a USB hub inline between the AP and Bluetooth dongle. I've had issues in the past with directly connected devices on USB that shimming in a hub has fixed, mainly apsupsd, but worth a shot.

USB hub did not fix it. I also added another device, an RTL-SDR stick.

Bus 001 Device 003: ID 0bda:2838 Realtek RTL2838UHIDIR

I'm going to try and install usbip on another OpenWrt device and see if maybe it's the Buffalo specifically. Please let me know if you have any ideas!

I installed usbip and all the fixins on a GL.iNet GL-MT1300 (Beryl). Same exact behavior when binding USB devices, it all seems to be going well until a device

root@beryl:~# usbip list -l
 - busid 1-1.1 (0bda:2838)
   Realtek Semiconductor Corp. : RTL2838 DVB-T (0bda:2838)

 - busid 1-1.2 (0bda:8771)
   Realtek Semiconductor Corp. : unknown product (0bda:8771)

root@beryl:~# usbip bind -b 1-1.1
usbip: info: bind device on busid 1-1.1: complete

root@beryl:~# logread -f
### attach command below run remotely
Sun Feb 19 15:27:01 2023 kern.info kernel: [  848.496567] usbip-host 1-1.1: stub up
Sun Feb 19 15:27:02 2023 kern.err kernel: [  848.545469] usbip-host 1-1.1: recv a header, 0
Sun Feb 19 15:27:02 2023 kern.info kernel: [  848.647396] usbip-host 1-1.1: reset high-speed USB device number 4 using xhci-mtk
Sun Feb 19 15:27:02 2023 kern.info kernel: [  848.792405] usbip-host 1-1.1: device reset
Sun Feb 19 15:27:45 2023 kern.info kernel: [  892.301535] usbip-host 1-1.1: stub up

Here is how I'm trying to attach to it from a remote OpenWrt box. I also tried to attach from the other Buffalo device with the same result.

root@sophos:~# usbip list -r 192.168.42.15
Exportable USB devices
======================
 - 192.168.42.15
      1-1.1: Realtek Semiconductor Corp. : RTL2838 DVB-T (0bda:2838)
           : /sys/devices/platform/1e1c0000.xhci/usb1/1-1/1-1.1
           : (Defined at Interface level) (00/00/00)
root@sophos:~# usbip attach -debug -r 192.168.42.15 -b 1-1.1
libusbip: error: no available usb controllers
usbip: error: open vhci_driver

If I get a chance I'll try and find another type of device to bind/export USB to the network and try again.

I'm basically out of ideas, it's really unfortunate it's not working. Please let me know if I missed something obvious.

1 Like

I'll add that I experience the same behavior on two machines.

One x86 and one arm64.

I never did find a solution. I ended up switching over to VirtualHere for the time being.

I did end up investigating via strace and it looks like its a problem with some paths.

anom3,

It's nice to see someone else at least respond with similar issues. It seems like a terribly useful feature in the specific cases when it's needed.

For anyone else interested, I ended up going with ESPHome Bluetooth Proxies as an alternative. Around $10 for an ESP32 off Amazon, flashes over serial port in a web browser, and gives me a remote Bluetooth radio in Home Assistant. It's embarrassing how much time I spent trying to get USBIP working in comparison.

edit : welp i cant really test if this works as debian does not have an aarch64 build, which both of my openwrt routers are based on. if anyone has this issue and a matching arch i would definatly give downloading a deb, extracting it and seeing if it will run a shot.


alright well i have made some progress.

background:

besides my openwrt based routers, i have a debian based mini pc as well serving as a router / iot gateway.

i like to compile my kernel, because well why not... i noticed when i upgraded to 6.1.16 the usbip daemon stopped working there as well.

i am running debian buster, its old, originally kernel 4.9 based.

i took a look in here:

https://packages.debian.org/search?keywords=usbip

and force installed one that matched the 6.1 kernel (2.0+6.1.15-1)... and it started working again.

i am guessing as the kernel changes the usbip / usbipd commands need to be updated + matched to the changes in the kernel... which has not been done with openwrt.

also guessing since the dependencies are fairly close, extracting a matching arch and just running the commands from there should do the trick. ill give it a shot later today and report.

note : my current setup required usbipd on the openwrt end and usbip (client) on the debian end... thats why i have no had a chance to test yet.

Debian does come for arm64 (which doesn't mean that it would boot on your router, for many reasons, but it's there and functional - for more capable ARMv8 hardware).

i tried extracting the binary from the arm64 deb package and was greeted with a "file not found" when trying to execute it.

i did not have time to dig too deep, and in my case i needed to get the debian side working which i did, but maybe its searching for library that does exist? i cleaned up the files so i cannot check again but should have ran it through strace at a minimum to see what was happening.

regardless, someone should post this on github and get the usbip command more inline with the current openwrt kernel.

No one claimed Debian and OpenWrt would be binary compatible, they aren't (glibc vs musl, and much more).

1 Like

edit : the source files for the binary are located in linux kernel under /tools/usb/usbip.

welp there you go.

looks like the source files for the usbip commands will need to be updated.

ill add that i took a look at the usbip homepage... i couldnt find the source files there. they mention "Linux distributions will provide binary packages of usbip." but provide no link to the source files.

i have posted this on github, let see if someone updates it in master.

anom3,

Thanks for picking this up and running it to ground. Hopefully someone can grab the bug and squish it!