Migration failed: rsync: connection unexpectedly closed

Created:

2016-11-16 13:03:19 UTC

Modified:

2017-04-24 11:13:19 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Migration failed: rsync: connection unexpectedly closed

Applicable to:

  • Plesk for Linux

Symptoms

  • It is not possible to complete a migration. The following errors can be found in Plesk:

    rsync execution error: Error in rsync protocol data stream (12).
    Stderr is:
    --------------------------------
    ssh_exchange_identification: Connection closed by remote host
    rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
    rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receiver=3.1.0]
    --------------------------------

    Or:

    Command execution failed on the local server with non-zero exit code. 
    command: rsync -l --chmod=Fu=rw,go=,Du=rwx,go= -e 'ssh -i /usr/local/psa/var/modules/panel-migrator/sessions/20161006075021/ssh-keys/id_rsa.example.com -p 22 -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no' /usr/local/psa/var/modules/panel-migrator/sessions/20161006075021/ssh_upload.2 root@example.com:/tmp/panel_migrator/my_localhost_redlion_dev.cnf
    exit code: 255
    stdout:
    stderr: ssh: connect to host example.com port 22: Connection timed out
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]
  • On the source server /var/log/secure or /var/log/messages contains the following:

    sshd[26339]: reverse mapping checking getaddrinfo for ip-2-113-0-203.example.com [203.0.113.2] failed - POSSIBLE BREAK-IN ATTEMPT!
    sshd[26339]: Accepted password for root from 203.0.113.2 port 59580 ssh2
    sshd[26339]: Received disconnect from 203.0.113.2: Disconnect

Cause

  • There is no reverse DNS setup for the server hostname that is used.
  • The "POSSIBLE BREAK-IN ATTEMPT" part specifically is related to the "reverse mapping checking getaddrinfo failed" part. It means that the connected host has incorrectly configured forward or reverse DNS.
  • If /etc/hosts includes a wrong IP address for the source server hostname, migration will fail without any DNS query. Also, it depends on the "hosts" entry of /etc/nsswitch.conf

Resolution

  • Setup PTR record on the DNS server in use.
  • Define correct entry for the source server hostname on the destination server in /etc/hosts
  • As an alternative, set "UseDNS" value to "no" in /etc/ssh/sshd_config on the source server and reload sshd service.
Have more questions? Submit a request
Please sign in to leave a comment.