microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.4k stars 819 forks source link

Enable USB mass storage in kernel #11193

Open 7wells opened 8 months ago

7wells commented 8 months ago

Is your feature request related to a problem? Please describe. After following the instructions at https://github.com/dorssel/usbipd-win/wiki/WSL-support it is still impossible to mount the device to the WSL2 distro's filesystem.

Describe the solution you'd like If the kernel had USB mass storage enabled, the problem would be solved AFAIK.

Describe alternatives you've considered None

Additional context For USB mass storage support, in drivers/usb/storage: USB_SUPPORT [=y] USB_STORAGE [=y]

For NBD support (to run qemu with image), in drivers/block: BLK_DEV_NBD [=y]

References: https://www.reddit.com/r/bashonubuntuonwindows/comments/17chaed/how_to_mount_usb_device_after_installing_usbipdwin/ https://behind.flatspot.pictures/the-ultimate-wsl2-setup/#custom-kernel

Thanks for your kind consideration!

elsaco commented 8 months ago

@7wells you didn't specify a kernel version. In 5.15.146.1 some options are enabled already:

elsaco@texas:~$ zgrep USB_SUPPORT /proc/config.gz
CONFIG_USB_SUPPORT=y
elsaco@texas:~$ zgrep BLK_DEV_NBD /proc/config.gz
CONFIG_BLK_DEV_NBD=m

Only USB_STORAGE is not set. That could be built as a module, too. Notice how latest WSL kernels support module loading/unloading.

Even with USB_STORAGE enabled you won't be able to mount/unmount USB drives in WSL. The only option available is USB over IP.

7wells commented 8 months ago

Thank you so much! Indeed I failed to first check what the current version has enabled. I will check the USB over IP possibility you kindly mentioned.

I guess my question can be closed, right?