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

Couldn't start up the remote connection #393

Closed
bng919 opened this issue Jun 6, 2020 · 17 comments
Closed

Couldn't start up the remote connection #393

bng919 opened this issue Jun 6, 2020 · 17 comments
Labels

Comments

@bng919
Copy link

bng919 commented Jun 6, 2020

I have rdiff-backup version 2.0.0 installed on Windows 10 and on a Raspberry Pi. SSH works fine between both devices and I can backup the Windows device to the Raspberry Pi if I initiate the backup from the Pi but not if I try to initiate it from the Windows device. Rdiff-backup is installed on the PATH of the Pi. Any ideas as to what might cause this? I have attached the error using -v9 below.

2020-06-05 22:31:49.601230 -0600 Using rdiff-backup version 2.0.0
2020-06-05 22:31:49.616947 -0600 with cpython C:\Users\benng\rdiff-backup-2.0.0.win32exe\rdiff-backup-2.0.0\rdiff-backup.exe version 3.7.5
2020-06-05 22:31:49.620854 -0600 on Windows-10-10.0.17763, fs encoding utf-8
2020-06-05 22:31:49.627364 -0600 Executing ssh -C raspberrypi.local rdiff-backup --server
2020-06-05 22:31:49.634992 -0600 Client sending (0): ConnectionRequest: Globals.get with 1 arguments
2020-06-05 22:31:49.636988 -0600 Client sending (0): version
'ssh' is not recognized as an internal or external command,
operable program or batch file.
2020-06-05 22:31:49.666346 -0600 Fatal Error: Truncated header string (problem probably originated remotely)

Couldn't start up the remote connection by executing

ssh -C raspberrypi.local rdiff-backup --server

Remember that, under the default settings, rdiff-backup must be
installed in the PATH on the remote system. See the man page for more
information on this. This message may also be displayed if the remote
version of rdiff-backup is quite different from the local version (2.0.0).

@ericzolf
Copy link
Member

ericzolf commented Jun 6, 2020

'ssh' is not recognized as an internal or external command,
operable program or batch file.
You need an SSH client installed on your Windows machine for this to work. You might need to use the --remote-schema parameter to access the client, e.g. if the name is putty instead of ssh.

Installing Windows' own SSH client seems to be the way forward, but without guarantee.

Let us know if this fixes your issue and please close the issue if so.

@bng919
Copy link
Author

bng919 commented Jun 6, 2020

Thanks for getting back to me. I do have Windows' SSH client installed and can open an SSH connection using the 'ssh' command without error.

@ericzolf
Copy link
Member

ericzolf commented Jun 6, 2020

I just tried myself and it works flawlessly: rdiff-backup c:/temp myuser@myserver::/tmp/bakwin1.

> ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

What does ssh -C raspberrypi.local rdiff-backup --server tell you if you call it directly? You will need to exit using Ctrl+C. How does the complete rdiff-backup command look like which you're using?

@bng919
Copy link
Author

bng919 commented Jun 6, 2020

ssh -C raspberrypi.local rdiff-backup --server just asks me for the password for benng@raspberrypi.local. Benng is the user on my Windows device but I added a user benng on the pi as well but this made no difference.
The command I have been using is rdiff-backup c:/Users/benng/Desktop/test pi@raspberrypi.local::/home/pi/Backup2.
I am also using openSSH 7.7 and LibreSSL 2.6.5

@ericzolf
Copy link
Member

ericzolf commented Jun 6, 2020

That's strange because my output with -v9 shows the debug message Executing ssh -C myuser@myserver rdiff-backup --server (with the myuser@ included)...
What does set PATH tell you? Does it show C:\Program Files\OpenSSH being part of the path environment variable?

@ericzolf
Copy link
Member

ericzolf commented Jun 6, 2020

Are you in a command windows (cmd.exe) or in a PowerShell window?

@bng919
Copy link
Author

bng919 commented Jun 6, 2020

When I run the full rdiff command with -v9 I get debug message Executing ssh -C with the user pi included as well. I believe in my original post I had used raspberrypi.local instead of pi@raspberrypi.local in the full rdiff command

I do not have an OpenSSH folder in c:\Program Files\ however it is in c:\Windows\System32\ and is included in the path.

I have been using cmd but just tried it in PowerShell and had the same result.

@ericzolf
Copy link
Member

ericzolf commented Jun 7, 2020

I'm a bit out of ideas what the issue might be but it doesn't seem to be a code issue, rather a configuration issue. Let's try 2 more things:

  1. what happens if you explicitly set the remote schema:
    1. once with full path e.g. rdiff-backup -v9 --remote-schema "C:\Windows\System32\OpenSSH\ssh.exe -C %s rdiff-backup --server" c:/Users/benng/Desktop/test pi@raspberrypi.local::/tmp/bakwin1
    2. once without rdiff-backup -v9 --remote-schema "ssh.exe -C %s rdiff-backup --server" c:/Users/benng/Desktop/test pi@raspberrypi.local::/tmp/bakwin1,
    3. and once without the .exe like in rdiff-backup -v9 --remote-schema "ssh -C %s rdiff-backup --server" c:/Users/benng/Desktop/test pi@raspberrypi.local::/tmp/bakwin1
  2. try the following (you really need to enter process.communicate() instead of your password and then else enter blind your password):
>python
Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess 
>>> process = subprocess.Popen("ssh -C pi@raspberrypi.local uname -a", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
>>> pi@raspberrypi.local's password: process.communicate() 
<enter your password blind!!!>
(b'Linux raspberry 5.6.15-300.fc32.x86_64 #1 SMP Fri May 29 14:23:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux\n', None)   

@bng919
Copy link
Author

bng919 commented Jun 7, 2020

I tried the first three commands setting the remote schema and got the same "Couldn't start remote connection error". The python script gave me the same result ((b'Linux raspberrypi 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux\n', None)) and rdiff-backup still encountered the same error afterwards.

I appreciate all your suggestions. I agree it is likely a configuration issue on my end. Time to start reinstalling :)

@bng919 bng919 closed this as completed Jun 7, 2020
@ericzolf
Copy link
Member

ericzolf commented Jun 7, 2020

Perhaps a last thought from my side: I remember vaguely that downloaded files are flagged as such by Windows which brings restrictions with it (you can't start them without question back), perhaps Windows doesn't allow them to access system processes, and SSH is considered as such, because placed under \Windows\System32 ? See e.g. https://www.howtogeek.com/70012/what-causes-the-file-downloaded-from-the-internet-warning-and-how-can-i-easily-remove-it/

@flottman
Copy link

@bng919

Were you able to resolve this? I'm having the same issue

@bng919
Copy link
Author

bng919 commented Nov 19, 2020

Unfortunately not. I ended up using a local backup for that project. I hope you have more success!

@geekbozu
Copy link

geekbozu commented Jan 26, 2021

Just to chime in, Spent all day debugging this. In short it does not like OpenSSH installed via windows optional features. The one provided by PowerShell does work fine however

https://github.com/PowerShell/Win32-OpenSSH

Not really sure how to go about fixing this. It has something to do with python being denied access to applications under the system directory. Running the script as admin may also fix that but that's less then desired most of the time. So I did not test that.

See @ericzolf comment below...

@ericzolf
Copy link
Member

I had forgotten about this issue (but it had been closed), but I think that https://github.com/rdiff-backup/rdiff-backup/blob/master/docs/Windows-README.md#using-microsofts-openssh-client-on-windows-10 is the solution to the described problem.

@geekbozu
Copy link

... ... well thanks I read that a few times and completely missed it. There goes a few hours of my life. This error still shows up at the top of the list for google so thanks for linking it! Will make the next unlucky souls day better!

@anorman728
Copy link

If anyone comes across this later via websearch, it's now at https://github.com/rdiff-backup/rdiff-backup/blob/master/docs/Windows-README.adoc#42-using-microsofts-openssh-client-on-windows-10

And it seems to work fine for me, so far at least.

@ericzolf
Copy link
Member

Thanks. Yes, we translated all markdown to asciidoc. This said, https://github.com/rdiff-backup/rdiff-backup/blob/master/docs/Windows-README.adoc#using-microsofts-openssh-client-on-windows-10 works as well ( the 42-thingy is probably specific to GitHub, at least it made me wonder).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants