loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
8.42k stars 305 forks source link

Could not establish connection to "test-repo.devpod" in WSL2 #1142

Open solairen opened 2 days ago

solairen commented 2 days ago

Hi,

I have a problem with running devpod under WSL2. I try to use provider ssh or kubernetes but when I run it under WSL2 I got error:

Could not establish connection to "test-repo.devpod".

But when I run it under Windows it works mostly perfect (I'm unable to pass .ssh and .gnupg keys to container)

Versions OS: Windows 11 WSL: WSL2 - Ubuntu 22.04 DevPod: 0.5.16 DEvPod-CLI: 0.5.16

Logs:

[23:21:27.967] VS Code version: 1.90.2
[23:21:27.968] Remote-SSH version: remote-ssh@0.112.0
[23:21:27.968] win32 x64
[23:21:27.972] SSH Resolver called for "ssh-remote+test-repo.devpod", attempt 1
[23:21:27.973] "remote.SSH.useLocalServer": false
[23:21:27.973] "remote.SSH.useExecServer": true
[23:21:27.973] "remote.SSH.showLoginTerminal": false
[23:21:27.973] "remote.SSH.remotePlatform": {"npm":"linux","development":"linux","test-repo.devpod":"linux"}
[23:21:27.973] "remote.SSH.path": undefined
[23:21:27.973] "remote.SSH.configFile": undefined
[23:21:27.973] "remote.SSH.useFlock": true
[23:21:27.973] "remote.SSH.lockfilesInTmp": false
[23:21:27.973] "remote.SSH.localServerDownload": auto
[23:21:27.974] "remote.SSH.remoteServerListenOnSocket": false
[23:21:27.975] "remote.SSH.showLoginTerminal": false
[23:21:27.975] "remote.SSH.defaultExtensions": []
[23:21:27.975] "remote.SSH.loglevel": 2
[23:21:27.975] "remote.SSH.enableDynamicForwarding": true
[23:21:27.975] "remote.SSH.enableRemoteCommand": false
[23:21:27.975] "remote.SSH.serverPickPortsFromRange": {}
[23:21:27.975] "remote.SSH.serverInstallPath": {}
[23:21:27.982] SSH Resolver called for host: test-repo.devpod
[23:21:27.982] Setting up SSH remote "test-repo.devpod"
[23:21:27.984] Using commit id "5437499feb04f7a586f677b155b039bc2b3669eb" and quality "stable" for server
[23:21:27.986] Install and start server if needed
[23:21:27.988] Checking ssh with "C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\ssh.exe -V"
[23:21:27.990] Got error from ssh: spawn C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\ssh.exe ENOENT
[23:21:27.990] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[23:21:27.991] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[23:21:27.991] Checking ssh with "C:\Windows\ssh.exe -V"
[23:21:27.992] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[23:21:27.992] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[23:21:27.993] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[23:21:27.993] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[23:21:27.994] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[23:21:27.994] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[23:21:28.013] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3

[23:21:28.017] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 57750 "test-repo.devpod" bash
[23:21:28.018] Terminal shell path: C:\Windows\System32\cmd.exe
[23:21:28.272] > ssh: Could not resolve hostname test-repo.devpod: Nieznany host.
> The process tried to write to a nonexistent pipe.
> ]0;C:\Windows\System32\cmd.exe
[23:21:28.272] Got some output, clearing connection timeout
[23:21:29.523] "install" terminal command done
[23:21:29.524] Install terminal quit with output: ]0;C:\Windows\System32\cmd.exe
[23:21:29.524] Received install output: ]0;C:\Windows\System32\cmd.exe
[23:21:29.524] Failed to parse remote port from server output
[23:21:29.525] Resolver error: Error: 
    at g.Create (c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:499918)
    at t.handleInstallOutput (c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:497240)
    at t.tryInstall (c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:621085)
    at async c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:580730
    at async t.withShowDetailsEvent (c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:584036)
    at async k (c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:577649)
    at async t.resolve (c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:581407)
    at async c:\Users\michal\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:848023
[23:21:29.527] ------

[23:21:30.238] Opening exec server for ssh-remote+test-repo.devpod
[23:21:30.326] Initizing new exec server for ssh-remote+test-repo.devpod
[23:21:30.341] Using commit id "5437499feb04f7a586f677b155b039bc2b3669eb" and quality "stable" for server
[23:21:30.342] Install and start server if needed
[23:21:30.350] Opening exec server for ssh-remote+test-repo.devpod
[23:21:30.400] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 57750 "test-repo.devpod" bash
[23:21:30.402] Terminal shell path: C:\Windows\System32\cmd.exe
[23:21:30.627] > ssh: Could not resolve hostname test-repo.devpod: Unknown host.
> The process tried to write to a nonexistent pipe.
> ]0;C:\Windows\System32\cmd.exe
[23:21:30.627] Got some output, clearing connection timeout
[23:21:31.887] "install" terminal command done
[23:21:31.887] Install terminal quit with output: ]0;C:\Windows\System32\cmd.exe
[23:21:31.887] Received install output: ]0;C:\Windows\System32\cmd.exe
[23:21:31.888] Failed to parse remote port from server output
[23:21:31.888] Exec server for ssh-remote+test-repo.devpod failed: Error
[23:21:31.888] Existing exec server for ssh-remote+test-repo.devpod errored (Error)
[23:21:31.888] Initizing new exec server for ssh-remote+test-repo.devpod
[23:21:31.888] Using commit id "5437499feb04f7a586f677b155b039bc2b3669eb" and quality "stable" for server
[23:21:31.890] Error opening exec server for ssh-remote+test-repo.devpod: Error
[23:21:31.890] Install and start server if needed
[23:21:31.893] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 57750 "test-repo.devpod" bash
[23:21:31.894] Terminal shell path: C:\Windows\System32\cmd.exe
[23:21:32.359] > ssh: Could not resolve hostname test-repo.devpod: Unknown host.
> The process tried to write to a nonexistent pipe.
> ]0;C:\Windows\System32\cmd.exe
[23:21:32.359] Got some output, clearing connection timeout
[23:21:33.581] "install" terminal command done
[23:21:33.581] Install terminal quit with output: ]0;C:\Windows\System32\cmd.exe
[23:21:33.581] Received install output: ]0;C:\Windows\System32\cmd.exe
[23:21:33.581] Failed to parse remote port from server output
[23:21:33.582] Exec server for ssh-remote+test-repo.devpod failed: Error
[23:21:33.582] Error opening exec server for ssh-remote+test-repo.devpod: Error

Additional info On WSL2 I've only installed devpod cli

Other solution

Maybe you can provide me how can I mount .ssh and gpg files from Windows to ssh host or other solution how can I get .ssh and .gnupg keys?

Windows path problem

Inside devcontainer.json I got this:

"mounts": [
      "source=${env:USERPROFILE}/.ssh,target=/home/dev/.ssh,type=bind,consistency=cached"
    ],

and the problem is:

 info docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /.ssh.
23:W0628 23:33:48.442149    6860 logging.go:59] [core] [Server #1] grpc: Server.processUnaryRPC failed to write status: connection error: desc = "transport is closing"
33:48 info devcontainer up: start dev container: exit status 125