microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.66k stars 286 forks source link

Remote-SSH stopped working on new versions of VSCode, remote listens to 127.0.0.1 and canot be changed #9963

Closed marke17 closed 4 months ago

marke17 commented 4 months ago

I'm currently using VSCode 1.90.0 from 6 days ago, on Linux Ubuntu 22.04 both on desktop and remote server.

I use Remote-SSH a lot in VSCode, and it used to work fine, but in recent versions it stopped working, and I cannot fix it.

Reason seams to be that remote code server listens to 127.0.0.1:, and I cannot find a way to change that.

I tried: "remote.localPortHost": "allInterfaces" "remote.SSH.remoteServerListenOnSocket": true, "remote.SSH.useLocalServer": false, "remote.SSH.showLoginTerminal": true, None of these helps, remote code server still listens to 127.0.0.1

Here's a screenshot:

image

It just hangs on "Waiting for port forwarding to be ready"

roblourens commented 4 months ago

Please share the log from the Remote-SSH output channel, thanks

Euruson commented 4 months ago

I have met the same issue, and I have already set Local Port Host to allInterfaces. But the forwarded port was still bound to localhost.

❯ sudo lsof -nP -iTCP:9999 | grep LISTEN

Code\x20H 56962 euruson   41u  IPv4 0x12884c225c99e811      0t0  TCP 127.0.0.1:9999 (LISTEN)

It works fine when I use ssh -L command in my terminal. The forwarded port can be accessed from LAN.

❯ sudo lsof -nP -iTCP:9999 | grep LISTEN

ssh     2200 euruson    4u  IPv4 0x76a2f94059cc14c0      0t0  TCP *:9999 (LISTEN)

Following is my log:

[16:55:13.940] Log Level: 2
[16:55:13.950] SSH Resolver called for "ssh-remote+pc-hkust", attempt 1
[16:55:13.950] "remote.SSH.useLocalServer": true
[16:55:13.950] "remote.SSH.useExecServer": true
[16:55:13.951] "remote.SSH.path": undefined
[16:55:13.951] "remote.SSH.configFile": undefined
[16:55:13.951] "remote.SSH.useFlock": true
[16:55:13.951] "remote.SSH.lockfilesInTmp": false
[16:55:13.951] "remote.SSH.localServerDownload": auto
[16:55:13.951] "remote.SSH.remoteServerListenOnSocket": false
[16:55:13.951] "remote.SSH.showLoginTerminal": false
[16:55:13.951] "remote.SSH.defaultExtensions": []
[16:55:13.951] "remote.SSH.loglevel": 2
[16:55:13.951] "remote.SSH.enableDynamicForwarding": true
[16:55:13.951] "remote.SSH.enableRemoteCommand": false
[16:55:13.951] "remote.SSH.serverPickPortsFromRange": {}
[16:55:13.951] "remote.SSH.serverInstallPath": {}
[16:55:13.954] VS Code version: 1.90.1
[16:55:13.954] Remote-SSH version: remote-ssh@0.112.0
[16:55:13.954] darwin arm64
[16:55:13.955] SSH Resolver called for host: pc-hkust
[16:55:13.955] Setting up SSH remote "pc-hkust"
[16:55:13.957] Acquiring local install lock: /var/folders/ww/hhwsd4yd6nxgwpnhswxfn6lr0000gn/T/vscode-remote-ssh-4904505e-install.lock
[16:55:13.957] Looking for existing server data file at /Users/euruson/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-4904505e-611f9bfce64f25108829dd295f54a6894e87339d-0.112.0-es/data.json
[16:55:13.958] Using commit id "611f9bfce64f25108829dd295f54a6894e87339d" and quality "stable" for server
[16:55:13.960] Install and start server if needed
[16:55:13.963] PATH: /Users/euruson/.zinit/polaris/bin:/Users/euruson/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
[16:55:13.963] Checking ssh with "ssh -V"
[16:55:13.969] > OpenSSH_9.6p1, LibreSSL 3.3.6

[16:55:13.971] askpass server listening on /var/folders/ww/hhwsd4yd6nxgwpnhswxfn6lr0000gn/T/vscode-ssh-askpass-dbac24f04d8d2c413cad3866cef72be29cfad7cd.sock
[16:55:13.971] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/ww/hhwsd4yd6nxgwpnhswxfn6lr0000gn/T/vscode-ssh-askpass-75a6ca9b69c5836af4b0e9139dffd32160bfc524.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","57695","-o","ConnectTimeout=15","pc-hkust","bash"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/euruson/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-4904505e-611f9bfce64f25108829dd295f54a6894e87339d-0.112.0-es/data.json"}
[16:55:13.971] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.raNQtJ43Vb/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/euruson/.vscode/extensions/ms-vscode-remote.remote-ssh-0.112.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"/Users/euruson/.vscode/extensions/ms-vscode-remote.remote-ssh-0.112.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/ww/hhwsd4yd6nxgwpnhswxfn6lr0000gn/T/vscode-ssh-askpass-dbac24f04d8d2c413cad3866cef72be29cfad7cd.sock"}
[16:55:13.971] Spawned 86213
[16:55:14.044] > local-server-1> Running ssh connection command: ssh -v -T -D 57695 -o ConnectTimeout=15 pc-hkust bash
[16:55:14.045] > local-server-1> Spawned ssh, pid=86220
[16:55:14.048] stderr> OpenSSH_9.6p1, LibreSSL 3.3.6
[16:55:14.168] stderr> debug1: Server host key: ssh-ed25519 SHA256:cBlGZ1q9IUtKUoGEeKFpqaR++8AKi5p62d8I1aFyQbk
[16:55:14.288] stderr> Authenticated to 10.5.181.3 ([10.5.181.3]:22) using "publickey".
[16:55:14.398] stderr> Warning: untrusted X11 forwarding setup failed: xauth key data not generated
[16:55:14.410] > ready: 11d7e470b221
[16:55:14.417] > Linux 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2
[16:55:14.417] Platform: linux
[16:55:14.425] > /bin/bash
[16:55:14.425] Shell: bash
[16:55:14.425] Creating bash subshell inside "bash"
[16:55:14.432] > bash version:  5.1.16(1)-release
[16:55:14.443] > 11d7e470b221: running
[16:55:14.451] > Found existing installation at /home/euruson/.vscode-server...
> Starting VS Code CLI... "/home/euruson/.vscode-server/code-611f9bfce64f25108829dd295f54a6894e87339d" command-shell --cli-data-dir "/home/euruson/.vscode-server/cli" --on-port --on-host=127.0.0.1 --parent-process-id 3570402 &> "/home/euruson/.vscode-server/.cli.611f9bfce64f25108829dd295f54a6894e87339d.log" < /dev/null
> printenv:
[16:55:14.452] >     SHELL=/bin/bash
>     LANGUAGE=en_US:en
>     LC_ADDRESS=en_US.UTF-8
>     LC_NAME=en_US.UTF-8
>     LC_MONETARY=en_US.UTF-8
>     PWD=/home/euruson
>     LOGNAME=euruson
>     XDG_SESSION_TYPE=tty
>     MOTD_SHOWN=pam
>     HOME=/home/euruson
>     LC_PAPER=en_US.UTF-8
>     LANG=en_US.UTF-8
>     VSCODE_AGENT_FOLDER=/home/euruson/.vscode-server
>     SSH_CONNECTION=10.5.164.137 57696 10.5.181.3 22
>     XDG_SESSION_CLASS=user
>     LC_IDENTIFICATION=en_US.UTF-8
>     USER=euruson
>     SHLVL=1
>     LC_TELEPHONE=en_US.UTF-8
>     LC_MEASUREMENT=en_US.UTF-8
>     XDG_SESSION_ID=5061
>     PAPERSIZE=letter
>     XDG_RUNTIME_DIR=/run/user/1000
>     SSH_CLIENT=10.5.164.137 57696 22
>     LC_TIME=en_US.UTF-8
>     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
>     DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
>     LC_NUMERIC=en_US.UTF-8
>     _=/usr/bin/printenv
[16:55:14.453] > Removing old logfile at /home/euruson/.vscode-server/.cli.611f9bfce64f25108829dd295f54a6894e87339d.log
[16:55:14.454] > Spawned remote CLI: 3570421
[16:55:14.469] > Waiting for server log...
[16:55:14.504] > 11d7e470b221: start
> SSH_AUTH_SOCK====
> DISPLAY====
> listeningOn==127.0.0.1:43135==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
[16:55:14.505] > platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==50==
> execServerToken==111a1111-111a-1111-11a1-aa1a1a11a1a1==
> 11d7e470b221: end
[16:55:14.506] Received install output: 
SSH_AUTH_SOCK====
DISPLAY====
listeningOn==127.0.0.1:43135==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==50==
execServerToken==111a1111-111a-1111-11a1-aa1a1a11a1a1==

[16:55:14.506] Remote server is listening on port 43135
[16:55:14.506] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":43135},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"111a1111-111a-1111-11a1-aa1a1a11a1a1"},"serverStartTime":50,"installUnpackCode":""}
[16:55:14.506] Persisting server connection details to /Users/euruson/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-4904505e-611f9bfce64f25108829dd295f54a6894e87339d-0.112.0-es/data.json
[16:55:14.507] Starting forwarding server. local port 57697 -> socksPort 57695 -> remotePort 43135
[16:55:14.508] Forwarding server listening on port 57697
[16:55:14.508] Waiting for ssh tunnel to be ready
[16:55:14.508] Tunneled port 43135 to local port 57697
[16:55:14.508] Resolved "ssh-remote+pc-hkust" to "port 57697"
[16:55:14.514] Initizing new exec server for ssh-remote+pc-hkust
[16:55:14.514] Resolving exec server at port 57697
[16:55:14.528] [Forwarding server port 57697] Got connection 0
[16:55:14.529] [Forwarding server port 57697] Got connection 1
[16:55:14.561] Exec server for ssh-remote+pc-hkust created and cached
[16:55:14.564] ------

[16:55:14.573] [server] Checking /home/euruson/.vscode-server/cli/servers/Stable-611f9bfce64f25108829dd295f54a6894e87339d/log.txt and /home/euruson/.vscode-server/cli/servers/Stable-611f9bfce64f25108829dd295f54a6894e87339d/pid.txt for a running server...
[16:55:14.617] [server] Found running server (pid=3566266)

My VS Code client:

Version: 1.90.1 (Universal)
Commit: 611f9bfce64f25108829dd295f54a6894e87339d
Date: 2024-06-11T21:02:41.372Z (2 days ago)
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0
kerrhome commented 4 months ago

Experiencing the same. Log similar to @Euruson. Started happening yesterday. I was at least one update behind, if not two.

cohenchris commented 4 months ago

Same thing here, same version.

I know this is not helpful or practical for everybody, but I just deleted the remote .vscode-server/ directory, and all was resolved.

kerrhome commented 4 months ago

Same thing here, same version.

I know this is not helpful or practical for everybody, but I just deleted the remote .vscode-server/ directory, and all was resolved.

I tried that as well, before I posted, and it seemed to work for me once and then went back to failing.

rgulden commented 4 months ago

Hey folks, i think im facing a similar issue. Since updating the remote SSH app doesnt seem to respect my serverPickPortsFromRange. Its selecting any port it wants.

connor4312 commented 4 months ago

duplicates https://github.com/microsoft/vscode-remote-release/issues/9809, should be fixed in the latest SSH prerelase

rgulden commented 3 months ago

duplicates #9809, should be fixed in the latest SSH prerelase

@connor4312 -- I think similarly, it no longer is respecting ServerPickPorts From Range. Do you know of any plans to fix this also? I see in the logs before it passes --on-host=x.x.x.x as a parameter it passes --on-port but doesnt give it a value?

cc' @roblourens