2

I have USBIP installed, and it seems to be working in so much as I list USB devices, but attempts to connect fail. I have tried with the raspberry pi (zero W) configured as server and as client, but neither works.

Setup: Raspberry Pi running Raspbian Stretch Lite from raspberrypi.org (version June 2018).
Desktop system running Ubuntu 16.04 (18.04 also tried with identical results)

My scenario: I want to share a USB device connected to my raspberry pi with my Ubuntu system. I have tested sharing devices between two ubuntu systems, and that works fine, but when it comes to raspbian, I can list the USB devices that are bound with usbip on the raspberry pi from my Ubuntu machine, but I can't connect to any of them.

I have used modprobe to add usbip-core, usbip-host, and vhci-hcd on all machines in question.

I tried the steps listed here, but it looks like the June 2018 kernel and modules are already compiled with the options listed in that answer, and recompiling made no difference.

Like I said, listing files works just fine: from my Ubuntu PC, I run the following, where 10.10.10.139 is the IP address of my PiZeroW

$ usbip list -r 10.10.10.139
Exportable USB devices
======================
 - 10.10.10.139
        1-1: GreenAsia Inc. : unknown product (0e8f:2517)
           : /sys/devices/platform/soc/20980000.usb/usb1/1-1
           : (Defined at Interface level) (00/00/00)


$ sudo usbip --debug attach -r 10.10.10.139 -b 1-1
usbip: debug: usbip.c:141:[run_command] running command: `attach'
usbip: debug: usbip_network.c:199:[usbip_net_recv_op_common] request failed at peer: 1
usbip: error: recv op_common
usbip: error: query

For kicks, I tried the opposite of what I'm trying to accomplish (connect to a USB device hosted by the Ubuntu system from the PiZeroW). This resulted in the following (run from the PiZeroW), where 10.10.10.138 is the IP of my Ubuntu PC.

$ usbip list -r 10.10.10.138
Exportable USB devices
======================
 - 10.10.10.138
        1-1: Alcor Micro Corp. : Multi Flash Reader (058f:6366)
           : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1
           : (Defined at Interface level) (00/00/00)
           :  0 - Mass Storage / SCSI / Bulk-Only (08/06/50)


$ lsmod | grep -P "(usbip|vhci_hcd)"
vhci_hcd               20998  0
usbip_host             15036  0
usbip_core             10550  2 vhci_hcd,usbip_host


$ sudo usbip --debug attach -r 10.10.10.138 -b 1-1
usbip: debug: usbip.c:141:[run_command] running command: `attach'
libusbip: error: udev_device_new_from_subsystem_sysname failed
usbip: error: open vhci_driver
usbip: error: query

As you can see, the modules are all loaded, but I'm still getting errors that don't quite make sense. Is something wrong with the modules that I've added? How can I fix this?

On a separate note: For what it's worth, I dumped Kali Linux on the SD card and installed usbip, and it works like a charm. I'd really like to have this working in Raspbian though.

  • For clarification: Everything worked fine using Kali... without any extra configuration steps. But does not work using Raspbian.... correct? – RubberStamp Sep 1 '18 at 1:57
  • @RubberStamp, that is correct. – b_laoshi Sep 1 '18 at 13:48
  • After finding my Pi Zero W... I finally gave it a shot. I did not encounter any problems. I was able to attach a USB card reader on my Pi Zero W... open files, edit files, save files, unmount inserted SD card, and remount the card with no problems. Perhaps, the udev error is a clue about your particular problem. – RubberStamp Sep 4 '18 at 19:28
  • I was able to duplicate your error message... In your first example, I get the precise same error message if I attempt to attach a local device as a remote device. This would suggest that you had the IP addresses for the remote and local systems reversed... The connection from the Pi Zero (client) to my laptop (server) seems to give the same udev error. I'm still testing that connection scenario. – RubberStamp Sep 4 '18 at 22:53
  • 1
    The RPi Zero W is running Raspbian Stretch... uname -srvmo ... Linux 4.14.62+ #1134 Tue Aug 14 16:58:07 BST 2018 armv6l GNU/Linux ... and the PC is running Debian Buster (Testing at this writing) ... uname -srvmo ... Linux 4.17.0-3-amd64 #1 SMP Debian 4.17.17-1 (2018-08-18) x86_64 GNU/Linux ... The usbip doesn't seem to range limit the remote host. This makes sense I suppose, since the the usbip daemon opens a listening on all interfaces including localhost ... netstat -l -n ... tcp 0 0 0.0.0.0:3240 0.0.0.0:* LISTEN – RubberStamp Sep 5 '18 at 12:26
2

After some consideration and some time away from the problem, I've found my solution. Thanks to RubberStamp's comments on my original post, I discovered that everything worked just fine in Debian Buster.

Ubuntu 18.04 does not have a usbip package, but the executable is included in the linux-tools-generic package. Furthermore, the usbip application provided by this package works when used between two Ubuntu 18.04 systems.

I got everything to work with the Raspberry Pi by removing the linux-tools-*generic packages from my Ubuntu machine and then installing the usbip package for Debian Buster, available here (amd64 architecture). With this package installed, I went through the typical setup that I described in my question above, and I was able to attach from my Ubuntu 18.04 machine to USB devices connected to my Raspberry Pi!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.