Rsync creates error message unexplained error (code 255) at io.c(837)

88,809

Solution 1

To investigate, add one or more -v options to the rsync command. Also, try to use plain ssh:

ssh -v 192.168.1.21 /bin/true

to find out whether it is rsync or the underlying ssh connection that is causing the trouble.

Solution 2

255 is actually not a "native" rsync return code. rsync scrapes the 255 error code from SSH and returns it. It looks to me like something on the destination server is blocking SSH or breaking it once it's connected, hence, "broken pipe". I disagree with @kenorb because if it were a timeout issue you would probably be seeing rsync exit codes 30 or 35.

Solution 3

Broken pipe error most likely means that you've hit the timeout. For example the remote rsync command started to calculate the file differences, but it didn't replied to the client on time.

If this happens very often, add these settings to your local ~/.ssh/config:

Host *
  ServerAliveInterval 30
  ServerAliveCountMax 6

and on the remote server (if you've got the access), setup these in your /etc/ssh/sshd_config:

ClientAliveInterval 30
ClientAliveCountMax 6

See: What the options ServerAliveInterval and ClientAliveInterval mean?

Share:
88,809

Related videos on Youtube

Keith347
Author by

Keith347

Updated on September 18, 2022

Comments

  • Keith347
    Keith347 over 1 year

    When I try to rsync -qaPH source/ 192.168.1.21:/var/backups I get

    rsync: [sender] write error: Broken pipe (32)
    rsync error: unexplained error (code 255) at io.c(837) [sender=3.1.0]
    

    Whats wrong with my command?

    • user3757405
      user3757405 almost 8 years
      I guess the error is occurring on this line: git.samba.org/rsync.git/… . If you can wade through the surrounding code, it might tell you roughly what happened.
  • Alfred Bez
    Alfred Bez almost 4 years
    For me it was a problem in my ssh-config, I used RemoteCommand /bin/sh -c 'tmux has-session && exec tmux attach || exec tmux' for one server