-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 still results in "Error: Cannot open display" when running an x app #8791
Comments
I never set the display variable, since $HOSTNAME:0 didn't work. Instead, I read that you can use the ip command to get the ip number through awk: export DISPLAY=$(ip route list default | awk '{print $3}'):0 This is now in my ~/.bashrc Now that I have this, the error message is finally gone, but I still have no window using basic X-window commands like xclock or xload, etc. |
@PaulEJKing Do you have an X server installed in Windows? WSL in Windows 10 does not support GUI applications (while Windows 11 does through WSLg). You have to either install a third-party X server or XRDP. You don't mention having installed a third-party X server, so I'm assuming you don't have one. See the answers on this Super User question for details.
Personally, I prefer mDNS, since it's so much easier. You should be able to use:
... where
While you do need to open a firewall rule for the X server, this is most easily done if Defender is running when you initially attempt to connect to the X Server (which I'm assuming you still need to install). The first time you connect, you'll see the standard Defender popup asking if you want to allow the connection. The connection must be allowed on the "Public" network profile since WSL2's network switch is in that profile. Once you allow the connection, the appropriate rules will be created for the application (such as VcXsrv). Note, if you choose the XRDP option, it's a bit slower, but easier. It doesn't require any additional firewall rules, nor does it require you to set the |
The upshot is that I don't have X11 server installed, but what is worse, Microsoft Store isn't working. I am going to reboot and see if I can repair the installation. |
@NotTheDr01ds THanks for your advice. I have since installed VcXsrv, and now am having different issues in getting wsl to recognize it. With vcxsrv, I can run xclock and such, but not from wsl. Instead they are from the provided menus given by vcxsrv. How do I know what host IP to add to .Xauthority? I have also made several guesses as to what IP to give to $DISPLAY. I have tried localhost:0, my_hostname.local:0. Am I right in setting the Xauthority IP to the same IP as $DISPLAY? My command that I use to run vcxsrv is Paul |
I have also found to my surprise that my Cygwin installation seems to be making better use of VcXsrv, since without Cygwin's X running, I can issue X window apps from the Cygwin command line, and the apps show up on the desktop, which is also used by Cygwin. VcXsrv uses localhost for the desktop IP. But when I set wsl's shell to that, I get an error message: Error: Can't open display: 127.0.0.1:0.0 |
if you use core i chip of F series(core i5-9400F), you must install GPU (ubutun version must be 20.04 or later) |
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request. Thank you! |
1 similar comment
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request. Thank you! |
I am running windows 10 version 10.0.19044.1889, and am running the default Ubuntu distro.
I have set up "Virtual Machine Platform" and "Windows Subsystem for Linux" in the control panel as recommended by the Microsoft docs. The x11-apps package is installed. But it seems no matter what I do, the error is persistent. The computer I am installing WSL on is an Acer Spin 3 laptop with touchscreen.
I get the error trying to run commands like xclock, xcalc, and any other basic X-Windows command.
I am running ESET NOD32 as a firewall, and Defender is disabled. I am suspicious that it might be the firewall.
Any help would be appreciated.
Paul
The text was updated successfully, but these errors were encountered: