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

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

Closed
roycyt opened this issue May 3, 2019 · 14 comments
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH

Comments

@roycyt
Copy link

roycyt commented May 3, 2019

  • 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.
@gregvanl
Copy link

gregvanl commented May 3, 2019

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."

@roblourens
Copy link
Member

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

@roblourens roblourens added the info-needed Issue requires more information from poster label May 4, 2019
@roblourens roblourens changed the title Can't connect to Ubuntu: unreachable or not Linux x86_64 Can't connect to Ubuntu: unreachable or not Linux x86_64 - IO is still pending on closed socket May 4, 2019
@ydcool
Copy link

ydcool commented May 5, 2019

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)

@ydcool
Copy link

ydcool commented May 5, 2019

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: PowerShell/Win32-OpenSSH#856

hope this information may helps.

@roblourens
Copy link
Member

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

@ydcool
Copy link

ydcool commented May 6, 2019

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.

@ydcool
Copy link

ydcool commented May 6, 2019

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.

@xluos
Copy link

xluos commented May 22, 2019

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

@ydcool
Copy link

ydcool commented May 23, 2019

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

@spraot
Copy link

spraot commented May 26, 2019

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.

@AllaeddineEL
Copy link

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

@ydcool
Copy link

ydcool commented Jun 13, 2019

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

@roblourens
Copy link
Member

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)

@vscodebot vscodebot bot closed this as completed Jun 20, 2019
@vscodebot
Copy link

vscodebot bot commented Jun 20, 2019

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!

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

8 participants