The WSL2 system has for sure improve the development experience on the windows platform in an amazing way. I personally love to run commands and all my development withing the Linux subsystem. This makes this closer to working on the real servers without the need to create a dual booting like the old days or run a docker image that is very resource heavy on my machine.
Docker images definitely have some use and the WSL2 definitely doesn't replace it but it does open a wide variety of tools that you can easily access and play with.
However, as we all know nothing is ever perfect. I recently had some issues when trying to run some testing using cypress that requires GPU to run correctly. WSL2 does not have access to any display out of the box which makes sense since most of it's uses are through the command line.
The way I fixed it was by following these simple steps:
- Fist we need to configure WSL2 to run on your existing GPU. We accomplish this by:
- Opening a WSL 2 console
- Running the following code
export DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0 - Test it by running
echo $DISPLAY - You should see the IP that you system would use from now on.
- Next we need to install an X-server so we can run our graphics.
- Download VcXrsv.
- Install the file.
- Go to the folder where you installed it and run the xlaunche.exe
- Configure VcXrsv
- Select any display option (I personally like the Multiple windows), leave -1 for display numbers so the system chooses and press "Next"
- Select "Start no client" and press "Next"
- Check all the checkboxes and press "Next"
- Here you can save your configuration for faster start up and press "Finish"
- Done!
Now you should be able to run applications that need GPU from you WSL2 console. Hope this helps anyone and happy coding.
Comments