Hello,
I’m experiencing an issue with WSL2 and the graphical interface (WSLg) on Windows 10.
My goal is to run graphical applications (such as the Gazebo simulator) with NVIDIA GPU acceleration inside Ubuntu 24.04 on WSL2.
Both WSL and WSLg are installed and updated, but no graphical applications will launch — commands like xeyes or glxinfo return the following error:
Error: Can't open display:
Error: unable to open display
Even after removing environment variables (DISPLAY, LIBGL_ALWAYS_INDIRECT), the issue persists.
Running wsl --version outputs:
WSL version: 2.6.1.0
Kernel version: 6.6.87.2-1
WSLg version: 1.0.66
MSRDC version: 1.2.6353
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.6725
The GPU is recognized correctly inside WSL — running nvidia-smi shows my NVIDIA GeForce RTX 2050 without errors.
I have already tried:
-
Updating WSL with
wsl --updateandwsl --shutdown; -
Cleaning old configuration lines from
.bashrcand.profile; -
Restarting the system;
-
Testing manual display exports (
DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0), which did not work.
It seems that WSLg is installed but is not launching or creating the display socket, preventing any graphical applications from opening inside Ubuntu.
Could you please help me reinstall or reactivate WSLg properly on Windows 10 so that the Linux subsystem can open graphical windows and use the NVIDIA GPU?
Thank you very much for your assistance.
Best regards,
Lucas Magalhães