I'm running through the tutorial on: https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#5-install-and-use-a-gui-package

After installing X11 applications I try to follow the tutorial and open xeyes:

xeyes &

I get the following response:

Error: Can't open display
  • 1
    Welcome to Ask Ubuntu! Could you run wsl.exe --version and add the results in an edit to your question? Also, is there any more information in the error? If so, please copy and paste the full message. Thanks! Jan 11, 2023 at 17:25
  • I tried this, but get an error message: --version: command not found However using a different command I can see that I am using WSL2 for Ubuntu, if helpful
    – rh1040
    Jan 13, 2023 at 16:31
  • 1
    Okay, so you are on a somewhat older release of WSL that doesn't support --version, and may not support GUI applications (if you are using Windows 10). See Running GUI apps under WSL and my answer to a similar question for instructions on how to upgrade to the "Store" release of WSL on Windows 10. If that solves it, let me know by clicking the "This solved my problem" in the header. Otherwise, let me know via comment and we'll investigate further. Thanks! Jan 14, 2023 at 5:12
  • I do see that the Ubuntu tutorial includes information on installing WSL from the Store, but you may have already had an older release installed and skipped that part. Jan 15, 2023 at 4:25

4 Answers 4


I had the same problem. What I did was:

  1. close the terminal
  2. re-open a fresh terminal
  3. run wsl --update
  4. relaunch ubuntu ubuntu
  5. run xeyes &

This fixed my problem.

  • 2
    Alas, I tried this and it didn't solve the problem. Thanks very much for the suggestion nonetheless.
    – rh1040
    Jan 13, 2023 at 16:32

Open C:\Users\<username>\.wslconfig

Find the line: guiApplications=false and change it to guiApplications=true. If you can not find the line, add it in the file.

Restart your PC (or just do wsl --shutdown followed by wsl as suggested by @bkakilli).

  • 3
    Thanks. Restarting only the wsl was sufficient for me. wsl -shutdown then wsl. No need to reboot.
    – bkakilli
    Aug 30, 2023 at 20:22
  • Thanks @bkakilli. Worked for me. This should also be an answer.
    – Dilawar
    Nov 25, 2023 at 5:12
  • Yes, this is the exact solution for me. I don't need anything else.
    – Alvin567
    Apr 22 at 22:47

if you use core i chip of F series(core i5-9400F), you must install GPU (ubutun version must be 20.04 or later) see: https://ubuntu.com/tutorials/enabling-gpu-acceleration-on-ubuntu-on-wsl2-with-the-nvidia-cuda-platform#1-overview


I had the same problem yesterday. What fixed it today was:

  1. Upgrading WSL to WSL2 (https://www.scaler.com/topics/linux-terminal-for-windows/)
  2. Installing Xming for Windows (https://sourceforge.net/projects/xming/)

After steps 1 & 2 I still got the "Can't open display" error

  1. Section 4.2 of the following article explains how to set environment variables (https://datacadamia.com/ssh/x11/display)

After confirming the shell (bash in my case), setting the DISPLAY variable with the following command enabled me to get X11 commands (e.g. xclock etc) to display in Xming:

$ export DISPLAY=localhost:0.0

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – sotirov
    Nov 30, 2023 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .