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

Unable to establish connection on Windows 11 #46

Open
lpotthast opened this issue Feb 26, 2022 · 12 comments
Open

Unable to establish connection on Windows 11 #46

lpotthast opened this issue Feb 26, 2022 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@lpotthast
Copy link

Using version 0.8.1, creating a connection does not seem to work when on Winodws 11.

When executing the following line of code:

let session = Session::connect(format!("root@{}", SERVER_IP.to_string()), KnownHosts::Accept).await?;

I either get the following output, no folder in root of my project and the process terminates:

Error: Connect(Custom { kind: ConnectionAborted, error: "getsockname failed: Bad file descriptor\r\nssh_dispatch_run_fatal: Connection to UNKNOWN port -1: unexpected internal error" })

Or I do not get any output and the process "hangs" at this line.
The library then created a folder in the root of my project named ".ssh-connection***" before waiting indefinitely.

@jonhoo
Copy link
Collaborator

jonhoo commented Feb 26, 2022

This crate is basically UNIX-only, since it relies on the OpenSSH toolchain, which is primarily a UNIX tool. It is possible to get it working with Windows, but it's not something we've been focused on. If you want to take on trying to fix it up for Windows though I'd be happy to look at a PR!

@NobodyXu
Copy link
Member

NobodyXu commented Feb 26, 2022

Also microsoft/vscode-remote-release#96 for control master on windows

@NobodyXu
Copy link
Member

NobodyXu commented Feb 27, 2022

@inf0rm4tik3r You can compile and run this crate in WSL (Windows Subsystem for Linux), it will work just fine.

@NobodyXu
Copy link
Member

NobodyXu commented Mar 4, 2022

I think we can modify the process-impl to connect directly instead of using the control master, which just doesn't work on windows.

@jonhoo
Copy link
Collaborator

jonhoo commented Mar 4, 2022

Oof, them not supporting a control master is pretty unfortunate. But yes, I agree, we could support Windows by having it just have each ssh command connect separately, though this would need to be very well documented.

@NobodyXu NobodyXu self-assigned this Mar 6, 2022
@NobodyXu NobodyXu added the enhancement New feature or request label Mar 6, 2022
@NobodyXu NobodyXu added this to the windows-support milestone Mar 10, 2022
@NobodyXu
Copy link
Member

Progress: #52 , #58 , #60

@NobodyXu
Copy link
Member

NobodyXu commented Apr 3, 2022

#61 is closed due to adding too much complexity, forcing user to depend on process-mux implementation, which might be removed in the future and lacking way to test it.

@jonhoo Perhaps we can support windows by creating a separate crate for it, that server as a simple wrapper for launching ssh on windows, without any control multiplex support?

This would make the code more maintainable than merging it into this crate and also make it clearer to the user, and then maybe we can find a way to test it in the CI.

@jonhoo
Copy link
Collaborator

jonhoo commented Apr 9, 2022

Oh, yeah, that'd be nice!

@NobodyXu
Copy link
Member

NobodyXu commented Jun 9, 2022

I've implementing it in openssh-rust/openssh-generic, would take quite some time though.

@DJDuque
Copy link
Contributor

DJDuque commented Jul 2, 2022

... forcing user to depend on process-mux implementation, which might be removed in the future and lacking way to test it.

What does this mean? I am a new user of this crate. Does this mean that I should be using Session::connect_mux over Session::connect?

Also, does pushing for native-mux over process-mux mean giving up on Windows support? I have no idea how any of this works, but I would've assumed that relying on the ssh command (also available on Windows) would have made it easier at some point to find a way of supporting Windows as well.

@NobodyXu
Copy link
Member

NobodyXu commented Jul 2, 2022

What does this mean? I am a new user of this crate. Does this mean that I should be using Session::connect_mux over Session::connect?

Yes, it native-mux provides better errors, better performance and less memory usage.

Also, does pushing for native-mux over process-mux mean giving up on Windows support? I have no idea how any of this works, but I would've assumed that relying on the ssh command (also available on Windows) would have made it easier at some point to find a way of supporting Windows as well.

No, the process-mux implementation does not work on Windows.

In this crate, we use ssh multiplexing feature of openssh, which unfortunately does not work on windows due to its support of Unix Socket being incomplete.

I am working on another crate openssh-generic, which does not use multiplexing and should work on all platforms.

The downside however, is longer startup time and it uses more resource.

@NobodyXu
Copy link
Member

I am planning on supporting windows in openssh-mux-client openssh-rust/openssh-mux-client#6 and I have abandoned the effort to create openssh-generic, since it is mostly pre-0.9 code that wraps around tokio::process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

4 participants