microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.7k stars 29.45k forks source link

Unable to ssh from the VSCode terminal when on Ethernet. #234389

Open holland11 opened 3 days ago

holland11 commented 3 days ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Open a vscode window.
  2. Open the vscode terminal.
  3. Be connected to the internet via Ethernet.
  4. Run ssh <user>@<hostname> with a valid ssh user+hostname.
  5. Watch as it fails with ssh: connect to host <hostname> port 22: Undefined error: 0
  6. Unplug the Ethernet cable and connect to WiFi.
  7. Re-run the ssh command.
  8. Watch as it succeeds.

I'd be surprised if other people can reproduce this. Other people on my team running the same vscode version as me do not have the same issue. But I have no idea how to resolve it.

This extends to my remote-ssh vscode windows as well. They fail to connect until I unplug my ethernet cable.

I've tried updating my vscode. I've tried deleting my vscode and reinstalling a new one. I've tried deleting my ~/Library/Application Support/Code. I've tried disabling all my extensions. I've tried updating my OS. I've tried using bash instead of zsh in my vscode terminal.

The ssh command works flawlessly on ethernet through my macOS terminal. It's only in the vscode terminal that it fails.

Here is the -v output of the ssh command on Ethernet:

> ssh -v <username>@<hostname>
OpenSSH_9.8p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/<username>/.ssh/config
debug1: /Users/<username>/.ssh/config line 5: Applying options for <hostname>
debug1: /Users/<username>/.ssh/config line 28: Applying options for *
debug1: Reading configuration data /usr/local/etc/esctool/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to <hostname> port 22.
ssh: connect to host <hostname> port 22: Undefined error: 0

and here it is on WiFi:

> ssh -v <username>@<hostname>
OpenSSH_9.8p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/<username>/.ssh/config
debug1: /Users/<username>/.ssh/config line 5: Applying options for <hostname>
debug1: /Users/<username>/.ssh/config line 28: Applying options for *
debug1: Reading configuration data /usr/local/etc/esctool/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to <hostname> port 22.
debug1: Connection established.
debug1: identity file /Users/<username>/.ssh/id_rsa type 0
debug1: identity file /Users/<username>/.ssh/id_rsa-cert type -1
debug1: identity file /Users/<username>/.ssh/id_ecdsa type -1
debug1: identity file /Users/<username>/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/<username>/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/<username>/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/<username>/.ssh/id_ed25519 type 3
debug1: identity file /Users/<username>/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/<username>/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/<username>/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/<username>/.ssh/id_xmss type -1
debug1: identity file /Users/<username>/.ssh/id_xmss-cert type -1
debug1: identity file /Users/<username>/.ssh/id_dsa type -1
debug1: identity file /Users/<username>/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.7
debug1: compat_banner: match: OpenSSH_9.7 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <hostname>:22 as '<username>'
debug1: load_hostkeys: fopen /Users/<username>/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: sntrup761x25519-sha512@openssh.com
debug1: kex: host key algorithm: ssh-ed25519
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: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:aRZ7XXWMs7oD6tZAQkCWZF6V4aqYA7R/cwZ0HkfrnZM
debug1: load_hostkeys: fopen /Users/<username>/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '<hostname>' is known and matches the ED25519 host key.
debug1: Found key in /Users/<username>/.ssh/known_hosts:75
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: Sending SSH2_MSG_EXT_INFO
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256>
debug1: kex_ext_info_check_ver: publickey-hostbound@openssh.com=<0>
debug1: kex_ext_info_check_ver: ping@openssh.com=<0>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256>
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/<username>/.ssh/id_rsa RSA SHA256:MahWBoxt59E4b4Z0nBFTp+g3TgDVqIBNh0CzbuBVGpA
debug1: Will attempt key: /Users/<username>/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/<username>/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /Users/<username>/.ssh/id_ed25519 ED25519 SHA256:IBzx/1VqqfsyviDpXyHo5lApEIAZw7TLm+t5cSNuRWg
debug1: Will attempt key: /Users/<username>/.ssh/id_ed25519_sk 
debug1: Will attempt key: /Users/<username>/.ssh/id_xmss 
debug1: Will attempt key: /Users/<username>/.ssh/id_dsa 
debug1: Offering public key: /Users/<username>/.ssh/id_rsa RSA SHA256:MahWBoxt59E4b4Z0nBFTp+g3TgDVqIBNh0CzbuBVGpA
debug1: Server accepts key: /Users/<username>/.ssh/id_rsa RSA SHA256:MahWBoxt59E4b4Z0nBFTp+g3TgDVqIBNh0CzbuBVGpA
Authenticated to <hostname> ([17.208.249.58]:22) using "publickey".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_hostkeys: searching /Users/<username>/.ssh/known_hosts for <hostname> / (none)
debug1: client_input_hostkeys: searching /Users/<username>/.ssh/known_hosts2 for <hostname> / (none)
debug1: client_input_hostkeys: hostkeys file /Users/<username>/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug1: Remote: /Users/<username>/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /Users/<username>/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: pledge: fork
Last login: Thu Nov 21 14:35:16 2024 from 17.208.249.163
gjsjohnmurray commented 3 days ago

Your message text describes the first transcript as being from the WiFi case and the second from the Ethernet case. I assume you mistyped, right?

holland11 commented 2 days ago

Your message text describes the first transcript as being from the WiFi case and the second from the Ethernet case. I assume you mistyped, right?

Yes, thanks for catching that. Sorry for the mixup.