-
Notifications
You must be signed in to change notification settings - Fork 316
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
Remote-SSH X11 Forwarding not working #4600
Comments
This says that DISPLAY was not defined in the ssh process. What do you get if you run |
Where/when exactly should I run that command? In my local Windows 10 shell? Or inside the integrated terminal after I'm already connected to Maybe I'm not understanding how the feature should work? My usual setup is to start up Xming on Windows 10, then open PuTTY, check the "Enable X11 Forwarding" checkbox, and start an ssh connection to a Linux machine. That works just fine for interacting with graphical windows launched out of the PuTTY shell. My assumption with this new extension feature was that I would simply be able to substitute VSCode for PuTTY. So I start up Xming on Windows 10, then open VSCode to connect to my remote Linux host. And I assumed at that point I would be able to launch graphical windows from inside the integrated terminal. Is there a step I'm missing? Do I need to be manually setting a DISPLAY variable in my Windows 10 environment before opening VSCode? |
My understanding (to speed things up by a few time zones :D)
I think yes. VS Code uses some You may also add
[Interestingly,
I think your understanding is correct.
I don't think so. |
I have figured out a couple of things in my testing, using OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2 and VcXsrv 1.20.8.1:
which works for both OpenSSH for Windows and Git's |
Wow, I noticed so many of those same things yesterday while trying to get this all to work:
Thank you for your detailed responses! Just to clarify, though, you were in fact able to get X11 forwarding working inside VSCode Remote-SSH with the single addition of setting an |
Basically, yes. In addition, don't forget to replace |
(Finally, what I find notable that I did not have to do any of these gymnastics with https://marketplace.visualstudio.com/items?itemName=spadin.remote-x11.) |
Haha yea, I was previously using that extension, and it does work well. I disabled it, though, when I saw that X11 was now supposed to be handled natively with the latest Remote-SSH extension update. The release notes didn't mention anything about not working on Windows, but I see it was specifically tested on macOS and Linux in #4522? |
I can't get this new feature to work either with plugin version 0.65.1 I have confirmed that it works fine outside of vscode. If I do a simple |
@codekitchen, what are your local and remote OSes? |
Local is MacOS Big Sur 11.2.2 (using XQuartz), remote is Ubuntu 18.04. I verified that vscode running against a local dir on my mac has DISPLAY set as expected. |
Interesting. It looks like MacOS functionality was verified in #4522 using XQuartz without any trouble. |
I'm reading through the "Remote - SSH" output and I see this:
So it seems like at least the local vscode side knows about the DISPLAY var, it's just not making it to the remote side? I can share the full log with somebody if it's useful. |
@codekitchen I was seeing the same thing sporadically on Windows connecting to Linux with 0.65.1: DISPLAY was set, but I got What helped for me was installing 0.65.0 and reloading: Interestingly, installing 0.65.1 after that still worked. But maybe it does help tracking this down. |
@bersbersbers thanks but if your DISPLAY var was set, that sounds like something different -- mine isn't getting set at all. |
Yes, agreed. I must have misread your posts, sorry for that. |
I was able to get this to work by doing the following:
|
@devsnek and for the record:
|
Totally a newbie here: |
I am also new to this. Took some time to figure out the steps outlined above. Steps to connect from Windows to Linux:
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. |
@niveshd thanks for your help.
) on windows I add the new environment as as you mentioned in then I opened the vscode via remote ssh (so in the vscode im connecting to the node through ssh). so in the vscode, in the log(Remote Server) is see:
I also have a log (Extension Host) which is outputing:
on the Remote-SSH I see:
so I am not sure if I need to set anything on the Host (linux), should I? like should I export the Display on the linux? one way that I am testing that is as follow, I basically want to see images during the debugging, so I just run the debugging and try to see if
but the imshow does not show anything. Thanks a lot for your help in advance! :)update:
right now (which is for debugging).
to the
I dont want the display be shown in a new windows, I just want it to be shown in the debugging consule, but it seems like to be so hard. or I dont know how to do it :( |
@seyeeet I am also using it with a cluster. On the cluster side, you don't need to set any DISPLAY. For me, once I connect, VSCode assigns a DISPLAY port on the cluster. You only need to set it on the windows side. I just set it to localhost:0.0 I don't think you need to expand the localhost. In the config file, can you add |
@niveshd Thanks for your help, but it is not still working, echo $DISPLAY in the terminal of vscode shows nothing. I did try to set it manually, but I still cannot make it work :( did you set the localhost in the congi file?
|
I haven't yet been able to get this to work with a Windows local machine and Linux remote machine. A
and "Remote - SSH" logs this:
If I My setup:
SSH config:
I also see this in the logs. This pretty closely matches what it logs when I connect using
|
Succeeded with Remote - SSH v0.65.8, windows 19043. ssh config: (key baed auth)
ForwardX11 yes
ForwardX11Trusted yes
Windows env: (edit in powershell, or so on)
DISPLAY=localhost:0.0
Windows installed VcXsrv 1.20.6.0
|
yes, I still face that issue with version 1.61.1 |
I don't really understand what the issue is on windows, or what else Remote-SSH needs to do, but #4600 (comment) seems like useful info. |
would recommend the mpld3 pip package for anyone using python.. More reliable than X11 imo |
@bdytx5 interesting!!! it looks promising, but it is just very slow for images, for simple toy examples it works though!!! |
Hi @binus, could you give more detail about how to make it work? I followed your configuration but still can't get this work.
Currently, I succeded by keeping MobaXterm opened as Moba will start a xserver in background. |
Finally I did it. I wrote a tutorial post here: English ver/Chinese ver. The key steps can be summarized as:
|
It's worth mentioning the VcXsrv is not explicitly necessary for people who have Windows 11 & WSL-g (the native windows wsl-g is much faster than VcXsrv) |
Didn't try it, but I found a feature request here: Remote-SSH utilizing wslg for X11 forwarding, saying this feature will not be put into backlog until it gets 10 upvotes. (One of the three votes is mine...😂) |
@zzeitt - I've added an upvote in solidarity. ✊ the DISPLAY variable isn't auto-setup for me (I need to set it up by hand when in a vscode window) #267 references #589 which references #16 For anybody running across this, if we don't get this ticket across the line in upvotes, there is a quick and easy work-around using windows terminal (not in vscode), but wslg X11 with DISPLAY works when ssh is run via wsl.exe
👆 use the command in windows-terminal (via windows terminal) in your remote host then in vscode window |
@tanhakabir & @roblourens - i'm going to ping you on vscode dev slack, created a channel for vscode-remote-ssh happy to help debug a bit. The issue is actually here: even more bizzare, I've updated settings.json
But it doesn't change the plugin (as you'd expect), rather I see the exact same string 🤓 at this point, lemme explain what is happening. I definitely figured out why this isn't working, the plugin is running under "cmd.exe", and when HOWEVER the exact same command, with the same config, with or without the -X -Y -a (literally it only requires the -F with so I think if I can figure out how to change cmd.exe to wsl.exe in the line below then this will work.
I've tried all of these settings.json with no luck, I can't get to the source code for remote-ssh plugin so I can't see where this actually getting the "cmd.exe" path from.
🙏 i'm not even kidding when i say this has stolen a week of my life. yep, it still occurs with the latest pre-release plugin version v0.81.2202052415 ✊ The issue is that X11 forwarding isn't possible under cmd.exe I'm running on windows 11, insiders edition (fully patched), running vscode it is not possible to get ssh remote extension to pass the -X parameter (which will set the DISPLAY parameter) I know vscode is reading my ~/.ssh/config file (because if I change the path, the remote hosts disappear, I have no hosts! so I'm sure it's reading the proper and I know my Debug log provided for complete reference.
|
so I managed to find this link - https://zitseng.com/archives/20325 and used those instructions to set this:
new abridged output (still trying to run cmd.exe, now command still fails, trying to run inside wsl.exe because it can't find the file next, i switched the ~/.ssh/config path variable in vscode to a valid WSL path /mnt/c/users/gru3h/.ssh/config and suddenly HURRAH! i'm seeing 😖 HOWEVER, once I stop using that session remote-ssh using a maybe i'll be able to modify the |
@elasticdotventures thanks for the deep exploration! I'll see if I can add an experimental setting for you that let's you change the windows executable path to wsl instead of cmd. One thing to add though is that it seems your X11 server is running only in WSL based on #4600 (comment) so it does make sense cmd doesn't work with your set up |
@tanhakabir thanks 🥰 fwiw, it probably won't be that straightforward. 🙄 as I explained the path to the ~/.ssh/config file will also need to be addressed, since vscode is starting in windows host, the remote-ssh plugin [correctly] uses windows paths. i.e.
☝️ vscode remote-ssh plugin -- I normally would use the 🤓 notice the combination of back \ and forward / slashes above. 🙈🙉🙊 the fun is just starting. 🫣 of course, by switching to the .bat example as suggested by the zitseng.com/archives/20325 [hereafter: "zitseng method"], I was able to execute WSL, but found inside of WSL, the windows path to I hacked my way around this (as a test) by using "the zitseng method" and setting my
in the vscode settings, now I can close+re-open VSCODE .. and the most recent session auto-restart with the proper settings and almost semi-work ... 🤓at least the HOWEVER - this approach breaks the remote-ssh plugin from being able to select a new host in vscode (i.e. F1 +
|
@tanhakabir so my proposal (after sleeping on this) I think the Remote-SSH plugin should probably load/select the shell from a standard 'defacto' vscode place such as:
the AND ADDITIONALLY: some mechanism such as a boolean to disable the windows path expansion to prevent
from becoming |
@elasticdotventures I realized we have a longstanding issue to get WSL SSH working: #937 so your request would fall under that request. I'll aim to have some time this upcoming month to explore this but until then I would follow #937 instead |
@seyeeet checkout imgcat with iterm. Works well for viewing images! |
@tanhakabir unrelated but a better way to debug programs with command line arguments would be a huge improvement! Problem is that you have to make this launch.json file in a very specific format. This is very tedious when using lots of arguments. You should just be able to debug directly from the command line instead of having to use a launch.json file. |
@bdytx5 thanks for the suggestion! Would you be able to file an issue on the vscode repo reiterating this feedback? |
This comment was marked as spam.
This comment was marked as spam.
still it is not clear |
@Sandy4321 that should be possible today since you have access to all the compute of your remote environment and can open Jupyter notebooks or Python files on the remote. |
Closing this issue due to inactivity though. |
Steps to Reproduce:
.ssh/config
file as such:test-machine
(remote Linux host).DISPLAY
variable:Output log from Remote-SSH channel:
Click to expand
/cc @roblourens
The text was updated successfully, but these errors were encountered: