Score:3

"usbipd not found for kernel" when using USB/IP with WSL

gf flag

I am trying to attach a USB device to my Ubuntu 20.04 distribution running under WSL2.

The problem is that when I run the usbip command, it gives the following message:

WARNING: usbipd not found for kernel 5.10.16.3-microsoft

  You may need to install the following packages for this specific kernel:
    linux-tools-5.10.16.3-microsoft-standard-WSL2
    linux-cloud-tools-5.10.16.3-microsoft-standard-WSL2

  You may also want to install one of the following packages to keep up to date:
    linux-tools-standard-WSL2
    linux-cloud-tools-standard-WSL2

I tried doing:

$ sudo apt install linux-tools-5.10.16.3-microsoft-standard-WSL2

... but that doesn't work. It returns the following:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-tools-5.10.16.3-microsoft-standard-WSL2
E: Couldn't find any package by glob 'linux-tools-5.10.16.3-microsoft-standard-WSL2'

I have been Googling how to install them, but I can't find anything about this.

NOTES:

  • Ubuntu installation has been installed around 2 months ago.
  • I am using WSL2
  • uspip is called by usbipd wsl attach -b 2-2 from PowerShell because I am trying to attach a USB device to Ubuntu
  • Kernel version 5.10.16.3-microsoft-standard-WSL2
Score:5
vn flag

From the WSL2 USB/IP Prerequisites, you'll need the WSL2 5.10.60.1 kernel or higher. That's the first release that added USB/IP support.

Assuming that you are running Windows 11, you can simply wsl --update from an Administrator PowerShell in order to pull in the latest. Then wsl --shutdown and restart.

You could also build your own from the WSL2 kernel sources (making sure to specify the WSL2 kernel config options), but most people won't need to go this route.

Note that if you are running Windows 10, different directions will apply.

Continue following the directions on the previously linked doc, and you'll see that the packages you need installed are:

sudo apt install linux-tools-5.4.0-77-generic hwdata

Finally, sudo visudo per the instructions to add the correct /usr/lib/linux-tools/5.4.0-77-generic directory to the beginning of the sudo secure_path.

At that point, the PowerShell usbipd wsl attach should work.

comand100vip avatar
gf flag
I used undocumented method and it works from inside of Ubuntu, but suddenly it doesn't work with PowerShell, I want ask where are linux-tools installed? PS: I am using Windows 10
NotTheDr01ds avatar
vn flag
@comand100vip Ah, that's a good point. I'll take out that "undocumented" part, since that won't work with the `usbipd` command in PowerShell (I run it all manually). You'll need to `sudo visudo` and add `/usr/lib/linux-tools/5.4.0-77-generic` to the beginning of the `secure_path`.
comand100vip avatar
gf flag
Almost, but after asking for password (in powershell) it prompts: `libusbip: error: udev_device_new_from_subsystem_sysname failed usbip: error: open vhci_driver usbipd: error: Failed to attach device with ID '2-2'.` Edit: I want note that I heard that windows "disconnect" sound.
NotTheDr01ds avatar
vn flag
@comand100vip Hmm. So just to make sure I've got the right understanding -- `sudo usbip attach ...` works from inside Ubuntu, but `usbipd wsl attach ...` from Administrator PowerShell asks for a password, then gives that error?
comand100vip avatar
gf flag
Yes, (it ask for password in both scenarios) and I really don't know why.
NotTheDr01ds avatar
vn flag
@comand100vip Well the `sudo` version I expected to ask for a password. The Admin/PowerShell one I didn't. I kind of expected that it would launch using `wsl -u root` to avoid the password, but as I thought about it further (when you said it asked for a password), `wsl -u root` would bypass the `sudo` `secure_path`, so I guess I understand the password request. That said, I don't have a good way to test this myself at the moment. I can try to get a test instance set up on my older Windows 10 system, but that may take a bit. Let me know if you find out anything further in the meantime.
comand100vip avatar
gf flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/132746/discussion-between-comand100vip-and-notthedr01ds).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.