Remote SSH connection hangs forever on `Waiting for port forwarding to be ready`
Is there an existing issue for this bug?
- [x] I have searched the existing open issues and found none that apply.
- [x] If I find any issue of interest that is related or closed, I will included a link to it in this issue.
Required Troubleshooting Steps
- [x] I have read and performed the troubleshooting steps
- [x] I have tried both values of the
remote.SSH.useLocalServersetting - [x] My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
- [x] I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar
[Optional] Diagnose with Copilot
I did not ask the @remote-ssh participant for help
In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?
I tried running the command "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 60788 "192.168.1.13" sh. It hangs forever without doing anything.
When prepending echo "echo hello" | , it correctly outputs "hello".
Remote-SSH Log
Remote-SSH Log
[00:05:36.009] Log Level: 2
[00:05:36.034] VS Code version: 1.104.1
[00:05:36.034] Remote-SSH version: [email protected]
[00:05:36.034] win32 x64
[00:05:36.040] SSH Resolver called for "ssh-remote+192.168.1.13", attempt 1
[00:05:36.042] remote.SSH.useLocalServer = false
[00:05:36.043] remote.SSH.useExecServer = true
[00:05:36.043] remote.SSH.bindHost = {}
[00:05:36.043] remote.SSH.showLoginTerminal = false
[00:05:36.043] remote.SSH.remotePlatform = {"192.168.1.13":"linux","192.168.1.50":"linux"}
[00:05:36.043] remote.SSH.path = undefined
[00:05:36.043] remote.SSH.configFile = undefined
[00:05:36.044] remote.SSH.useFlock = true
[00:05:36.044] remote.SSH.lockfilesInTmp = false
[00:05:36.044] remote.SSH.localServerDownload = auto
[00:05:36.044] remote.SSH.remoteServerListenOnSocket = false
[00:05:36.044] remote.SSH.defaultExtensions = []
[00:05:36.044] remote.SSH.defaultExtensionsIfInstalledLocally = []
[00:05:36.044] remote.SSH.loglevel = 2
[00:05:36.044] remote.SSH.enableDynamicForwarding = true
[00:05:36.044] remote.SSH.enableRemoteCommand = false
[00:05:36.045] remote.SSH.serverPickPortsFromRange = {}
[00:05:36.045] remote.SSH.serverInstallPath = {}
[00:05:36.045] remote.SSH.permitPtyAllocation = false
[00:05:36.045] remote.SSH.preferredLocalPortRange = undefined
[00:05:36.045] remote.SSH.useCurlAndWgetConfigurationFiles = false
[00:05:36.045] remote.SSH.experimental.chat = false
[00:05:36.045] remote.SSH.experimental.enhancedSessionLogs = false
[00:05:36.046] remote.SSH.httpProxy = {}
[00:05:36.046] remote.SSH.httpsProxy = {}
[00:05:36.062] SSH Resolver called for host: 192.168.1.13
[00:05:36.062] Setting up SSH remote "192.168.1.13"
[00:05:36.075] Using commit id "0f0d87fa9e96c856c5212fc86db137ac0d783365" and quality "stable" for server
[00:05:36.075] Extensions to install:
[00:05:36.080] Install and start server if needed
[00:05:36.083] Checking ssh with "C:\Program Files\Mozilla Firefox\ssh.exe -V"
[00:05:36.086] Got error from ssh: spawn C:\Program Files\Mozilla Firefox\ssh.exe ENOENT
[00:05:36.086] Checking ssh with "C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot\bin\ssh.exe -V"
[00:05:36.087] Got error from ssh: spawn C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot\bin\ssh.exe ENOENT
[00:05:36.087] Checking ssh with "C:\Program Files\OpenSSH\ssh.exe -V"
[00:05:36.088] Got error from ssh: spawn C:\Program Files\OpenSSH\ssh.exe ENOENT
[00:05:36.088] Checking ssh with "C:\WINDOWS\system32\ssh.exe -V"
[00:05:36.089] Got error from ssh: spawn C:\WINDOWS\system32\ssh.exe ENOENT
[00:05:36.089] Checking ssh with "C:\WINDOWS\ssh.exe -V"
[00:05:36.090] Got error from ssh: spawn C:\WINDOWS\ssh.exe ENOENT
[00:05:36.090] Checking ssh with "C:\WINDOWS\System32\Wbem\ssh.exe -V"
[00:05:36.091] Got error from ssh: spawn C:\WINDOWS\System32\Wbem\ssh.exe ENOENT
[00:05:36.091] Checking ssh with "C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[00:05:36.092] Got error from ssh: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[00:05:36.092] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[00:05:36.132] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
[00:05:36.144] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 60788 "192.168.1.13" sh
[00:05:36.147] Generated SSH command: 'type "C:\Users\lyc\AppData\Local\Temp\vscode-linux-multi-line-command-192.168.1.13-42579429.sh" | "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 60788 "192.168.1.13" sh'
[00:05:36.148] Using connect timeout of 17 seconds
[00:05:36.150] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:05:36.457] >
[00:05:36.458] Got some output, clearing connection timeout
[00:05:36.722] > 7a3abe9c7bfd: running
> Script executing under PID: 220910
[00:05:36.733] > Found existing installation at /home/lyc/.vscode-server...
> Starting VS Code CLI...
> Removing old logfile at /home/lyc/.vscode-server/.cli.0f0d87fa9e96c856c5212fc86db137ac0d783365.log
> Spawned remote CLI: 220928
[00:05:36.760] > Waiting for server log...
[00:05:36.814] > Waiting for server log...
[00:05:36.820] > 7a3abe9c7bfd: start
> listeningOn==127.0.0.1:43121==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==80==
> execServerToken==1a111a11-1a1a-111a-a1aa-a11111111a11==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK====
> DISPLAY====
> 7a3abe9c7bfd: end
[00:05:36.820] Received install output:
listeningOn==127.0.0.1:43121==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==80==
execServerToken==1a111a11-1a1a-111a-a1aa-a11111111a11==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK====
DISPLAY====
[00:05:36.821] Remote server is listening on port 43121
[00:05:36.821] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":43121},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"1a111a11-1a1a-111a-a1aa-a11111111a11"},"serverStartTime":80,"installUnpackCode":""}
[00:05:36.827] Starting forwarding server. local port 60790 -> socksPort 60788 -> remotePort 43121
[00:05:36.828] Forwarding server listening on port 60790
[00:05:36.828] Waiting for ssh tunnel to be ready
[00:05:36.830] [Forwarding server port 60790] Got connection 0
[00:05:36.833] Tunneled port 43121 to local port 60790
[00:05:36.833] Resolved "ssh-remote+192.168.1.13" to "port 60790"
[00:05:36.844] Initizing new exec server for ssh-remote+192.168.1.13
[00:05:36.844] Resolving exec server at port 60790
[00:05:36.849] [Forwarding server port 60790] Got connection 1
[00:06:06.839] Failed to set up socket for dynamic port forward to remote port 43121: Proxy connection timed out. TCP port forwarding may be disabled, or the remote server may have crashed. See the VS Code Server log above for details.
[00:06:06.852] Failed to set up socket for dynamic port forward to remote port 43121: Proxy connection timed out. TCP port forwarding may be disabled, or the remote server may have crashed. See the VS Code Server log above for details.
Expected Behavior
SSH connects to remote
Actual Behavior
Connection hangs on Setting up SSH Host 192.168.1.13: Waiting for port forwarding to be ready forever.
Steps To Reproduce
- Install VS Code & Remote Development plugin
- Connect to my server
Anything else?
I've tried connecting to the different Linux servers, rebooting host/client, toggling useLocalServer option. But none of them work.
I've tried connecting to the same server with another computer with VSCode installed, and it works. So I guess the problem is on the client side.
I eventually found out that this issue is caused by a Windows upgrade enabling BBR congestion control.
When upgrading to Windows 11 24H2, BBR2 is somehow enabled by default for me, and it causes every connection to localhost hang silently after receiving ~32bytes. So there's no obvious error log in VSC.
The solution is to switch back to CUBIC using netsh int tcp set supplemental Template=Internet CongestionProvider=CUBIC or try this: https://learn.microsoft.com/en-us/answers/questions/3879946/fix-bbr2-bugs-on-windows-11
Maybe considering adding this to troubleshooting wiki?
Thank you for the updates!
Maybe considering adding this to troubleshooting wiki?
This sounds like a good idea! Would you be willing to open a PR? I'd be happy to review.
Would you be willing to open a PR?
I'm willing to do it, but it appears the Troubleshooting Wiki uses GitHub Wiki, and GitHub Wiki currently doesn't support pull requests.
The changes I propose might look something like this:
The BBR2 congestion control provided in Windows 24H2 is known to break any connections to localhost, resulting in the
failed to set up socket for dynamic port forward to remote porterror in VSCode Remote. If you encounter similar issues, try disabling BBR2 usingnetsh int tcp set supplemental Template=Internet CongestionProvider=CUBIC, restarting your computer, and then try again.
I got the same problem because of a mishap in known_hosts. If your target host changed its ssh-key fingerprint or you got the MITM attack warning, port forwarding is disabled accordingly. You may need to check if you can forward a port anyhow. ssh -D 8888 remote-host. Delete the wrong fingerprint in .ssh/known_hosts and Volia.
I eventually found out that this issue is caused by a Windows upgrade enabling BBR congestion control.
When upgrading to Windows 11 24H2, BBR2 is somehow enabled by default for me, and it causes every connection to localhost hang silently after receiving ~32bytes. So there's no obvious error log in VSC.
The solution is to switch back to CUBIC using
netsh int tcp set supplemental Template=Internet CongestionProvider=CUBICor try this: https://learn.microsoft.com/en-us/answers/questions/3879946/fix-bbr2-bugs-on-windows-11Maybe considering adding this to troubleshooting wiki?
Dude!! I have been trying to work this out for DAYS!!
Thank you so much for the fix!