- ManageEngine OpManager: Comprehensive monitoring for on-prem, cloud, and containers - Thu, Mar 23 2023
- Install K3s, a lightweight, production-grade Kubernetes distro - Mon, Mar 20 2023
- VMware NSX Advanced Load Balancer: Installation and configuration - Fri, Mar 10 2023
The latest release of usbipd-win (v1.3.0) includes the following new features and enhancements:
- Adds support for devices with REMOTE_WAKE, useful for Bluetooth devices
- Adds support for selecting device configurations other than the first configuration
- Adds support for WSL 2 on older Windows 10 versions (>= 1903)
- Improves compatibility with certain USB hubs and devices
- Improves device descriptions
- Enhances the performance of device enumeration
- Reduces the installation footprint
Installing usbipd-win
Installation of usbipd-win is straightforward and easy using one of the following:
- An MSI file available for download from the usbipd-win GitHub site
- Using the winget utility and pulling it directly from the winget repository using the command:
winget install --interactive --exact dorssel.usbipd-win
The recommended installation of usbipd-win using the winget command requires the interactive switch to prevent the machine from rebooting unexpectedly. The behavior of the interactive session is identical to downloading the MSI file manually and running the installer.
The installation of usbipd-win creates a firewall rule called usbipd to allow all local subnets to connect to the service. However, this rule can be modified to granularly control access.
You can now open the Windows Services console and see the newly installed USBIP Device Host service listed.
When running the usbipd command line utility without any arguments, it shows all available options.
Listing and sharing USB devices with usbipd-win
Using the usbipd command-line tool, we can list the available USB devices and share them. First, we use the command:
usbipd list
Based on the BUSID presented for a specific USB device, use the following command to share it:
usbipd bind --busid <busid>
Attaching the USB to WSL 2 using usbipd-win
There are supplied commands in the usbipd utility in Windows to automatically connect a USB drive to your WSL instances. I am running WSL 2 with an Ubuntu distribution. You can list the WSL-attached USB devices with the command:
usbipd wsl list
There are a few extra steps you need to perform in your WSL 2 instance per the usbipd Wiki documentation for WSL 2. These include:
sudo apt install linux-tools-5.4.0-77-generic hwdata
Next, add /usr/lib/linux-tools/5.4.0-77-generic to the beginning of secure\_path in the sudoers file.
After performing these steps, I ran into the following error:
"WSL distribution cannot be reached via the WSL virtual switch"
when running the command:
usbipd wsl attach --busid 4-2
However, the workaround in my case, as noted here, was to run the command manually from within the WSL 2 environment. Oddly enough, I was using a Debian variant of Linux that was supposed to work.
sudo usbip attach -remote=192.168.1.234 --busid=4-2
In the command above, the IP address is the IPv4 address of my host workstation running WSL 2. After running the command in the WSL 2 environment, as you can see, the "SanDisk Corp. Ultra USB 3.0" is successfully listed when running the lsusb command.
System requirements
It is supported in Windows 8 client OSes and newer, and Windows Server 2012 and newer operating systems.
Final thoughts
The usbipd-win utility is an interesting way to solve the challenges associated with accessing files on removable media, such as a USB drive. Instead of "jumping through hoops" to have USB access, usbipd-win makes this process very straightforward.
Subscribe to 4sysops newsletter!
As shown in the WSL 2 example, you can easily mount USB storage attached to your Windows host inside your WSL 2 environment. While I ran into a couple of challenges with the implementation, the workarounds were easy.
Nice article. two questions I have:
1. Does the service in Windows auto connect and share the same USB device as was initially setup on reboot?
2. Similar, does usbipd run as a service on Linux and auto connect to the USB device shared on the host? May be missing it but looks like you may have to start it manually each reboot?