Vscode-remote-release: Can't connect to Ubuntu: unreachable or not Linux x86_64 - IO is still pending on closed socket

Created on 3 May 2019  Â·  14Comments  Â·  Source: microsoft/vscode-remote-release

  • VSCode Version: 1.34.0-insider (user setup)
  • Local OS Version: Windows 10 Build 1803
  • Remote OS Version: Xubuntu 16.04 (4.15.0-47-generic x86_64)
  • Remote Extension/Connection Type: SSH

Steps to Reproduce:

  1. Click the "Connect to Host in New Window" on the Remote-SSH connections explorer
  2. Wait a few seconds and show this error message:
Can't connect to Ubuntu: unreachable or not Linux x86_64 (close - IO is still pending on closed socket. read:1, write:0, io:000001F7A38762B0)


Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Yes

I specify to use C:\Users\Roy_Chen\.ssh\config:

Host Ubuntu
    HostName 10.144.44.42
    User roy

I can use the Windows ssh command to connect to 10.144.44.42 with key based authentication.

If I let the vscode terminal panel keep open, I can see the welcome message of my remote server.

After checked the sshd journal logs, it turned out that vscode disconnect from the server for unknown reasons.

 5月 03 16:37:57 Xubuntu1604 sshd[4484]: Accepted publickey for roy from 10.144.44.44 port 63422 ssh2: RSA SHA256:SOdmHm2QTYMkwP92+Htc4hSyQQ9uEYHh0QOZLMLsVHk
 5月 03 16:37:57 Xubuntu1604 sshd[4484]: pam_unix(sshd:session): session opened for user roy by (uid=0)
 5月 03 16:37:57 Xubuntu1604 systemd-logind[852]: New session 163 of user roy.
 5月 03 16:37:57 Xubuntu1604 systemd[1]: Started Session 163 of user roy.
 5月 03 16:37:58 Xubuntu1604 sshd[4514]: Received disconnect from 10.144.44.44 port 63422:11: disconnected by user
 5月 03 16:37:58 Xubuntu1604 sshd[4514]: Disconnected from 10.144.44.44 port 63422
 5月 03 16:37:58 Xubuntu1604 sshd[4484]: pam_unix(sshd:session): session closed for user roy
 5月 03 16:37:58 Xubuntu1604 systemd-logind[852]: Removed session 163.
needs-more-info ssh

Most helpful comment

If I change the ssh client from openssh to the git ssh located at C:\\Progra~1\\Git\\usr\\bin\\ssh.exe then everything will be fine.

Can you tell me how to replace it? Thank you

Step 1: Find the remote ssh extension file, in general at C:\Users\<YOUR_NAME>\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-<CURRENT_VERSION>\out\extension.js.

Step 2: Open extension.js, search the function named getSshCommand , you may got about 3 matches, in front of the first one, you can find the function function h(){return d}.

Step 3: Modify the function h , change the return value to your ssh client path, for example,

function h(){
  return "C:\\Progra~1\\Git\\usr\\bin\\ssh.exe"
}

The last step before this trick works, just save and relaunch vscode or reload window with ctrl + shift + p. 👻

@xluos

All 14 comments

Doc feedback verbatim with similar issue:

"tried the remote extension but got following error on all test hosts: Cant connect to xxx_host: unreachable or not Linux x86_64 (ory). the ssh client is in the path and verified to be able to access all of the test nodes from windows prompt cmdline."

@roycyt could you share the full contents of the "Remote - SSH" output channel?

got the same problem. all outputs in remote-ssh window below:

Confirming that test-server-97 is a valid reachable host
Running type "C:\Users\DOM~1\AppData\Local\Temp\vscode-linux-multi-line-command-test-server-97.sh" | ssh  test-server-97 to confirm the host platform
> 
> Pseudo-terminal will not be allocated because stdin is not a terminal.
> 
> Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-131-generic x86_64)
> 
>  * Documentation:  https://help.ubuntu.com
>  * Management:     https://landscape.canonical.com
>  * Support:        https://ubuntu.com/advantage
> Linux x86_64
> 10
>  - IO is still pending on closed socket. read:1, write:0, io:000001EA9C8CAC
"uname" terminal command done
test-server-97: unreachable or not Linux x86_64. ( - IO is still pending on closed socket. read:1, write:0, io:000001EA9C8CAC)

hello, after read the code of this extension I made some change:

t.generateMultiLineCommand = async function (e, t, n) { 
const r = c(e); 
if (i.isWindows) { 
if (!process.env.TEMP) throw new Error("The TEMP environment variable must be set");
 const i = s.join(process.env.TEMP, `vscode-linux-multi-line-command-${e.hostName}.sh`);
 return new Promise(e => {
 o.writeFile(i, t, t => { if (t) throw new Error(`Failed to write install script to path ${i}. ${t.message}`);
//add -t -t here
 e(`type "${i}" | ${h()} -t -t ${u(n)} ${r}`) }) }) 
} 
return `${h()} -t -t ${await l(e)} ${u(n)} ${r} << 'EOSSH'\n${t}\nEOSSH`
 }

command generated:

type "C:\Users\DOM~1\AppData\Local\Temp\vscode-linux-multi-line-command-test.sh" | ssh -t -t  test

this command executed success in powershell, but got another error in this extension:

Confirming that test is a valid reachable host
Running [type "C:\Users\DOM~1\AppData\Local\Temp\vscode-linux-multi-line-command-test.sh" | ssh -t -t  test] to confirm the host platform
> 
> GetConsoleMode on STD_INPUT_HANDLE failed with 6
> 
> 
> Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-131-generic x86_64)
> 
>  * Documentation:  https://help.ubuntu.com
>  * Management:     https://landscape.canonical.com
>  * Support:        https://ubuntu.com/advantage
> Last login: Sun May  5 16:23:50 2019 from 10.200.84.113
> uname -sm
> root@inserver-inspurclouddev-391-10:~# uname -sm

it looks like something wrong with openssh reported here: https://github.com/PowerShell/Win32-OpenSSH/issues/856

hope this information may helps.

Do you know why the -t option fixes the IO is still pending on closed socket error?

Do you know why the -t option fixes the IO is still pending on closed socket error?

Sorry I'm not sure.

here is the description of -t:

-t' Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

If I change the ssh client from openssh to the git ssh located at C:\\Progra~1\\Git\\usr\\bin\\ssh.exe then everything will be fine.

If I change the ssh client from openssh to the git ssh located at C:\\Progra~1\\Git\\usr\\bin\\ssh.exe then everything will be fine.

Can you tell me how to replace it? Thank you

If I change the ssh client from openssh to the git ssh located at C:\\Progra~1\\Git\\usr\\bin\\ssh.exe then everything will be fine.

Can you tell me how to replace it? Thank you

Step 1: Find the remote ssh extension file, in general at C:\Users\<YOUR_NAME>\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-<CURRENT_VERSION>\out\extension.js.

Step 2: Open extension.js, search the function named getSshCommand , you may got about 3 matches, in front of the first one, you can find the function function h(){return d}.

Step 3: Modify the function h , change the return value to your ssh client path, for example,

function h(){
  return "C:\\Progra~1\\Git\\usr\\bin\\ssh.exe"
}

The last step before this trick works, just save and relaunch vscode or reload window with ctrl + shift + p. 👻

@xluos

I also get this error with:
VSCode Version: 1.35.0-insider
Local OS Version: Windows 10 Build 1803
Remote OS Version: Linux Mint 19.1 (5.1.4-050104-generic)
Remote Extension/Connection Type: SSH

If I enable keeping the terminal open I see the welcome message and the uname result (Linux armv7l) before it closes.

you can put your ssh client in your path environment variable instead of modifying the code

you can put your ssh client in your path environment variable instead of modifying the code

I don't think so, as the source code shows, it will use open ssh for windows, without care about any environment variables.
image

In the nightly version of the extension, we search for ssh in different locations and include a setting for you to set the path if needed. Try it out (uninstall the stable version first)

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

Was this page helpful?
0 / 5 - 0 ratings