I will preface this answer with the fact that I am a potato when it comes to Linux knowledge. I'm learning, and thanks to WSL2 that's a little easier to do. That being said, the following steps may or may not be correct at the time you read it. I have this same exact camera, with the same Linux distro, on a Windows 10 WSL2 system. I've been unable to get this camera to work because, while the computer could see it, and the Linux distro could see it, the correct drivers were not being installed in my distro out of the box. I never got a /dev/video0 device, but I could see the device in all the normal Linux device places. The two sources I used to fix this are:
Before we continue, please make sure you have installed the following apps on your Windows 10 OS:
Here are the steps I used, as a combination of the above sources:
- Make sure WSL is completely up-to-date by running,
wsl --update. If any updates are available and installed, be sure you shutdown WSL with
wsl --shutdown before continuing.
- If you already have a WSL distribution set up, run
wsl --list --verbose to see a list of them and their status.
- If you already have a WSL distribution you'd like to use, perform the following command to backup your current kernel, where current-distro is the distro of Linux you want to use (default for WSL is Ubuntu, found in previous step), temporary-path is the location to save the TAR backup, and a name for the TAR (default is shown),
wsl --export <current-distro> <temporary-path>\wsl2-usbip.tar
- Now import that same TAR file to be the basis for the new kernel,
wsl --import wsl2-usbip <install-path> <temporary-path>\wsl2-usbip.tar, where install-path is where you want your new distro to be saved and temporary-path is the location and TAR you just made.
- Run the new imported distribution by running,
wsl --distribution wsl2-usbip --user <user>, where user is the username you want to use for this distro (you won't keep using this distro for long, don't worry)
- Once your new WSL2 distro is up and running, you may need to restart the command or terminal window you were using before. Windows Terminal is a good example of where you would need to do this after the import step.
- After restarting your console or terminal, perform the following steps in order and make sure you are performing them in the new wsl2-usbip distro:
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential flex bison libgtk2.0-dev libelf-dev libncurses-dev autoconf libudev-dev libtool zip unzip v4l-utils libssl-dev python3-pip cmake git iputils-ping net-tools -y
sudo apt install dwarves -y
This will install all the dependencies required to complete the kernel build. Dwarves was added as an answer to the potential problem noted at this StackOverflow question. It could be optional for you.
Now, from this point on, you'll need to pay more attention to the commands you issue as a lot of these commands will need you to provide arguments specific to your distro and device components. The following steps are all done in the Linux distro.
uname -r to obtain your current kernel. At the time of this writing, I am using 22.214.171.124-microsoft-standard-WSL2 so I will use that in my commands. You will need to know this so have it available.
- You may end up getting a warning about needing additional tools to complete the process below. If so, perform the linux-tool and update-alternatives steps at the top of the usbipd-win WSL setup section:
sudo apt install linux-tools-virtual hwdata
sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/*/usbip 20
- In your new distro still, issue the following command,
git clone https://github.com/microsoft/WSL2-Linux-Kernel.git
- Followed by,
- And finally,
git checkout <current-kernel>
- Once that's done, run
cp /proc/config.gz config.gz to copy the config.
- Finally, run
mv config .config
The next steps will focus on the config menu for the kernel. The config menu is extremely difficult to navigate as there are a lot of items, some nested, and none in alphabetical order. I'll try to direct you to where an item could be found. I know there's a search option, but I couldn't get it to work.
- All of the menu choices use the arrow keys up and down to navigate the list
- The left and right arrows to change the bottom row selection
- The spacebar makes a selection.
< Exit > does not mean to exit from the entire config unless you're on the Kernel Configuration's main page. Exit from secondary menus will bring you back one level.
- Any selection that has a
---> represents a secondary menu option.
- If the
---> has a selection box before it (
[ ]), the secondary menu for that item will not appear until you select that item.
- Within your distro, and still in the WSL2-Linux-Kernel folder, enter
sudo make menuconfig
Device Drivers ---> near the bottom.
[*] USB support and enter the secondary menu for it.
- Scroll down to
USB Physical Layer drivers and enter its secondary menu.
< > NOP USB Transceiver Driver ->
<M> NOP USB Transceiver Driver
- Go back to the
Device Drivers ---> menu, you'll be able to tell you've backed out by the blue title at the top of the config window.
- Scroll down and select
[ ] Multimedia support ->
[M] Multimedia support and enter its secondary menu.
[ ] Media USB Adapters ->
[*] Media USB Adapters and enter its secondary menu.
< > USB Video Class (UVC) ->
<M> USB Video Class (UVC) and enter its secondary menu (if I recall correctly).
[*] UVC input events device support
- Use the right arrow key to move the bottom selection to the
< Save > button and leave it as .config
If there are any other items you'd like to enable in the kernel, do so now. I went through section 4-4 of this other page, but noticed many of the entries were already built-in. Hence the deprecation of these articles. But they fill in some missing gaps in this process, at least for this webcam, which I hope can save you and others time here. We're almost done now.
Exit all the way back out of the config file by selecting
< Exit > until you're back at your distro.
getconf _NPROCESSORS_ONLN to get a printout of the number of cores you have available.
- Enter the following line, replacing the three
# with the number of processors in the previous step:
sudo make -j # && sudo make modules_install -j # && sudo make install -j #
- Now go make a sandwich or watch a show as this could take a while (providing it doesn't fail).
- After the "make" process finishes, we need to run the following from the
WSL2-Linux-Kernel menu still, the
# character should be replaced by the number from step 1:
sudo make install -j #
Run the following to copy the tools,
sudo cp libsrc/.libs/libusbip.so.0 /lib/libusbip.so.0
Install the usb.ids with
sudo apt-get install hwdata if you haven't already.
Copy the image to a location on our Windows machine,
cp arch/x86/boot/bzImage /mnt/c/Users/<user>/usbip-bzImage being sure to replace
<user> with the root of your Windows 10 profile (must be saved there but don't remember why).
Finally, create a new file in the same directory as your new kernel named
wsl.config and edit it
Inside, add the following, replacing
<user> with your Windows username, again. All slashes should be double.
Providing the config and kernel are both in the root of your profile folder, your distro should boot using that kernel, rather than the original.
To confirm it's working, run
uname -r again from inside the distro. You should now see a
+ added to the end of the kernel. You may notice your computer being a little sluggish. This is due to the make process storing the content in your system memory. You may see the process vmmem running at close to 5GB. To fix this, either restart the terminal window or restart the computer.
I hope this works for you. Pardon any ignorance with the answer process, the Linux process, or the English process. I found this when searching for this problem and I hope that this answer, while late, can help someone going forward.