How to solve Rsync sender write error broken pipe

How to solve Rsync sender write error broken pipe

2 minutes 54s
An easy way to fix a common error in Rsync, when using different versions on client and server.

A common error

There is a common error in Rsync, that happens seemingly out of nowhere, and is difficult to debug.


rsync: [sender] write error: Broken pipe (32)
rsync error: error in rsync protocol data stream (code 12) at io.c(829) [sender=3.1.2]


Often the cause is different Rsync versions on client and server

Sometimes, after an update, or the provisioning of a new server, rsync will stop working.

The reason is conflicting protocol versions in rsync. We can first confirm that we are running different versions.


rsync --version


From the output of the previous command we see we are running version 3.1.2 on our client. We would do the same in the server.


rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.


A question of protocol

Once we have confirmed that the Rsync versions are different, we can try a simple solution.

We add --protocol=29 to our rsync command. Below you can see an example.


rsync --delete -rvz -P --partial --ignore-times
--timeout=0 --protocol=29
/home/gsus/myfiles/ example@example.com:/home/gsus/myfiles


Passing the option to specify the protocol to run makes different versions of Rsyncplay nicely with each other.


--protocol=29


Notes

• Rsync man page
https://linux.die.net/man/1/rsync

• Rsync versions
https://rsync.samba.org/

• What is Rsync
https://en.wikipedia.org/wiki/Rsync