mutagen-io / mutagen

Fast file synchronization and network forwarding for remote development
https://mutagen.io
Other
3.43k stars 152 forks source link

Unable to connect to endpoint from Mac to OpenSSH Windows10 remote host #252

Closed morlandi closed 2 years ago

morlandi commented 3 years ago

Which version of Mutagen are you using (mutagen version)?

0.11.8

Which operating system (platform/version/architecture) are you using?

macOS Catalina trying to sync to remote OpenSSH Windows 10 server

What is the issue that you're experiencing?

mutagen sync create . morlandi@192.168.98.69:~ Probing endpoint (Windows)... Error: create failed: unable to connect to beta: unable to connect to endpoint: unable to dial agent endpoint: unable to install agent: unable to probe remote platform: exhausted probing method

Is there any other information that might be helpful?

I tried different variations proving relative and absolute paths for both endpoints with no luck. Passwordless connection via SSH to the remote Windows host is working.

After a few attempts, I noticed the presence of a few files on the target remote folder named as follows:

.mutagen-agent5c2cf34b-e5a1-4e6f-8b29-cd3479112e15.exe

Any suggestion on how to debug this?

xenoscopic commented 2 years ago

This should be fixed now in v0.12. Thanks for the report.

morlandi commented 2 years ago

Thank you @xenoscopic ... I will try it on first occasion and post a feedback

morlandi commented 2 years ago

@xenoscopic I tried v0.12 with no luck:

$ mutagen sync create . morlandi@192.168.98.21:~
Connecting to agent (POSIX)...
Connecting to agent (Windows)...
Error: unable to connect to beta: unable to connect to endpoint: unable to dial agent endpoint: unable to handshake with agent process

while the SSH connection itself is working:

$ ssh morlandi@192.168.98.21
morlandi@WIN10 C:\Users\morlandi>cmd /k C:\cmder\vendor\init.bat

C:\Users\morlandi
λ ls -l ~
total 8961
drwxr-xr-x 1 morlandi 197121       0 Sep 11 17:13  AppData/
...

Do I need to install something in advance on the Windows 10 target ?

xenoscopic commented 2 years ago

@morlandi Do you know which release of Windows 10 you're targeting (e.g. 19H2, 20H1, 21H1, etc.)? There's nothing you need to install on the Windows 10 target, but some of the earlier Windows 10 OpenSSH builds didn't work with non-interactive execution and stdio streaming. That could be the issue here. Other things I could imagine:

Also, I would highly advise against doing a direct synchronization of your home directory, certainly with another Windows or POSIX-based home directory, though even if you're synchronizing it to an empty directory it could be a lot of files w/ AppData et al.

morlandi commented 2 years ago

Thank you @xenoscopic .

Windows 10 release is 21H1,

and this is the OpenSSH installed version:

ssh -V OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

I'm using a public key for passwordless authentication.

Folder "C:\Users\morlandi\.mutagen" did not exist; I created one via SSH to make sure I have write permission. That did not help. Then I delete it, and run again this command from Mac:

mutagen sync create . morlandi@192.168.98.21:sync

where "C:\Users\morlandi\sync" is a target folder I just created.

Also tried these variations:

mutagen sync create . morlandi@192.168.98.21:./sync
mutagen sync create . morlandi@192.168.98.21:~/sync
mutagen sync create . "morlandi@192.168.98.21:C:\Users\morlandi\sync"
mutagen sync create . "morlandi@192.168.98.21:C:\\Users\\morlandi\\sync"
mutagen sync create . "morlandi@192.168.98.21:C:/Users/morlandi/sync"

The error is always:

Error: unable to connect to beta: unable to connect to endpoint: unable to dial agent endpoint: unable to classify agent handshake error: unknown error condition encountered

Do you know of any log file where I can find more details about failure ?

morlandi commented 2 years ago

Update: tried with named pipes instead of SSH; same error

morlandi commented 2 years ago

Sorry guys, I tried again now on a brand new Windows installation and mutagen works as expected. Previously, I configuring OpenSSH in Windows to use a bash as the default shell, and that was the culript

xenoscopic commented 2 years ago

Thanks for the follow-up. It sounds like this is a fairly similar issue to #251, most likely Mutagen will just need some additional fallback platform detection heuristics. I'll see if I can improve what's there when I tackle that issue.

morlandi commented 2 years ago

@xenoscopic now that I could finally use mutagen effectively, and did a few practical tests, let me say: what an incredible project it is 👏 👏 👏 Really, really impressing.

I can already image countless practical usages of the "sync" functionality. Many thanks

Not sure about the "forward" option: apparently so similar to opening an SSH tunnel, isn't it. I'm probably missing something.