DEV Community

Cover image for Using win-usbipd with several distros
Saúl Núñez
Saúl Núñez

Posted on

Using win-usbipd with several distros

Lately, I've been wanting to test postmarketOS, a project with the intention of giving smartphones a longer life, porting Linux to them and keep those devices supported with newer software for longer.

To install it to your device, you can either download a prebuilt image (easiest, only several devices with mostly complete/complete support) or building an image with pmbootstrap (slightly harder), this last one needs a Linux machine. Oh surprise, it also supports WSL! That day I also learnt that there's a tool to do USB over IP to WSL2, win-usbipd.

So I set it up following these instructions and when trying to attach my tablet to WSL from Windows. I ended with this error:

$ usbipd wsl attach --busid 4-2
usbipd: error: The specified WSL distribution cannot be reached via the WSL virtual switch; try restarting the WSL distribution.
Enter fullscreen mode Exit fullscreen mode

The reason for this error is that I also have Docker installed in this machine, and docker sets up it's own distro, which is set as default, not Ubuntu, the distro that I wanted to use. Also Docker seems to have a few networking gotchas.
Do note, I'm running these commands on prompt with administrator privileges.
Looking around with --help, I stumbled upon with the --distribution parameter:

$ usbipd wsl attach --busid 4-2 --distribution Ubuntu-20.04
Enter fullscreen mode Exit fullscreen mode

Note, you can find the name for all the installed linux distros with wsl --list.

Cover photo by Gabriel Heinzer on Unsplash

Top comments (0)