Comment 37 for bug 898003

Revision history for this message
Mauro (mauromol) wrote :

For Trusty, you must compile usbip from sources yourself. I did it a couple of times in Linux Mint 17 (based on Trusty) and Debian 7. Here is what I ended up with:

On the Linux server that will share the USB devices or on any Linux client that will need to access shared devices on other servers:
- download the kernel source: apt-get install linux-source-3.13.0 (replace with your desired kernel version)
- extract the usbip sources from the kernel source tarball (e.g.: /usr/src/linux-source-3.13.0.tar.bz2): they should be under drivers/staging/usbip (or something like that); for instance, extract them to /root/usbip
- find where the file usb.ids from usbutils package is located in your system: apt-file search usb.ids (in my case it's at /usr/share/misc/usb.ids)
- enter /root/usbip/userspace to build the userspace tools:
    ./autogen.sh
    ./configure --with-usbids-dir=/usr/share/misc
    make install
  (replace the usb.ids path as needed)
- if the build fails, you may need some additional libraries; take a look at the README file; for instance, I needed to install libtool (apt-get install libtool)
- the executable files /usr/local/sbin/usbip and /usr/local/sbin/usbipd will be installed, as well as some libraries into /usr/local/lib
- try to run usbip or usbipd to see if they complain about something; if they say some library is missing, try to launch them by preceding with a proper LD_LIBRARY_PATH setting; for instance, you may need to run usbip in this way:
  LD_LIBRARY_PATH=/usr/local/lib; usbip

Until now, we've compiled the userspace tools required to control usbip; then, we need to compile the kernel modules, too. The following is again needed on the Linux server that will share the USB devices:
- the kernel headers are required:
  apt-get install linux-headers-`uname -r`
  cd /usr/src/linux-headers-`uname -r`
  make M=/root/usbip
  (replace the path after M= with the folder where you extracted the usbip sources in the previous steps)
- the kernel modules will be installed in the usbip folder; to load them:
  modprobe usbip-core.ko
  modprobe usbip-host.ko

After you've loaded the kernel modules, type:
usbipd -D

Then, you can start to use the usbip tool to list the attached USB modules and bind them.

If you want to load the kernel modules automatically on system startup:
sudo echo usbip-core >>/etc/modules
sudo echo usbip-host >>/etc/modules

If you want to start the usbipd daemon automatically on system startup, one way to achieve this is to edit /etc/rc.local and add the following line before the line with "exit 0":
/usr/local/sbin/usbipd -D
(remember the LD_LIBRARY_PATH thing, if you determined it's needed)

Please note that if you plan to use Windows clients, you need to try the LATEST compiled binaries, otherwise they will fail to work. When I last used usbip, I had to use some binaries compiled by users posting on the usbip forum, because the one published on the usbip website were outdated and did not work. That's another huge problem with this tool, I think.

Hope this helps someone.