If you use Windows Subsystem for Linux 2 (WSL2), you've probably noticed that USB devices do not automatically appear inside your Linux environment. That's by design: WSL2 runs in a lightweight VM, so direct hardware access works differently than it does on a native Linux machine.
The supported way to pass a USB device from Windows into WSL2 is with usbipd-win, a Windows tool that exposes USB devices to WSL over USB/IP.
This guide walks through the setup and shows how to attach, verify, and detach a USB device from WSL2.
This setup is especially helpful for:
- Arduino and other microcontroller boards
- USB serial adapters
- ST-Link / J-Link debuggers
- Smart card readers
- Other developer-focused USB peripherals
Before you start, make sure you have:
- WSL2, not WSL1
- A recent version of WSL
- Windows 11, or the Microsoft Store version of WSL on Windows 10
- A USB device physically connected to your Windows machine
- A WSL kernel version of 5.10.60.1 or later
You can check your WSL version and update it from PowerShell:
wsl --version
wsl --updateMicrosoft's recommended approach uses the open-source usbipd-win project.
Install it with winget:
winget install --interactive --exact dorssel.usbipd-winThis installs:
- The
usbipdcommand-line tool - A Windows service for USB/IP
- Firewall rules needed for local access
If you prefer, you can also install it from the project's GitHub releases page.
Before attaching a device, open your WSL distro once so the WSL2 VM is running:
wslLeave that terminal open.
Open PowerShell as Administrator and run:
usbipd listYou'll see output similar to this:
BUSID DEVICE STATE
1-7 USB Input Device Not shared
4-4 STMicroelectronics STLink dongle Not shared
5-2 Surface Ethernet Adapter Not shared
Find the device you want and note its BUSID.
Still in the Administrator PowerShell, bind the device:
usbipd bind --busid 4-4Replace 4-4 with your actual bus ID.
You only need to do this once per device in most cases. The sharing state is persistent across reboots.
You can verify the device is shared:
usbipd listThe state should now show as Shared.
Now open a regular, non-admin PowerShell window and run:
usbipd attach --wsl --busid 4-4Once attached:
- Windows can no longer use that device while it is attached to WSL
- Any running WSL2 distro can access it
In your Linux shell, run:
lsusbIf the device is attached successfully, it should appear in the output.
If lsusb is not installed, install it on Ubuntu/Debian with:
sudo apt update
sudo apt install usbutilsDepending on the device, you may also see a Linux device node such as:
/dev/ttyUSB0/dev/ttyACM0/dev/hidraw0
For serial devices, this is often the real endpoint your Linux tools will use.
From PowerShell, detach the device:
usbipd detach --busid 4-4After detaching, Windows can use the device again.
This is usually a Linux permissions issue, not an attachment problem. You may need a udev rule so non-root users can access the hardware.
For example, embedded tools like openocd often require matching udev rules.
After updating rules, reload them with:
sudo udevadm control --reloadIf that fails, try:
sudo service udev restartCheck these common causes:
- Your distro is running as WSL2, not WSL1
- WSL is updated:
wsl --update - The device was successfully bound with
usbipd bind - The device is actually attached:
usbipd list - A WSL shell was open before attaching
This is the main exception.
If your goal is to access a USB storage drive, the simplest approach is usually:
- Let Windows mount it
- Access it from WSL under
/mnt/<drive-letter>
Example:
cd /mnt/dMicrosoft also notes that wsl --mount does not currently support USB flash drives or SD card readers.
Usually, no.
Current WSL kernels already support many common development scenarios, including USB serial adapters and flashing embedded boards. You should only need a custom WSL kernel if your hardware depends on a driver that is not already present.
Once usbipd-win is installed, the workflow is straightforward:
- List devices with
usbipd list - Bind once with
usbipd bind --busid ... - Attach with
usbipd attach --wsl --busid ... - Use the device from Linux
- Detach when finished
For most developer USB devices, this is the cleanest and officially documented way to make WSL2 behave more like a native Linux environment.
- Microsoft Learn, Connect USB devices: https://learn.microsoft.com/en-us/windows/wsl/connect-usb
- Microsoft Learn, Mount a Linux disk in WSL 2: https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk
usbipd-winWSL support wiki: https://github.com/dorssel/usbipd-win/wiki/WSL-support