Backups and file transferring is important for server management.
And Rsync is one of the best shots, but errors are always a setback.
Rsync error code 12 is a tricky error that occurs due to insufficient disk space, network errors and so on.
That is why at Bobcares, we often get requests to fix Rsync errors as a part of our Server Management Services.
Today, let’s see how our Support Engineers fix Rsync error code 12 for our customers.
Explaining Rsync error code 12
Rsync is one of the popular file synchronization tools. It is useful for both local and remote file transfer.
If the destination already contains the source file then the Rsync only copies the differences. This makes Rsync a faster file transfer option.
But, in many situations, the Rsync operation ends by showing the error message:
rsync error: error in rsync protocol data stream (code 12) at io.c(xxx).
So, why does the file transfer ends by showing an error code 12?
Usually, the reason for this varies from insufficient disk space to network errors, improper destination and so on.
Let’s now check on a few reasons and see how our Support Engineers fix them.
Causes and fixes for the Rsync error 12
Whenever a server operation ends up in error, the initial troubleshooting starts from the log file. In the case of Rsync, our Support Engineers always make sure to set up the log file right. As a result, the reason that leads to the error can be easily found out from teh log file.
The most common reasons for the Rsync error code 12 are:
1. Insufficient disk space
While trying to Rsync data from one server to another, one of our customers got the error code 12. Here, the user tried to transfer a large file.
So, our Support Engineers initially tried to transfer a small file. Since the file transfer was successful, we could infer that the disk space was insufficient in the first case.
Thus, we always recommend checking the disk space before transferring large files. For instance, the free disk space should be at least more than the size of the largest file.
2. Missing remote Rsync
In some cases, the remote side does not have Rsync installed. Also, the destination path specified does not exist. In both cases, the Rsync error 12 shows up.
For instance, one of our customers executed the command:
rsync -v -v -e 'ssh -p YY' ./testfile user@XXXXX:/home
Here, YY denotes the SSH port number.
This ended up in the error code 12.
Initially, our Dedicated Engineers made sure that ssh -p YY user@XXXXX
works fine. Since this was working fine, we checked the Rsync in the remote end.
Rsync was found missing in the remote end. So, we installed it on the Ubuntu/Debian server using:
apt-get install rsync
That fixed the error and Rsync ran successfully.
3. Failure due to idle connection
Similarly, an idle connection can also show the error code 12 in remote file transfer.
In such situations, our Support Team always recommends using –timeout option in the Rsync command. Here, the Rsync sends keep-alive messages to the remote server to prevent a timeout.
We can also configure ssh to prevent timeout by setting a few parameters like KeepAlive, ServerAliveInterval, ServerAliveCountMax, etc.
[Having trouble in fixing Rsync errors? – We’ll help you.]
Conclusion
In short, Rsync error code 12 denotes ‘error in rsync protocol data stream’. Usually, this error occurs due to insufficient disk space, missing Rsync at the destination, idle connection timeout and so on. Today, we saw how our Support Engineers fix this error for our customers.
I restart rsync daemon process resolve this problem.
Thanks. it was helpful. I was trying to rsync a docker running on AWS instance. the docker’s fingerprint changed and had to first ssh into the docker to have it updated.
Another cause for this problem is a mismatch between rsync and ssh. For example, on a Windows laptop with Cygwin, using the cygwin rsync with the Windows ssh will cause this error. A solution in that case is to make sure to install the cygwin ssh.
Thank you for the update Charles.
Another item you may want to add that I figured out since this was one of the top Google results. If you are on Windows, have Cygwin installed, and invoke rsync outside of a cygwin console, you will get a rsync 12 error since rsync is trying to use the wrong ssh. Apparently the window’s built in one doesn’t work with rsync and you need to use -e to pass the correct one.