Bobcares

Rsync error code 255 – Quick fixes

by | Sep 23, 2019

My server backup task is failing with this error. Please fix!
rsync: [sender] write error: Broken pipe (32)
rsync error: unexplained error (code 255) at io.c(837) [sender=3.1.0]

That was a recent request we received as part of our Server Management Services.

Often, this rsync error happens due to bad ssh settings on the server.

Today, let’s get into the details and see how our Support Engineers fix rsync error code 255.

 

How to use rsync?

Basically, Rsync is a Linux-based tool for synchronizing documents between remote and local servers.

It becomes really popular as it will only sync or copy the changes from source to the destination. Thus it saves the effort of copying the whole file. Consequently, the command ultimately reduces the amount of data sent over a network.

A sample rsync over ssh command to perform backups to a remote server looks as

rsync -azLvv --progress -e 'ssh -p22 -vvv' --exclude 'xxx' /home/user/ server.tld:/backup/DIR

It copies the folder /home/user to the remote server.

However, an error may occur while using the rsync command.

 

How we fix common rsync errors

At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems while running the rsync command.

Now let’s see the major reasons for rsync errors and how our Support Engineers fix the top errors.

 

1. Bad ssh configuration

Recently, one of our customers had a problem while executing the rsync command. He got an error like below

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

Broken pipe error most likely means that the server hit a timeout in SSH. It generally means that there is a bad setting in the ssh configuration file.

Then, our Support Engineers first check whether the ssh configuration was set up correctly. Most of the time customers may forget to set up the settings in the local ~/.ssh/config file.

This will create problems like timeout while synchronizing large files. Here, the fix was to add the keep-alive options. So, we added the following lines in the local ~/.ssh/config file.

Host *
ServerAliveInterval 30
ServerAliveCountMax 6

Again, on the remote server, we added these in the /etc/ssh/sshd_config file.

ClientAliveInterval 30
ClientAliveCountMax 6

That fixed the error and resumed the rsync process.

 

2. Incorrect Syntax

Similarly, another customer has requested us to solve a rsync error such as Rsync stopped working and returns “rsync error: unexplained error.

On investigating, our Support Engineers found the detailed error as:

Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]

Also, because of the use of bad syntax as misplaced double quotes ” in the command, this error occurred. So, we corrected as below.

rsync -rdtvu --delete -e "ssh -p 22 -i /path/to/sshkey" /media/local/xxx/ user@1xx.21x.0.1:/xxxx/remote/dir/

Hence, the problem was fixed. When the server uses a non-standard SSH port, we always take special care in ensuring the correct setting in the port.

 

3. Firewall settings

Often firewall settings also create problems and report Rsync error code 255.

In such cases, our Dedicated Engineers first run the rsync command in verbose mode. It usually shows the port restrictions. A sample output appears as:

[root@srv]$ sudo ssh -vvv server@1xx.1yy.1.102
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 1xx.1yy.1.102 [1xx.1yy.1.102] port 22.
debug1: connect to address 1xx.1yy.1.102 port 22: Connection refused
ssh: connect to host 1xx.1yy.1.102 port 22: Connection refused

Then, we make adequate modifications to the firewall. For already blocked IP addresses, we unban in Fail2ban using the following command.

fail2ban-client set JAILNAME unbanip IPADDRESS

 

[Need assistance to fix rsync errors? We’ll help you.]

 

Conclusion

In short, rsync error code 255 may occur if the server has a bad ssh setup or if the rsync command has syntax errors. Today, we saw the top reasons for the rsync error and how our Support Engineers fixed it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.