Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remote-SSH Bug]: Invalid Character in hostname #9370

Closed
3 tasks done
TrainedMusician opened this issue Jan 8, 2024 · 14 comments
Closed
3 tasks done

[Remote-SSH Bug]: Invalid Character in hostname #9370

TrainedMusician opened this issue Jan 8, 2024 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH verified Verification succeeded
Milestone

Comments

@TrainedMusician
Copy link

TrainedMusician commented Jan 8, 2024

Is there an existing issue for this bug?

  • I have searched the existing issues

Required Troubleshooting Steps

  • I have followed these troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting

Connect Locally

It doesn’t connect successfully (same error message)

->

No response

Expected Behavior

I have several hosts in my config file and some of them contain spaces in their nicknames. The true hostnames are never containing spaces of course but the names I use can follow the same syntax like "ServerA v2.0" and because there is a space in the name I quote them for a long period of time without any issues. But this morning I cannot connect to these instances anymore unless I replace the space with anything

Steps To Reproduce

  1. Create a host in your config with a space in the host name (not HostName)
    Host "ServerA v2.0"
    HostName website.domain.com
    User ubuntu
    IdentityFile {myKey}
  2. Refresh the Remote Explorer and try to connect
  3. Change the Host name and replace the space with a hyphen "ServerA-v2.0" (quotes can remain but are now unnecessary)
  4. Refresh the Remote Explorer and you can connect successfully!

Remote-SSH Log

Crashing Remote-SSH Log

[09:32:01.533] Log Level: 2
[09:32:01.543] VS Code version: 1.85.1
[09:32:01.543] Remote-SSH version: remote-ssh@0.107.1
[09:32:01.543] linux x64
[09:32:01.545] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a225465737420506f7274616c2076312e362e30227d", attempt 1
[09:32:01.545] "remote.SSH.useLocalServer": true
[09:32:01.545] "remote.SSH.useExecServer": false
[09:32:01.545] "remote.SSH.path": undefined
[09:32:01.545] "remote.SSH.configFile": undefined
[09:32:01.545] "remote.SSH.useFlock": true
[09:32:01.546] "remote.SSH.lockfilesInTmp": false
[09:32:01.546] "remote.SSH.localServerDownload": auto
[09:32:01.546] "remote.SSH.remoteServerListenOnSocket": false
[09:32:01.546] "remote.SSH.showLoginTerminal": false
[09:32:01.546] "remote.SSH.defaultExtensions": []
[09:32:01.546] "remote.SSH.loglevel": 2
[09:32:01.546] "remote.SSH.enableDynamicForwarding": true
[09:32:01.547] "remote.SSH.enableRemoteCommand": false
[09:32:01.547] "remote.SSH.serverPickPortsFromRange": {}
[09:32:01.547] "remote.SSH.serverInstallPath": {}
[09:32:01.556] SSH Resolver called for host: ServerA v2.0
[09:32:01.556] Setting up SSH remote "ServerA v2.0"
[09:32:01.559] Acquiring local install lock: /tmp/vscode-remote-ssh-a0dad0bc-install.lock
[09:32:01.560] Looking for existing server data file at /home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-a0dad0bc-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-tr/data.json
[09:32:01.560] Using commit id "0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2" and quality "stable" for server
[09:32:01.563] Install and start server if needed
[09:32:01.567] PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/path/to/driver
[09:32:01.570] Checking ssh with "ssh -V"
[09:32:01.578] > OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022

[09:32:01.583] askpass server listening on /run/user/1000/vscode-ssh-askpass-29a2ff12ee05623ccba34700169afab43decbc31.sock
[09:32:01.584] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-43eb2cdc69b0b23fa3ef402aad104ed138d85267.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","44109","-o","ConnectTimeout=15","ServerA v2.0"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-a0dad0bc-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-tr/data.json"}
[09:32:01.584] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/148/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-29a2ff12ee05623ccba34700169afab43decbc31.sock"}
[09:32:01.588] Spawned 6985
[09:32:01.696] > local-server-1> Running ssh connection command: "-v -T -D 44109 -o ConnectTimeout=15 ServerA v2.0"
[09:32:01.700] > local-server-1> Spawned ssh, pid=6993
[09:32:01.702] stderr> hostname contains invalid characters
[09:32:01.704] > local-server-1> ssh child died, shutting down
[09:32:01.707] Local server exit: 0
[09:32:01.707] Received install output: local-server-1> Running ssh connection command: "-v -T -D 44109 -o ConnectTimeout=15 ServerA v2.0"
local-server-1> Spawned ssh, pid=6993
hostname contains invalid characters
local-server-1> ssh child died, shutting down

[09:32:01.708] Failed to parse remote port from server output
[09:32:01.710] Resolver error: Error: 
	at g.Create (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:642703)
	at t.handleInstallOutput (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:640069)
	at e (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:700300)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:722169
	at async t.withShowDetailsEvent (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:725828)
	at async /home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:697005
	at async C (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:695056)
	at async t.resolveWithLocalServer (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:696545)
	at async I (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:719392)
	at async t.resolve (/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:723199)
	at async /home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/extension.js:2:907003
[09:32:01.715] ------




[09:32:02.072] Opening exec server for ssh-remote+7b22686f73744e616d65223a225465737420506f7274616c2076312e362e30227d
[09:32:02.145] Initizing new exec server for ssh-remote+7b22686f73744e616d65223a225465737420506f7274616c2076312e362e30227d
[09:32:02.170] Acquiring local install lock: /tmp/vscode-remote-ssh-a0dad0bc-install.lock
[09:32:02.205] Looking for existing server data file at /home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-a0dad0bc-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-es/data.json
[09:32:02.207] Using commit id "0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2" and quality "stable" for server
[09:32:02.213] Install and start server if needed
[09:32:02.291] askpass server listening on /run/user/1000/vscode-ssh-askpass-4f21dc585f46330d089ef3bf3d7b1ef869608977.sock
[09:32:02.293] Spawning local server with {"serverId":2,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-a205f82751dc634776d58f9f67139d3ed026c841.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","38155","-o","ConnectTimeout=15","ServerA v2.0"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-a0dad0bc-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-es/data.json"}
[09:32:02.295] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/148/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-4f21dc585f46330d089ef3bf3d7b1ef869608977.sock"}
[09:32:02.312] Spawned 7012
[09:32:02.468] > local-server-2> Running ssh connection command: "-v -T -D 38155 -o ConnectTimeout=15 ServerA v2.0"
[09:32:02.472] > local-server-2> Spawned ssh, pid=7020
[09:32:02.477] stderr> hostname contains invalid characters
[09:32:02.479] > local-server-2> ssh child died, shutting down
[09:32:02.483] Local server exit: 0
[09:32:02.484] Received install output: local-server-2> Running ssh connection command: "-v -T -D 38155 -o ConnectTimeout=15 ServerA v2.0"
local-server-2> Spawned ssh, pid=7020
hostname contains invalid characters
local-server-2> ssh child died, shutting down

[09:32:02.484] Failed to parse remote port from server output
[09:32:02.486] Exec server for ssh-remote+7b22686f73744e616d65223a225465737420506f7274616c2076312e362e30227d failed: Error
[09:32:02.486] Error opening exec server for ssh-remote+7b22686f73744e616d65223a225465737420506f7274616c2076312e362e30227d: Error

Working Remote-SSH Log

[09:34:03.232] Log Level: 2
[09:34:03.253] SSH Resolver called for "ssh-remote+ServerA-v2.0", attempt 1
[09:34:03.253] "remote.SSH.useLocalServer": true
[09:34:03.253] "remote.SSH.useExecServer": false
[09:34:03.254] "remote.SSH.path": undefined
[09:34:03.254] "remote.SSH.configFile": undefined
[09:34:03.254] "remote.SSH.useFlock": true
[09:34:03.255] "remote.SSH.lockfilesInTmp": false
[09:34:03.255] "remote.SSH.localServerDownload": auto
[09:34:03.255] "remote.SSH.remoteServerListenOnSocket": false
[09:34:03.255] "remote.SSH.showLoginTerminal": false
[09:34:03.255] "remote.SSH.defaultExtensions": []
[09:34:03.255] "remote.SSH.loglevel": 2
[09:34:03.255] "remote.SSH.enableDynamicForwarding": true
[09:34:03.255] "remote.SSH.enableRemoteCommand": false
[09:34:03.256] "remote.SSH.serverPickPortsFromRange": {}
[09:34:03.256] "remote.SSH.serverInstallPath": {}
[09:34:03.266] VS Code version: 1.85.1
[09:34:03.266] Remote-SSH version: remote-ssh@0.107.1
[09:34:03.267] linux x64
[09:34:03.269] SSH Resolver called for host: ServerA-v2.0
[09:34:03.269] Setting up SSH remote "ServerA-v2.0"
[09:34:03.272] Acquiring local install lock: /tmp/vscode-remote-ssh-6e29a811-install.lock
[09:34:03.273] Looking for existing server data file at /home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-6e29a811-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-tr/data.json
[09:34:03.273] Using commit id "0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2" and quality "stable" for server
[09:34:03.277] Install and start server if needed
[09:34:03.283] PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/path/to/driver
[09:34:03.283] Checking ssh with "ssh -V"
[09:34:03.300] > OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022

[09:34:03.307] askpass server listening on /run/user/1000/vscode-ssh-askpass-8e603292e66269cb4c659ffac03617c034f7d18c.sock
[09:34:03.309] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-3a44a82cc94791fd9ab1412e70a2ba3617a21af9.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","44451","-o","ConnectTimeout=15","ServerA-v2.0"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-6e29a811-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-tr/data.json"}
[09:34:03.311] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/148/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-8e603292e66269cb4c659ffac03617c034f7d18c.sock"}
[09:34:03.317] Spawned 7202
[09:34:03.443] > local-server-1> Running ssh connection command: "-v -T -D 44451 -o ConnectTimeout=15 ServerA-v2.0"
[09:34:03.449] > local-server-1> Spawned ssh, pid=7210
[09:34:03.452] stderr> OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022
[09:34:03.597] stderr> debug1: Server host key: ssh-ed25519 SHA256:KZXiIGizICoB4vVzsfr15Egsvyljj3I8wECvtmFaa/0
[09:34:03.812] stderr> Authenticated to dev.stratominer.com ([52.215.28.186]:22) using "publickey".
[09:34:04.291] > Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1051-aws aarch64)
> 
>  * Documentation:  https://help.ubuntu.com
>  * Management:     https://landscape.canonical.com
>  * Support:        https://ubuntu.com/advantage
> 
>   System information as of Mon Jan  8 08:34:03 UTC 2024
> 
>   System load:  0.07              Processes:             147
>   Usage of /:   43.7% of 7.58GB   Users logged in:       0
>   Memory usage: 27%               IPv4 address for ens5: 172.31.38.69
>   Swap usage:   0%
> 
>  * Ubuntu Pro delivers the most comprehensive open source security and
>    compliance features.
> 
>    https://ubuntu.com/aws/pro
> 
> Expanded Security Maintenance for Applications is not enabled.
> 
> 1 update can be applied immediately.
> To see these additional updates run: apt list --upgradable
> 
> 5 additional security updates can be applied with ESM Apps.
> Learn more about enabling ESM Apps service at https://ubuntu.com/esm
> 
> New release '22.04.3 LTS' available.
> Run 'do-release-upgrade' to upgrade to it.
> 
[09:34:04.312] > ready: ccbe43c26144
[09:34:04.336] > Linux 5.15.0-1051-aws #56~20.04.1-Ubuntu SMP Tue Nov 28 15:43:06 UTC 2023
[09:34:04.336] Platform: linux
[09:34:04.359] > /bin/bash
[09:34:04.359] Shell: bash
[09:34:04.359] Creating bash subshell inside "bash"
[09:34:04.384] > bash version:  5.0.17(1)-release
[09:34:04.438] > ccbe43c26144: running
[09:34:04.467] > Acquiring lock on /home/ubuntu/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/vscode-remote-lock.ubuntu.0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
[09:34:04.471] > Found existing installation at /home/ubuntu/.vscode-server/bin/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2...
> Checking /home/ubuntu/.vscode-server/.0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2.log and /home/ubuntu/.vscode-server/.0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2.pid for a running server
[09:34:04.473] > Looking for server with pid: 707418
[09:34:04.486] > Found running server...
[09:34:04.487] >  
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
> *
>  
[09:34:04.501] > Checking server status on port 34199 with wget
[09:34:04.510] > ccbe43c26144: start
> SSH_AUTH_SOCK====
> DISPLAY====
> webUiAccessToken====
> listeningOn==34199==
> osReleaseId==ubuntu==
> arch==aarch64==
> vscodeArch==arm64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> connectionToken==aa111111-a1a1-1111-11aa-a11111a1aa11==
> ccbe43c26144: end
[09:34:04.510] Received install output: 
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==34199==
osReleaseId==ubuntu==
arch==aarch64==
vscodeArch==arm64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==aa111111-a1a1-1111-11aa-a11111a1aa11==

[09:34:04.510] Remote server is listening on port 34199
[09:34:04.510] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":34199},"osReleaseId":"ubuntu","arch":"aarch64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"aa111111-a1a1-1111-11aa-a11111a1aa11"},"installUnpackCode":""}
[09:34:04.511] ** Note: Support for architecture "aarch64" is in preview **
[09:34:04.511] Persisting server connection details to /home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-6e29a811-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-tr/data.json
[09:34:04.514] Starting forwarding server. local port 43597 -> socksPort 44451 -> remotePort 34199
[09:34:04.514] Forwarding server listening on port 43597
[09:34:04.514] Waiting for ssh tunnel to be ready
[09:34:04.515] [Forwarding server port 43597] Got connection 0
[09:34:04.516] Tunneled port 34199 to local port 43597
[09:34:04.516] Resolved "ssh-remote+ServerA-v2.0" to "port 43597"
[09:34:04.526] ------




[09:34:04.586] [Forwarding server port 43597] Got connection 1
[09:34:04.646] [Forwarding server port 43597] Got connection 2
[09:34:05.231] Opening exec server for ssh-remote+ServerA-v2.0
[09:34:05.236] Initizing new exec server for ssh-remote+ServerA-v2.0
[09:34:05.253] Acquiring local install lock: /tmp/vscode-remote-ssh-6e29a811-install.lock
[09:34:05.264] Looking for existing server data file at /home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-6e29a811-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-es/data.json
[09:34:05.265] Using commit id "0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2" and quality "stable" for server
[09:34:05.270] Install and start server if needed
[09:34:05.303] askpass server listening on /run/user/1000/vscode-ssh-askpass-26251ede7fa315ceb09254ce9cbc1007f98f5d1c.sock
[09:34:05.303] Spawning local server with {"serverId":2,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-102a3252c129d57622042fb8c6d49350d91c8989.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","33265","-o","ConnectTimeout=15","ServerA-v2.0"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-6e29a811-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-es/data.json"}
[09:34:05.303] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/148/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/job/.vscode/extensions/ms-vscode-remote.remote-ssh-0.107.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-26251ede7fa315ceb09254ce9cbc1007f98f5d1c.sock"}
[09:34:05.308] Spawned 7216
[09:34:05.455] > local-server-2> Running ssh connection command: "-v -T -D 33265 -o ConnectTimeout=15 ServerA-v2.0"
[09:34:05.469] > local-server-2> Spawned ssh, pid=7225
[09:34:05.477] stderr> OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022
[09:34:05.595] stderr> debug1: Server host key: ssh-ed25519 SHA256:KZXiIGizICoB4vVzsfr15Egsvyljj3I8wECvtmFaa/0
[09:34:05.853] stderr> Authenticated to dev.stratominer.com ([52.215.28.186]:22) using "publickey".
[09:34:06.502] > Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1051-aws aarch64)
> 
>  * Documentation:  https://help.ubuntu.com
>  * Management:     https://landscape.canonical.com
>  * Support:        https://ubuntu.com/advantage
> 
>   System information as of Mon Jan  8 08:34:05 UTC 2024
> 
>   System load:  0.07              Processes:             153
>   Usage of /:   43.7% of 7.58GB   Users logged in:       0
>   Memory usage: 31%               IPv4 address for ens5: 172.31.38.69
>   Swap usage:   0%
> 
>   => There is 1 zombie process.
> 
>  * Ubuntu Pro delivers the most comprehensive open source security and
>    compliance features.
> 
>    https://ubuntu.com/aws/pro
> 
> Expanded Security Maintenance for Applications is not enabled.
> 
> 1 update can be applied immediately.
> To see these additional updates run: apt list --upgradable
> 
> 5 additional security updates can be applied with ESM Apps.
> Learn more about enabling ESM Apps service at https://ubuntu.com/esm
> 
> New release '22.04.3 LTS' available.
> Run 'do-release-upgrade' to upgrade to it.
> 
[09:34:06.525] > ready: 7c8c9ee17c6a
[09:34:06.561] > Linux 5.15.0-1051-aws #56~20.04.1-Ubuntu SMP Tue Nov 28 15:43:06 UTC 2023
[09:34:06.561] Platform: linux
[09:34:06.586] > /bin/bash
[09:34:06.586] Shell: bash
[09:34:06.587] Creating bash subshell inside "bash"
[09:34:06.619] > bash version:  5.0.17(1)-release
[09:34:06.646] > 7c8c9ee17c6a: running
[09:34:06.700] > Found existing installation at /home/ubuntu/.vscode-server...
> Running ssh connection command... /home/ubuntu/.vscode-server/code-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2 command-shell --cli-data-dir /home/ubuntu/.vscode-server/cli --on-port --require-token dadb78f619f6 --parent-process-id 708259 &> "/home/ubuntu/.vscode-server/.cli.0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2.log" < /dev/null
> printenv:
[09:34:06.702] >     SHELL=/bin/bash
>     LC_ADDRESS=C.UTF-8
>     LC_NAME=C.UTF-8
>     LC_MONETARY=C.UTF-8
>     PWD=/home/ubuntu
>     LOGNAME=ubuntu
>     XDG_SESSION_TYPE=tty
>     MOTD_SHOWN=pam
>     HOME=/home/ubuntu
>     LANG=C.UTF-8
>     LC_PAPER=C.UTF-8
>     VSCODE_AGENT_FOLDER=/home/ubuntu/.vscode-server
>     SSH_CONNECTION=82.174.85.36 58606 172.31.38.69 22
>     XDG_SESSION_CLASS=user
>     LC_IDENTIFICATION=C.UTF-8
>     USER=ubuntu
>     SHLVL=1
>     LC_TELEPHONE=C.UTF-8
>     LC_MEASUREMENT=C.UTF-8
>     XDG_SESSION_ID=1520
>     XDG_RUNTIME_DIR=/run/user/1000
>     SSH_CLIENT=82.174.85.36 58606 22
>     LC_TIME=C.UTF-8
>     XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
>     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=C.UTF-8
>     _=/usr/bin/printenv
[09:34:06.705] > Removing old logfile at /home/ubuntu/.vscode-server/.cli.0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2.log
[09:34:06.709] > Spawned remote CLI: 708278
[09:34:06.717] > Waiting for server log...
[09:34:06.781] > 7c8c9ee17c6a: start
> SSH_AUTH_SOCK====
> DISPLAY====
> listeningOn==127.0.0.1:41643==
> osReleaseId==ubuntu==
> arch==aarch64==
> vscodeArch==arm64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==75==
> execServerToken==dadb78f619f6==
> 7c8c9ee17c6a: end
[09:34:06.781] Received install output: 
SSH_AUTH_SOCK====
DISPLAY====
listeningOn==127.0.0.1:41643==
osReleaseId==ubuntu==
arch==aarch64==
vscodeArch==arm64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==75==
execServerToken==dadb78f619f6==

[09:34:06.781] Remote server is listening on port 41643
[09:34:06.781] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":41643},"osReleaseId":"ubuntu","arch":"aarch64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"dadb78f619f6"},"serverStartTime":75,"installUnpackCode":""}
[09:34:06.781] ** Note: Support for architecture "aarch64" is in preview **
[09:34:06.782] Persisting server connection details to /home/job/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-6e29a811-0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2-0.107.1-es/data.json
[09:34:06.784] Starting forwarding server. local port 34743 -> socksPort 33265 -> remotePort 41643
[09:34:06.784] Forwarding server listening on port 34743
[09:34:06.784] Waiting for ssh tunnel to be ready
[09:34:06.785] [Forwarding server port 34743] Got connection 0
[09:34:06.786] Tunneled port 41643 to local port 34743
[09:34:06.786] Resolved "ssh-remote+ServerA-v2.0" to "port 34743"
[09:34:06.786] Resolving exec server at port 34743
[09:34:06.787] [Forwarding server port 34743] Got connection 1
[09:34:06.876] Exec server for ssh-remote+ServerA-v2.0 created and cached

Anything else?

If anyone knows why this happens now, as it worked fine for I would say a year that would be great! Looking into the logs I can see why it happens with the command at 09:32:02.468 where the host name is not escaped (anymore) and I would love this functionality to return again :)

Here are my OS facts:
Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 5.15.0-91-generic snap

@TrainedMusician TrainedMusician added the ssh Issue in vscode-remote SSH label Jan 8, 2024
mberneaud added a commit to mberneaud/data-engineering-setup that referenced this issue Jan 10, 2024
…mote -ssh interaction

Currently, the suggested ssh config file configuration does not work, because it contains unescaped spaces. Unless a fix is deployed by the developers of the remote-ssh extension, hostnames with spaces make it unable to connect to the host, because an invalid character error is raised somewhere. 
See the following issue on the extension page: microsoft/vscode-remote-release#9370 

I had the issue appear for me in the bootcamp yesterday and it took me a good 6 hours to find the fix. 

Assuming that it might take Microsoft a while to deploy a fix, I suggest changing the suggested naming for the host to not contain any spaces.
@roblourens roblourens added the bug Issue identified by VS Code Team member as probable bug label Jan 10, 2024
@fire-flying
Copy link

I'm having the same issue. this is my ssh config and error logs.

ssh config

Host local(root)

    HostName 127.0.0.1

    User root
error logs

[21:12:25.761] Looking for existing server data file at /home/fire/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-2d599263-8b3775030ed1a69b13e4f4c628c612102e30a681-0.108.2023112915-tr/data.json

[21:12:25.761] Using commit id "8b3775030ed1a69b13e4f4c628c612102e30a681" and quality "stable" for server

[21:12:25.764] Install and start server if needed

[21:12:25.766] PATH: /home/fire/.local/bin:/home/fire/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

[21:12:25.766] Checking ssh with "ssh -V"

[21:12:25.774] > OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022

[21:12:25.777] Using SSH config file "/home/fire/.ssh/config"

[21:12:25.777] askpass server listening on /run/user/1000/vscode-ssh-askpass-a76cac33e41ba7ec6f9bc9262c38d1625a0445f8.sock

[21:12:25.778] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-6e247d4dc050739c76734f2e73329099315dc35d.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","43343","-o","ConnectTimeout=15","-F","/home/fire/.ssh/config","local(root)"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/fire/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-2d599263-8b3775030ed1a69b13e4f4c628c612102e30a681-0.108.2023112915-tr/data.json"}

[21:12:25.778] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-a76cac33e41ba7ec6f9bc9262c38d1625a0445f8.sock"}

[21:12:25.782] Spawned 22381

[21:12:25.860] > local-server-1> Running ssh connection command: "-v -T -D 43343 -o ConnectTimeout=15 -F /home/fire/.ssh/config local(root)"

[21:12:25.863] > local-server-1> Spawned ssh, pid=22390

[21:12:25.866] stderr> hostname contains invalid characters

[21:12:25.867] > local-server-1> ssh child died, shutting down

[21:12:25.872] Local server exit: 0

[21:12:25.872] Received install output: local-server-1> Running ssh connection command: "-v -T -D 43343 -o ConnectTimeout=15 -F /home/fire/.ssh/config local(root)"

local-server-1> Spawned ssh, pid=22390

hostname contains invalid characters

local-server-1> ssh child died, shutting down

[21:12:25.873] Failed to parse remote port from server output

[21:12:25.874] Resolver error: Error:

at g.Create (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:642703)

at t.handleInstallOutput (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:640069)

at e (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:700300)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async /home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:722169

at async t.withShowDetailsEvent (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:725828)

at async /home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:697005

at async C (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:695056)

at async t.resolveWithLocalServer (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:696545)

at async I (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:719392)

at async t.resolve (/home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:723199)

at async /home/fire/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.2023112915/out/extension.js:2:907012

[21:12:25.878] ------

@ivanjx
Copy link

ivanjx commented Feb 22, 2024

space character also does not work. my ssh/config:

Host hostnamee
  HostName 10.10.20.5
  User "User 2"

vscode tries to connect to 2@10.10.20.5 instead. same issue as #3560 which is already marked as fixed for some reason which is clearly false.

@TrainedMusician
Copy link
Author

vscode tries to connect to 2@10.10.20.5 instead. same issue as #3560 which is already marked as fixed for some reason which is clearly false.

It might've been solved at that time but since 2024 I am experiencing issues again with it. So I hope it's solved soon!

@alexanderdevm
Copy link

same issue here statring version 1.87.2, and mac os sonoma 14.4

The following does not work:

Host "Test Ubuntu"
  HostName xxx.xxx.xxx.xxx
  User test

However once the dash replaces space, it now works:

Host "Test-Ubuntu"
  HostName xxx.xxx.xxx.xxx
  User test

@Zei33
Copy link

Zei33 commented Mar 26, 2024

@alexanderdevm No luck on my end replacing those spaces. This started occurring after I upgraded to Sonoma 14.4. I think it's becoming clear that this is a MacOS issue. None of my SSH configs using an IP as the HostName value work anymore. Only the one that uses a domain name instead. This is pretty major issue. Surprised it hasn't been mentioned more often.

image

This doesn't work ^ (IP changed for privacy).

Screenshot 2024-03-26 at 6 10 24 PM

This will work.

Update: Changing the Host parameter to the IP address you're trying to connect to (from the label e.g. "Test Ubuntu") will make it work. Although that shouldn't be necessary because in the past it's always worked as intended.

Update 2: Scratch all of that. I tested removing the space from the Host string and then restarted VS code this time. It works. So it's definitely the space causing issues.

@amtoaer
Copy link

amtoaer commented Mar 26, 2024

Encountered the same issue on Sonoma 14.4. Here's my SSH configuration:

Host 办公 work
  HostName 10.10.250.250
  User amtoaer
  IdentityFile /Users/amtoaer/.ssh/work

Using ssh work is fine, but trying ssh 办公 gives an error saying "invalid character in hostname". This suggests that Non-ASCII characters might not work as expected.

Additionally, it seems that Remote-SSH is using the system's SSH command. This could be a MacOS issue rather than Visual Studio Code's?

@Zei33
Copy link

Zei33 commented Mar 26, 2024

@amtoaer can you try changing the Host value to

Host "办公work"

Then restart your VS code and try to connect. I bet it works without the space.

@amtoaer
Copy link

amtoaer commented Mar 26, 2024

No, it doesn't. The space between '办公' and 'work' means they are two aliases for the below configuration.
If I remove the space and put them in double quotes, I will get:
image
For the original configuration, I will get:
image
This indicates that in my situation, the influencing factors are non-ASCII characters rather than spaces.

@NCRonB
Copy link

NCRonB commented Apr 18, 2024

I was hit by this same problem, and I found that it's due to security fixes in OpenSSH 9.6. See the git commit with the changes for the specific characters that are not allowed in the hostname and username provided on the command line, but it includes spaces, parentheses, and most special characters.

It looks like the only solution is to not use those characters for the Host in ssh config anymore.

@waldirio
Copy link

waldirio commented May 3, 2024

Hello,

I'm also facing the same issue. I understand that the change mentioned above could be the root cause of this behavior. However, is that possible/feasible to add a check on this Remote - SSH extension to do a crosscheck on the Host entries, just to check if they are valid or not? then let the customer know if that is a valid/invalid option.

This will be the must. At this moment, I believe a lot of customers will spend some time trying and failing, and eventually, they will check the upstream, check for the issues, apply some queries, and at the end of the day, end up on this Issue.

As we know, most of the customers will not find this issue :), they will try, fail and probably will stop, or maybe will just remove the extension, because they were not able to set a friendly label for the servers.

Thank you for all your help and congrats on this amazing extension.
Waldirio

@d11-jwaring
Copy link

I have this same error on Mac Sonoma 14.4.1, Remote-SSH v0.110.1.

I've used the same ssh config for years and the issue started occurring for me a few weeks ago.

Replacing the spaces in all of my hostnames with underscores resolved this for me. Would be great to have spaces back in hostnames though.

@roblourens roblourens added this to the May 2024 milestone May 18, 2024
@roblourens
Copy link
Member

roblourens commented May 18, 2024

Pushed a fix to at least surface this error properly to the UI:
image

Hope that helps but I don't think I can do much else on my end.

@amunger amunger added the verified Verification succeeded label May 29, 2024
@amunger
Copy link

amunger commented May 29, 2024

I was able to successfully connect to a host name with a space

Host "Ubuntu machine"
  User aamunger
  HostName xx.xx.xx.xx
  IdentityFile C:\temp\workboxKey.pem

@roblourens
Copy link
Member

This is a change from the latest ssh version, I think you need 9.6 to verify this. macOS should have that, Windows will probably be behind unless you install it manually.

@roblourens roblourens removed the verified Verification succeeded label May 30, 2024
@connor4312 connor4312 added the verified Verification succeeded label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH verified Verification succeeded
Projects
None yet
Development

No branches or pull requests