How to Install usbip
on Debian
The USB/IP is a free and open-source project that provides USB device sharing capabilities over an IP network. It is an incredible project that uses TCP/IP payloads to transmit USB I/O messages over a network.
USB/IP protocol is widely adopted in system including the Linux kernel and WSL support.
Learn how to connect a USB device to a WSL instance in the link below:
https://www.geekbits.io/how-to-connect-a-usb-device-to-wsl-instance/
In this tutorial, we will show you how to install the usbip
tools on your Debian installation. This tutorial will work on any Debian distribution starting from Debian 9 and above.
Install usbip
using apt
To install the usbip
tools on your Debian system, use the apt
command.
Start by refreshing your packages
sudo apt-get update
Next, install the usbip
tools by running the command:
sudo apt-get install usbip
Install usbip
tools - Manual Compile
We can all agree that we love compiling tools manually. It helps us get an idea of what the tool is doing.
Well, unless you face errors and then you’ll hate compiling tools.
Before compiling the usbip
tools, let us ensure we have the dependencies installed. We will require the following dependencies:
- sysfsutils library -
sysfsutils >= 2.0.0
- tcp wrapper library -
libwrap0-dev
- gcc -
gcc >= 4.0
- glib bundle -
libglib2.0-dev >= 2.6.0
- make tools -
libtool, automake >= 1.9, autoconf >= 2.5.0, pkg-config
- libudev API -
libudev
Run the command:
sudo apt-get install sysfsutils libwrap0-dev gcc libglib2.0-dev libtool automake autoconf pkg-config libudev-dev libudev1
The above should download and install the required dependencies.
Download the USB/IP Folder
Next, copy the link below and navigate to Download Github Folder. Paste the link below and create a download link
https://github.com/torvalds/linux/tree/master/tools/usb/usbip
Open the generated link and save the zip file.
Next, unzip the files:
unzip usbip.zip
Navigate into the extracted directory:
cd usbip
Make the files executable:
sudo chmod +x autogen.sh
Run the configure script.
sudo ./autogen.sh
The command will run the configure script and generate the required files. An example output is as shown:
+ autoreconf -i -f -v
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:16: installing './compile'
configure.ac:16: installing './config.guess'
configure.ac:16: installing './config.sub'
configure.ac:15: installing './install-sh'
configure.ac:15: installing './missing'
libsrc/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
Next, compile the tools by running the command:
sudo ./configure
The command will compile the tool. You should see an example output as shown:
Finally, install the tools by running the command:
sudo make install
The command will install the usbip
tools. An example output is as shown:
Once completed, you can start the USB/IP Daemon by running
sudo usbipd -D
The command should start the daemon with an output as shown:
usbipd: info: starting usbipd (usbip-utils 2.0)
usbipd: info: listening on 0.0.0.0:3240
usbipd: info: listening on :::3240
To export a device with a specific busid to other hosts, run the command:
sudo usbip bind --busid <busid>
You can check command usage in the manuals or in the resource below:
https://github.com/torvalds/linux/tree/master/tools/usb/usbip
Uninstall usbip
To remove the usbip
tools, use the package manager as:
sudo apt-get autoremove --purge usbip
Feel free to remove the zip and extracted files from the manual compile.
Conclusion
We hope you enjoyed this tutorial. If you did, feel free to share and leave us a comment below.
If you face any issues, feel free to contact us.