Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code remote x11 cant get DISPLAY while connecting to remote server

I use Windows VS code and this extensions "Remote SSH", "Remote X11", "Remote X11 (SSH)" to connect and to get graphics from remote server.

I run VcXsrv, Pageant. X11 forwarding works if I connect with Pageant directly. It even works in VS code terminal if I set "export DISPLAY=localhost:10.0" in remote server. So all works besides Remote X11, it cant set DISPLAY variable, with this log: Failed to get DISPLAY: Error: Invalid cygwin unix socket path

like image 997
razrabochka Avatar asked Dec 05 '25 17:12

razrabochka


1 Answers

I found the solution to this here https://github.com/microsoft/vscode-remote-release/issues/4600. I am summarizing the steps here, since the steps are not very clear there. Before you start make sure you have one of the recent versions of VScode (I am using 1.55.2).

Steps to connect from Windows to Linux:

  1. Install Xming (Should also work with VcXsrv). Start Xming (Default Display:0.0)
  2. Install Remote-SSH. You don't need the other extensions. Nor do you need a running terminal with active x11 connection.
  3. Add a new environment variable to Windows: DISPLAY = localhost:0.0 (Adjust this according to your Xming setting. I prefer the default value).
  4. Connect remotely using VScode. Make sure that the ssh config forwards x11 connection: ForwardAgent yes ForwardX11 yes ForwardX11Trusted yes You can actually check the logs of remote host, if x11 forwarding is successful and port is set. If not set properly, it will complain that the display is not set. An easier check is to see if the DISPLAY variable is automatically set in the Linux server.

Hopefully everything works after these steps.

like image 60
nivesh Avatar answered Dec 08 '25 11:12

nivesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!