How to Get Linux GUI Apps in WSL
In this article
Yes, you can run Linux GUI applications in Windows Subsystem for Linux (WSL) by enabling graphical interface support. This allows you to use desktop Linux apps like Gedit, GIMP, or even development tools with a native-looking interface directly from WSL, integrated into your Windows desktop. To achieve this, you need to install a Linux distribution with WSL support, enable WSLg (which handles GUI forwarding), and optionally install a GUI app to test. WSLg is included in recent Windows 10 and 11 updates, so no third-party tools are required for basic functionality.
What You'll Need
- A Windows 10 (version 21H2 or higher) or Windows 11 PC
- Administrator access to enable WSL and install components
- An installed Linux distribution from the Microsoft Store (e.g., Ubuntu, Debian, or Kali Linux)
- Internet connection for updates and package installations
- Optional: A modern GPU driver (especially for GPU-accelerated apps)
Step-by-Step
- Ensure your Windows version supports WSLg. Open PowerShell as Administrator and run:
wsl --version. If WSLg is supported, the version will be 1.0 or higher. If not, update Windows via Settings > Update & Security > Windows Update. - Install WSL if not already enabled. In PowerShell as Administrator, run:
wsl --install. This command installs WSL, the default Linux distribution (usually Ubuntu), and required components including the virtual machine platform. - If you only want GUI support on an existing WSL setup, ensure WSLg is active by running:
wsl --update. This ensures the latest kernel and GUI components are installed. - Set WSL to version 2 for full GUI support. Run:
wsl --set-default-version 2. This ensures your Linux distribution uses the modern virtualization backend required for GUI apps. - Install a Linux distribution from the Microsoft Store if not already present. Click “Get” on Ubuntu, Debian, or another supported distro. Once installed, launch it once to complete setup and create a user account.
- Open your installed Linux distribution (e.g., Ubuntu) and run:
sudo apt update && sudo apt upgrade -yto ensure all packages are current. - Install a GUI application to test. For example, install the lightweight text editor Gedit:
sudo apt install gedit -y. Alternatively, install x11-apps for basic tools:sudo apt install x11-apps. - Launch the GUI app directly from the terminal. Type:
geditorxeyes(if x11-apps are installed). A window should appear on your Windows desktop, hosted via WSLg. - Verify audio and GPU support if needed. For audio, ensure pulseaudio is running (handled automatically by WSLg). For GPU apps (e.g., OpenGL), install vendor drivers in Windows and confirm support via
glxinfo -Bin Linux after installingmesa-utils. - To launch GUI apps from Windows shortcuts or Start menu, create a batch file or use
wsl geditin Command Prompt or PowerShell.
Common Mistakes
Users often skip updating WSL after installation, which can leave WSLg inactive. Running wsl --update is essential. Another frequent error is using WSL version 1, which does not support GUI apps—always set the default to version 2. Some try to install third-party X servers (like VcXsrv) unnecessarily; WSLg handles this natively. Also, forgetting to install the actual GUI app (e.g., only installing dependencies but not gedit) leads to “command not found” errors. Lastly, running GUI apps from non-updated Windows versions (before 21H2) will fail silently or crash.
Tips
Use lightweight GUI apps like gedit, xclock, or feh for faster testing. For development, consider installing full desktop environments like XFCE or GNOME, though this increases resource usage. You can start a full desktop session via export DISPLAY=:0 && startxfce4 if XFCE is installed. Keep WSL updated regularly using wsl --update to ensure GUI stability. Use Windows Terminal for better integration and tab management when launching GUI apps from the command line.
Troubleshooting
If GUI apps do not launch, first restart WSL with wsl --shutdown in PowerShell, then restart your Linux distribution. Check WSL version with wsl --list --verbose—ensure it shows “Version 2”. If apps open but appear black or freeze, update your GPU drivers in Windows. If you get “cannot open display” errors, verify that $DISPLAY is set by running echo $DISPLAY in Linux; it should return :0. If not, export it manually: export DISPLAY=:0. If audio doesn’t work, ensure Windows audio is functional and WSL is not muted in Windows volume mixer. For OpenGL issues, install mesa-utils and test with glxgears. If WSLg is missing entirely, reinstall WSL components using wsl --install or via the “Manage optional features” settings in Windows.
Frequently Asked Questions
Does WSL GUI support work on Windows 10?
Yes, but only on Windows 10 version 21H2 and later with WSLg enabled via update. Earlier versions require manual X server setup.
Do I need to install an X server manually?
No. WSLg includes a built-in X server and audio daemon. Manual X servers like VcXsrv are not needed and may conflict.
Can I run full Linux desktop environments?
Yes. You can install XFCE, GNOME, or KDE, then launch them with startxfce4 or similar commands, though performance varies.
Are GPU-accelerated apps supported?
Yes. OpenGL and Vulkan apps work if your Windows GPU drivers support WSL GPU acceleration. Install mesa-utils to test.
Why does my GUI app crash or not display?
This often results from outdated WSL, incorrect version (v1 instead of v2), or missing app installation. Update WSL and confirm version 2 usage.
Can I access Windows files from Linux GUI apps?
Yes. Files in /mnt/c are accessible. Open them directly in GUI apps like Gedit by navigating to the mounted path.