Closed ghost closed 4 years ago
WSL 2 operates in a lightweight VM and does not have USB pass-through access.
Even if enabled in the Linux kernel, that is still simply inside the VM.
This is a duplicate of #689.
Even if enabled in the Linux kernel, that is still simply inside the VM.
Nope, it "was" somehow possible. See this pull request https://github.com/microsoft/WSL2-Linux-Kernel/pull/45. I tried it once but the compiled kernel did not boot WSL2 VM, maybe I did something wrong.
WSL 2 operates in a lightweight VM and does not have USB pass-through access.
Even if enabled in the Linux kernel, that is still simply inside the VM.
This is a duplicate of #689.
@sirredbeard so for now there’s no way to attach USB devices into WSL?
Generally yes.
There are hacks that use USB over IP but they aren't supported and YMMV.
Even if enabled in the Linux kernel, that is still simply inside the VM.
Nope, it "was" somehow possible. See this pull request microsoft/WSL2-Linux-Kernel#45. I tried it once but the compiled kernel did not boot WSL2 VM, maybe I did something wrong.
Also tried by me. But usbip can’t attach usb devices with WSL. I’m already having a long discussion here- https://github.com/cezanne/usbip-win/issues/149
Generally yes.
There are hacks that use USB over IP but they aren't supported and YMMV.
Bad news.
My issue is solved with USB/IP tool from this repo: https://github.com/cezanne/usbip-win I have compiled kernel 4.19.104 with USB modules and now I can attach USB devices with WSL using USB/IP. My solution goes like this: https://github.com/cezanne/usbip-win/issues/149#issuecomment-622367314
I tried to attach the kinect,using usbip and this is what happened :
root@DESKTOP-N9UN2H3:~/Desktop# sudo ./libfreenect2/build/bin/Protonect
Version: 0.2.0
Environment variables: LOGFILE=
@sirredbeard Any news about the support in default build?
My issue is solved with USB/IP tool from this repo: https://github.com/cezanne/usbip-win I have compiled kernel 4.19.104 [...]
I'm glad it worked for you, but I personally do not think that USB support in WSL2 should require recompiling a custom Linux kernel and installing a prerelease of a Windows kernel driver. This feature should just work out of the box.
I wanted to follow up with this and see if there has been any news of this feature coming by default?
After getting Steam for Linux installed in Ubuntu On Windows, i am interested in this feature request or limitation of WSL2 as well.
Could not help thinking of VirtualHere but have only used android server with non linux clients (mostly remote cloud gaming VMs like Paperspace and Shadow running windows or windows server) and can see VirtualHere has CLI for linux clients at https://www.virtualhere.com/node/955.
Yeah YMMV but am sure a custom kernel and VH can help out for many end user case scenarios in WSL.
The issue is not resolved by usbip because when you install the windows part you have to remove protection, test signature. This could be an attack vector on your machine and could not be accepted on work computer, So we need to have some internal tools to be able to do that. If USB-IP is working correctly why we don't have it available directly by Windows when se enable some additional tools ?
The issue is not resolved by usbip
Well, it would be addressed by USB/IP if USB/IP kernel code was merged into the Microsoft's WSL2 kernel. But you are right, this issue is not fixed and it should not be closed.
Not only the USP/IP kernel code, wee need to have the USP/IP Windows driver available and signed by microsoft to avoid to do: bcdedit.exe /set TESTSIGNING ON because this in not safe as you have to disable the UEFI secure boot to do that.
the problem is deeper,since actually on WSL2 there is no official passthrough for the multimedias USB devices.
But the problem can be fixed with this solution :
onomatopellan commented on 6 May
I found it very easy to use. It's free if you connect 1 device and you use the gui linux version as client.
For the server, just download and run it: https://www.virtualhere.com/sites/default/files/usbserver/vhusbdwin64.exe
For the client (you need an XServer and gtk2):
wget https://www.virtualhere.com/sites/default/files/usbclient/vhuit64 chmod 777 vhuit64 sudo ./vhuit64
After that you can right click -> "Specify the hub" and add YOUR_PC_IP:7575 right click on a device -> Use this device
And that's it. You should see the device with lsusb.
wget https://www.virtualhere.com/sites/default/files/usbclient/vhuit64 chmod 777 vhuit64 sudo ./vhuit64
modprobe: FATAL: Module vhci-hcd not found in directory /lib/modules/4.19.104-microsoft-standard
you should recompile the kernel and u should activate a lot of parameters related to usb. its better if u don't choose to load as modules.but built into the kernel.
you should recompile the kernel and u should activate a lot of parameters related to usb. its better if u don't choose to load as modules.but built into the kernel.
Rebuilding the WSL2 kernel from sources may work, but functionality as basic as USB support should not require it.
it seems that it is required. but I think that depends about the wsl-config file that's used.
The issue is not closed. The title is Attaching an USB device. I'm trying to attach an USB modem and it is not working, It is not supported by VirtualHere so it is not the solution for all USB device.
yes this is not closed and its the most important feature for me
For me too. I can't replace my vm with wsl2.
you can try this : https://www.flexihub.com/download.html
That is not a solution my vm is free. USB sharing was available in WSL1 and not in WSL2.
The absence of USB support makes WSL2 currently unusable for IoT development. Almost all target devices need to connect via USB, mostly USB serial or as a USB flash memory. I would recommend to up the priority of USB support on your feature list. Implementing this (temporarily) via USB over IP would be just fine. But this would need the Linux driver to be pre-compiled into the kernel, either static-linked or as a loadable module being part of the distribution. Likewise for a signed driver at the Windows end.
The absence of USB support makes WSL2 currently unusable for IoT development. Almost all target devices need to connect via USB, mostly USB serial or as a USB flash memory. I would recommend to up the priority of USB support on your feature list. Implementing this (temporarily) via USB over IP would be just fine. But this would need the Linux driver to be pre-compiled into the kernel, either static-linked or as a loadable module being part of the distribution. Likewise for a signed driver at the Windows end.
Totally agree. +1
+1
+1
This is required.
+1
Why are you closing the issue? Without USB support WSL is useless for a majority of potential users.
Why are you closing the issue? Without USB support WSL is useless for a majority of potential users.
The issue was closed by a deleted user. There is no point in arguing with her I'm afraid...
reopen this thread. I'm going to try an experiment and I will post here the result.
+1
+1
+1
+1 came to figure out how to run dd on a usb stick; oh well
+1
WSL 2 operates in a lightweight VM and does not have USB pass-through access.
Even if enabled in the Linux kernel, that is still simply inside the VM.
This is a duplicate of #689.
Not a duplicate, you misunderstand the issue entirely.
+1
+1
+ 1
I would totally love to see this too.
reopen
I would also love to know how to make this possible, have an iot device that I need access to the WSL2 and do not have access to a dedicated Linux machine to complete the work, nor the space for a full VM on my current device.
why was this issue closed?
Looks like it was mentioned in that PR above and probably automatically closed. Definitely needs to remain open.
Looks like it was mentioned in that PR above and probably automatically closed. Definitely needs to remain open.
@impala454 It was closed by the OP, because they got their problem solved using USBIP, so I created a new issue #6210 to keep track of this.
Would like to see this addressed.
I want to attach an USB device (iPhone) with WSL, how to accomplish that? USB device is connected with Windows host. I'm using kernel 4.19.104 and enabled USB support manually by compiling it from source.
Any suggestions regarding above mentioned issues?