0

I configured vcxsrv on windows 10 and other steps required for GUI to work. Now I typed in gvim command on WSL after around 5-10 mins it showed the following error messages

E233: cannot open display
Press ENTER or type command to continue
E852: The child process failed to start the GUI

Have also added the following line to the .bashrc file
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
If I run the command startxfce4 it just displays the message :
/usr/bin/startxfce4: X server already running on display 172.26.32.1:0 and then freezes
what could be the reason for this? Any ideas how to go about running GUI on WSL2?

sunny
  • 1
  • 2
  • Are you running an Insider Preview build of Windows 11? [Windows 10 does not support what your attempting to do.](https://superuser.com/questions/1676383/how-to-skip-update-to-windows-11-on-windows-insider-program/1676395#1676395) – Ramhound Oct 01 '21 at 12:49
  • I am using windows 10 Home. Little surprising as there are so many articles mentioning how to make it work. like this one - https://medium.com/@dhanar.santika/installing-wsl-with-gui-using-vcxsrv-6f307e96fac0 – sunny Oct 01 '21 at 13:00
  • That article is using a method from before graphical WSL application support was announced. Windows 10 Home is your edition of the version of Windows 10. The single build that supports graphical WSL applications already expired yesterday. Yes; X11 can be used or you can upgrade to Windows 11 to get that graphical WSL support – Ramhound Oct 01 '21 at 14:55
  • Welcome to Super User. I'd encourage you to read [How to ask a good question](https://superuser.com/help/how-to-ask), specifically the "Search, and research". What did you find when you searched for the error? What have you tried so far? This topic has been covered in *many* different questions and answers here and on other Stack sites, so we'd ask you to try those first before asking a new question. Try [this one](https://superuser.com/questions/1580610/how-to-get-firefox-to-run-with-linux-subsystems-for-windows) for starters, but there are many others. Thanks! – NotTheDr01ds Oct 01 '21 at 15:09
  • @Ramhound Keep in mind that Windows 11 will not be an option for many people until they buy new hardware. There are still completely valid techniques (via xrdp or third-party X server) to do so on Windows 10, and that will be needed for some time to come given the Windows 11 hardware requirements. – NotTheDr01ds Oct 01 '21 at 15:14

1 Answers1

0

BTW,I would have put this in a comment (as it is not a complete solution for you) but there isn't enough room in a comment for all of this information.

For starters, you don't run a full window manager as your exported display.

This isn't VNC (it's much better).

WINDOWS vcxsrv is your window manager in this context.

First, skip the fancy export DISPLAY command.. just type it in by hand until you get it working. as in export DISPLAY=<IPADDR_HERE>:0.0

Get that address from windows using the command wsl hostname -I.

Now, add xterm and use it to test if the exported display is working (it has as few dependencies as possible).

Now, use that xterm to try to fire up gvim.

When you get this scenario working, you can go back to trying to automate the functionality.

There is nothing special about using x11 forwarding under WSL1 or WSL2.. you can take the advice from people in Linux forums explaining how to do it.

Señor CMasMas
  • 4,794
  • 1
  • 11
  • 27