Skip to content
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

Fix use of "remote.containers.executeInWSL", "remote.SSH.configFile" and "remote.SSH.path" #6021

Closed
ricardosantos9521 opened this issue Dec 9, 2021 · 17 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers verified Verification succeeded
Milestone

Comments

@ricardosantos9521
Copy link

Issue Type: Bug

Open a folder with remote ssh
Try to Reopen the folder in remote-containers
Not logs are shown

Extension version: 0.209.3
VS Code version: Code 1.63.0 (7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e, 2021-12-07T06:26:56.179Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No
Remote OS version: Linux arm64 5.10.0-9-arm64

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (4 x 2712)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.92GB (1.80GB free)
Process Argv --crash-reporter-id cd0756e5-34a8-4d1b-abf8-1475c043359c
Screen Reader no
VM 0%
Item Value
Remote SSH: raspberrypi4
OS Linux arm64 5.10.0-9-arm64
CPUs unknown (4 x 1500)
Memory (System) 7.63GB (3.67GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30384385
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
pythonrunftest32:30373476
pythonf5test824:30373475
javagetstartedt:30391933
pythonvspyt187:30373474
vsaa593cf:30376535
pythonvs932cf:30408637
vscop804cf:30404767
vs360cf:30404996
vsrem710:30405998
vscexrecpromp3t3:30407764

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Dec 9, 2021
@chrmarti
Copy link
Contributor

chrmarti commented Dec 9, 2021

Have you checked the container log? (F1 > Remote-Containers: Show Container Log)

@chrmarti chrmarti self-assigned this Dec 9, 2021
@chrmarti chrmarti added the info-needed Issue requires more information from poster label Dec 9, 2021
@ricardosantos9521
Copy link
Author

ricardosantos9521 commented Dec 11, 2021

Yes @chrmarti i checked the logs
image

I don't know why but when i click reopen folder in container on launch it's trying to use the username from windows instead of the username set for ssh in vscode Remote ssh
image

Windows User: ricar
SSH server username: ricardo

After creating a user in the ssh server with the same name of the user in windows it worked. So, i think the remote-containers should use the user@ip set for remote ssh if used via remote-ssh

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Dec 13, 2021
@chrmarti chrmarti added this to the January 2022 milestone Dec 13, 2021
@chrmarti
Copy link
Contributor

As a workaround, you could add your ssh server to your local ~/.ssh/config where you can also specify a user name. E.g.:

Host raspberrypi4
    User ricardo

@chrmarti
Copy link
Contributor

Where do you specify the username ricardo for Remote-SSH?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Dec 13, 2021
@Clockwork-Muse
Copy link

Not working for me either, in a slightly different flavor;

I'm on windows 11, connected to a remote Ubuntu machine. I'm ssh'd into the machine, and can open folders that way, and it picks up the .devcontainer, but for some reason it seems to want to run things on WSL:

[8582 ms] Remote-Containers 0.209.5 in VS Code 1.63.0 (7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e).
[8582 ms] Start: Run: wsl -l -v
[8611 ms] Start: Run: wsl -d Ubuntu -e ssh slipstream /bin/sh -c /bin/sh
[8613 ms] Start: Run in host: id -un
# process stuck here for some reason

... except the docker cli in Windows has a context pointing it to the remote machine (verified as both the cli and the docker extension properly reflect the remote machine).
WSL doesn't have docker installed, although it does have podman installed and aliased for docker.

@ricardosantos9521
Copy link
Author

Where do you specify the username ricardo for Remote-SSH?

In my case i have a setting in settings.json
image

that file contains this
image

i parsed this file for https://github.com/Tyriar/vscode-windows-terminal when added support for ssh and other things
Here https://github.com/Tyriar/vscode-windows-terminal/blob/master/src/ssh.ts

@alkatar21
Copy link

I think my problem is quite related to this issue, maybe it is even the same.
It tries to use the default ssh-client on my computer, although I specified another one in the remote SSH extension. Since I did not have an SSH client installed on the computer, first the extension failed with an error in the runtime status Uncaught Errors: write EPIPE. Then I installed as a test the OpenSSH client in the Windows Optional features. Then I also get this problem, because the actually should not be used, it is not set up and thus can not connect.

Currently I used the following workaround for Remote-SSH , to use a WSL ssh. However, I also did not use the default distro.

@chrmarti
Copy link
Contributor

@alkatar21 There is a setting to let Remote-Containers run all commands in WSL, maybe that can help working around the issue:
image

@chrmarti chrmarti removed the info-needed Issue requires more information from poster label Dec 15, 2021
@alkatar21
Copy link

Unfortunately this does not help, it leads to the same behavior as in # 6053.
The problem is that the setting uses the default WSL, which for me is a WSL1. For the setting to work you would have to be able to select a WSL, or at least it would have to use one that is specified in Docker Settings.
I tried to describe the issue in # 6061.
(I didn't reference the issues again, as they are already referenced right above here).

@ricardosantos9521
Copy link
Author

ricardosantos9521 commented Dec 15, 2021

Other problem i found. Remote-containers is using the "Host" value from "remote.ssh.configFile" as the ip to connect to the ssh machine.
image
image

When we are connected to a machine via Remote-SSH and try to reopen a project with remote-containers it should try to open the remote-container with HOSTNAME@USER of the "HOST" we are currently on.

@alkatar21
Copy link

@ricardosantos9521 This is an ssh feature, which is used there. You can use ssh <host> for a host that is stored in the config, normally ~/.ssh/config (here the "remote.ssh.configFile" file) and ssh will resolve that to what is in the config. In this case raspberrypi4-ricar equals [email protected].
It is also mentioned in the docs.

@ricardosantos9521
Copy link
Author

ricardosantos9521 commented Dec 15, 2021

Remote containers should use that configuration stored for Remote SSH when in this context.

When we have vscode connect to a ssh machine and i try to reopen a container in that machine it uses the Host value of the "remote.ssh.configFile" file instead of the using user@ip (Hostname@User).

@alkatar21
Copy link

I meant by my comment that the part of the command you mentioned is correct.
Otherwise that is exactly the problem. In this and I think all cases where SSH is used in the remote containers extension, depending on what "remote.containers.executeInWSL" is set to, either the SSH of the own machine, or the ssh of the default WSL is used.
But in fact the one configured via the remote SSH extension should be used.

@chrmarti
Copy link
Contributor

chrmarti commented Dec 24, 2021

To summarize: When you are connected with Remote-SSH we should ignore "remote.containers.executeInWSL" (because Remote-SSH does not use WSL to connect) and use "remote.SSH.configFile" and "remote.SSH.path" if set.

@chrmarti chrmarti changed the title Remote container in remote ssh not working Fix use of "remote.containers.executeInWSL", "remote.SSH.configFile" and "remote.SSH.path" Dec 24, 2021
@chrmarti
Copy link
Contributor

chrmarti commented Jan 4, 2022

Now available with VS Code Insiders and Remote-Containers 0.210.0.

@TylerLeonhardt TylerLeonhardt added the author-verification-requested Issues potentially verifiable by issue author label Jan 28, 2022
@ricardosantos9521
Copy link
Author

ricardosantos9521 commented Jan 28, 2022

@vscode-triage-bot /verified

@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants
@TylerLeonhardt @Clockwork-Muse @chrmarti @ricardosantos9521 @alkatar21 and others