Open oconnor17 opened 2 years ago
Work-around
First create a batch script: C:\Users\
C:\Windows\system32\wsl.exe ssh %*
Secondly, configure the VScode Remote - SSH extension to use this batch script when running ssh operations.
PS
Ran into this issue - glad to see it's been caught.
@oconnor17 thanks for creating this issue! We will take a look and come back to you!
@oconnor17 @cslovell can you connect the devcontainer using ssh my-app.devspace -v
? Can you post the output of the command?
This is the output from a Powershell terminal
C:\Users\oconnor17> ssh my-app.devspace -v
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
ssh: Could not resolve hostname my-app.devspace: No such host is known.
From within WSL2 (Running Ubuntu), it works as expected
$ ssh my-app.devspace -v
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/mark/.ssh/config
debug1: /home/mark/.ssh/config line 2: Applying options for my-app.devspace
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 11442.
debug1: Connection established.
debug1: identity file /home/mark/.devspace/ssh/id_devspace_rsa type 0
debug1: identity file /home/mark/.devspace/ssh/id_devspace_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: Remote protocol version 2.0, remote software version Go
debug1: no match: Go
debug1: Authenticating to localhost:11442 as 'devspace'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:i3UhPeNm0J01eDNmAIY36vbJGWbdSegzQcJqJU0AGB4
debug1: checking without port identifier
Warning: Permanently added '[localhost]:11442' (RSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/mark/.devspace/ssh/id_devspace_rsa RSA SHA256:t2R/aRrQqXPBmDc+ud9/CPVSLTItQTx1X6q4lb7V9Uc explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/mark/.devspace/ssh/id_devspace_rsa RSA SHA256:t2R/aRrQqXPBmDc+ud9/CPVSLTItQTx1X6q4lb7V9Uc explicit
debug1: Server accepts key: /home/mark/.devspace/ssh/id_devspace_rsa RSA SHA256:t2R/aRrQqXPBmDc+ud9/CPVSLTItQTx1X6q4lb7V9Uc explicitdebug1: Authentication succeeded (publickey).
Authenticated to localhost ([127.0.0.1]:11442).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = C.UTF-8
root@my-app-devspace-7dc5f89897-rbj4k:/app#
A second attempt using the windows powershell terminal.
I'm specifying the path to the configuration files generated by devspace (within the WSL file system home). This time it connects, but there are two issues with the SSH private key.
C:\Users\oconnor17> ssh my-app.devspace -v -F \\wsl$\Ubuntu-20.04\home\mark\.ssh\config -i \\wsl$\Ubuntu-20.04\home\mark\.devspace\ssh\id_devspace_rsa
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.ssh\\config
debug1: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.ssh\\config line 2: Applying options for my-app.devspace
debug1: Connecting to my-app.devspace [::1] port 11442.
debug1: Connection established.
debug1: identity file \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa type 0
debug1: identity file \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa-cert type -1
debug1: identity file /home/mark/.devspace/ssh/id_devspace_rsa type -1
debug1: identity file /home/mark/.devspace/ssh/id_devspace_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version Go
debug1: no match: Go
debug1: Authenticating to localhost:11442 as 'devspace'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:i3UhPeNm0J01eDNmAIY36vbJGWbdSegzQcJqJU0AGB4
debug1: checking without port identifier
Warning: Permanently added '[localhost]:11442' (RSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa RSA SHA256:t2R/aRrQqXPBmDc+ud9/CPVSLTItQTx1X6q4lb7V9Uc explicit
debug1: Will attempt key: /home/mark/.devspace/ssh/id_devspace_rsa explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa RSA SHA256:t2R/aRrQqXPBmDc+ud9/CPVSLTItQTx1X6q4lb7V9Uc explicit
debug1: Server accepts key: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa RSA SHA256:t2R/aRrQqXPBmDc+ud9/CPVSLTItQTx1X6q4lb7V9Uc explicit
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for '\\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "\\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_rsa": bad permissions
debug1: Trying private key: /home/mark/.devspace/ssh/id_devspace_rsa
no such identity: /home/mark/.devspace/ssh/id_devspace_rsa: No such file or directory
debug1: No more authentication methods to try.
devspace@localhost: Permission denied (publickey).
To conclude, the work-around configures the windows application (Visual Studio Code) to use the WSL implementation of SSH, instead of the windows ssh. The problem was documented in this article I found. Unclear to me if there is a better solution.
@oconnor17 We just updated the way to generate ssh keys. Could you build the bin from the main branch and try it again?
Very sorry, build is not working for me :-(
$ GO111MODULE=on
$ GOFLAGS=-mod=vendor
$ go clean -modcache
$ go mod vendor
..
..
go: extracting github.com/klauspost/compress v1.15.8
github.com/loft-sh/devspace/pkg/devspace/services/inject imports
io/fs: malformed module path "io/fs": missing dot in first path element
github.com/loft-sh/devspace/pkg/devspace/compose imports
github.com/compose-spec/compose-go/loader imports
github.com/compose-spec/compose-go/schema imports
embed: malformed module path "embed": missing dot in first path element
github.com/loft-sh/devspace/pkg/devspace/docker imports
github.com/docker/docker/registry imports
github.com/docker/distribution/registry/client/auth imports
github.com/docker/distribution/registry/client imports
github.com/docker/distribution/registry/storage/cache imports
github.com/docker/distribution/metrics imports
github.com/docker/go-metrics imports
github.com/prometheus/client_golang/prometheus imports
runtime/metrics: malformed module path "runtime/metrics": missing dot in first path element
$ go build -o devspace
..
..
go: finding github.com/pkg/sftp v1.13.1
go: finding github.com/kr/fs v0.1.0
go: finding github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c
go: finding github.com/gorilla/websocket v1.4.2
go: finding k8s.io/klog v1.0.0
build github.com/loft-sh/devspace: cannot load embed: malformed module path "embed": missing dot in first path element
Environment
$ go version
go version go1.13.8 linux/amd64
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS"
Hey, @oconnor17 I see you're using go1.13.8
, and the package which failed to build was introduced in go1.16
could you please upgrade to the latest Go or any version later than 1.16 and try again?
Compile worked.
$ devspace version
DevSpace version :
Within WSL
rm -rf $HOME/.devspace
rm $HOME/.ssh/config
Within WSL
# Clone the example project
git clone https://github.com/loft-sh/devspace-vscode-example.git
# Switch to the folder
cd devspace-vscode-example
# Open Visual Studio Code in a Container
devspace dev -n moc-test1
Output
$ devspace dev -n moc-test1
info Using namespace 'moc-test1'
info Using kube context 'xxxxxxxxxxx'
deploy:my-app Skipping deployment my-app
dev:my-app Waiting for pod to become ready...
dev:my-app Selected pod my-app-devspace-7dc5f89897-rdhpw
dev:my-app ports Port forwarding started on: 9000 -> 9000
dev:my-app sync Sync started on: /home/mark/.gitconfig <-> /root/.gitconfig
dev:my-app sync Waiting for initial sync to complete
dev:my-app sync Initial sync completed
dev:my-app sync Sync started on: ./ <-> /app
dev:my-app sync Waiting for initial sync to complete
dev:my-app sync Initial sync completed
dev:my-app ssh Port forwarding started on: 10704 -> 8022
dev:my-app proxy Inject devspacehelper...
dev:my-app proxy Successfully injected devspacehelper into pod moc-test1/my-app-devspace-7dc5f89897-rdhpw
dev:my-app proxy Port forwarding started on: 11535 <- 10567
dev:my-app ssh Inject devspacehelper...
dev:my-app ssh Successfully injected devspacehelper into pod moc-test1/my-app-devspace-7dc5f89897-rdhpw
dev:my-app ssh Use 'ssh my-app.devspace' to connect via SSH
Visual Studio fails again with the error reported above. Terminal output is listed here
[11:45:25.628] Install terminal quit with output: ]0;C:\windows\System32\cmd.exessh: Could not resolve hostname my-app.devspace: No such host is known.
[11:45:25.628] Received install output: ]0;C:\windows\System32\cmd.exessh: Could not resolve hostname my-app.devspace: No such host is known.
[11:45:25.629] Resolver error: Error: Could not resolve hostname
at g.Offline (c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:583872)
at c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:581293
at t.handleInstallOutput (c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:581661)
at t.tryInstall (c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:679811)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:642614
at async t.withShowDetailsEvent (c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:645932)
at async t.resolve (c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:643664)
at async c:\Users\oconnor17\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:722342
Works as expected
$ ssh my-app.devspace -v
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/mark/.ssh/config
debug1: /home/mark/.ssh/config line 2: Applying options for my-app.devspace
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 10704.
debug1: Connection established.
debug1: identity file /home/mark/.devspace/ssh/id_devspace_ecdsa type 2
debug1: identity file /home/mark/.devspace/ssh/id_devspace_ecdsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: Remote protocol version 2.0, remote software version Go
debug1: no match: Go
debug1: Authenticating to localhost:10704 as 'devspace'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Pnthozx1EdU8oygpVdN3ceOu0PAeeYj50ah/vgO2uWc
debug1: checking without port identifier
Warning: Permanently added '[localhost]:10704' (ECDSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/mark/.devspace/ssh/id_devspace_ecdsa ECDSA SHA256:Z6mEPraNgVNQi8oA5/RDRHu50lAPYitzI8l0xdyNnn8 explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/mark/.devspace/ssh/id_devspace_ecdsa ECDSA SHA256:Z6mEPraNgVNQi8oA5/RDRHu50lAPYitzI8l0xdyNnn8 explicit
debug1: Server accepts key: /home/mark/.devspace/ssh/id_devspace_ecdsa ECDSA SHA256:Z6mEPraNgVNQi8oA5/RDRHu50lAPYitzI8l0xdyNnn8 explicit
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([127.0.0.1]:10704).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = C.UTF-8
root@my-app-devspace-7dc5f89897-rdhpw:/app#
Fails as expected
C:\Users\oconnor17> ssh my-app.devspace -v
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
ssh: Could not resolve hostname my-app.devspace: No such host is known.
Attempting to configure Windows to use the SSH related files, generated by Devspace (within the WSL virtual machine), doesn't work either.
C:\Users\oconnor17> ssh my-app.devspace -v -F \\wsl$\Ubuntu-20.04\home\mark\.ssh\config -i \\wsl$\Ubuntu-20.04\home\mark\.devspace\ssh\id_devspace_ecdsa
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.ssh\\config
debug1: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.ssh\\config line 2: Applying options for my-app.devspace
debug1: Connecting to my-app.devspace [::1] port 10704.
debug1: Connection established.
debug1: identity file \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa type 2
debug1: identity file \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa-cert type -1
debug1: identity file /home/mark/.devspace/ssh/id_devspace_ecdsa type -1
debug1: identity file /home/mark/.devspace/ssh/id_devspace_ecdsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version Go
debug1: no match: Go
debug1: Authenticating to localhost:10704 as 'devspace'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Pnthozx1EdU8oygpVdN3ceOu0PAeeYj50ah/vgO2uWc
debug1: checking without port identifier
Warning: Permanently added '[localhost]:10704' (ECDSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa ECDSA SHA256:Z6mEPraNgVNQi8oA5/RDRHu50lAPYitzI8l0xdyNnn8 explicit
debug1: Will attempt key: /home/mark/.devspace/ssh/id_devspace_ecdsa explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa ECDSA SHA256:Z6mEPraNgVNQi8oA5/RDRHu50lAPYitzI8l0xdyNnn8 explicit
debug1: Server accepts key: \\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa ECDSA SHA256:Z6mEPraNgVNQi8oA5/RDRHu50lAPYitzI8l0xdyNnn8 explicit
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for '\\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "\\\\wsl$\\Ubuntu-20.04\\home\\mark\\.devspace\\ssh\\id_devspace_ecdsa": bad permissions
debug1: Trying private key: /home/mark/.devspace/ssh/id_devspace_ecdsa
no such identity: /home/mark/.devspace/ssh/id_devspace_ecdsa: No such file or directory
debug1: No more authentication methods to try.
devspace@localhost: Permission denied (publickey).
@oconnor17 Could you please print the file permissions of devspace-generated ssh keys, from both wsl and from the windows system?
I'm not wsl or windows expert and I very well could be wrong here, but it seems like there could be some file permission issue between wsl and windows. They may not be able to map it correctly with each other’s filesystem. You may need to add/update some file permission configurations between wsl and windows.
I understand that regarding the vscode hack of this issue, they’re instructing vscode to use ssh from wsl and hence it works fine.
@oconnor17 @cslovell can you connect the devcontainer using
ssh my-app.devspace -v
? Can you post the output of the command?
In my case I get an error indicating "connection refused":
$ ssh app.project.devspace -v
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/[my-username]/.ssh/config
debug1: /home/[my-username]/.ssh/config line 42: Applying options for app.project.devspace
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 11026.
debug1: connect to address 127.0.0.1 port 11026: Connection refused
ssh: connect to host localhost port 11026: Connection refused
@cslovell @oconnor17 have you installed DevSpace on the host system or within WSL2 itself? In the latter case I don't think there is much we can do as we would need to detect WSL2 somehow and then try to figure out the ssh path on the host system, which I don't think is a good idea in general.
@cslovell @oconnor17 have you installed DevSpace on the host system or within WSL2 itself? In the latter case I don't think there is much we can do as we would need to detect WSL2 somehow and then try to figure out the ssh path on the host system, which I don't think is a good idea in general.
I'm running Devspace within WSL2, which I think is the more typical usecase. It is possible to detect you're running within WSL, but I'm not clear if it helps solve the problems....
$ uname -a
Linux DE21083025 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Problem 1: Two locations for SSH configuration
To fix this issue you'll need to write the SSH config files to two locations to cater for both windows and linux SSH clients:
See how it could be possible to have two different usernames?
Problem 2: File permissions
Conclusion
Strictly speaking this is not a Devspace problem. VScode is running as a windows program, outside the WSL2 virtual machine.
Why don't we just document this problem and the work-around in the Devspace documentation? Means WSL2 users will not think Devspace is broken.
@oconnor17 We'll document this somewhere if we don't find a better solution, but before that, I was looking if we could have a workaround for both issues.
WARNING: UNPROTECTED PRIVATE KEY FILE!
error. I feel this is because of file permission configuration in wsl and windows.Have you tried this fix from MS docs, and does this work? /etc/wsl.conf
[automount]
enabled = true
options = metadata,uid=1000,gid=1000,umask=0022
In my case I get an error indicating "connection refused":
$ ssh app.project.devspace -v OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022 debug1: Reading configuration data /home/[my-username]/.ssh/config debug1: /home/[my-username]/.ssh/config line 42: Applying options for app.project.devspace debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to localhost [127.0.0.1] port 11026. debug1: connect to address 127.0.0.1 port 11026: Connection refused ssh: connect to host localhost port 11026: Connection refused
@cslovell This usually happens when the server is stopped. Can you confirm if the devspace dev is running while trying ssh? And does the vscode workaround works for you?
What happened?
I was following the IDE integration example, and got the following error from Visual Studio
What did you expect to happen instead?
I expected to see the source code inside the container displayed by VSCode.
It should be noted that I am running VSCode using WSL2 on Windows. The example is running on my Ubuntu Laptop (See Issue #2420)
How can we reproduce the bug? (as minimally and precisely as possible)
On a windows machine, running WSL2, I followed the example instructions
https://www.devspace.sh/docs/ide-integration/visual-studio-code#tldr
Local Environment:
devspace --version
] devspace version 6.1.1kubectl version
]Anything else we need to know?
The following link describes what I think is root cause and a work-around.
https://zitseng.com/archives/20325/amp
Devspace generates the necessary SSH configuration to connect to the devmode container here:
Problem is that when running VSCode via WSL2 it is running on the host windows, meaning it's SSH configuration is located here. Explaining the "could not resolve hostname" error.