rsync errors

I was having an issue with my rsync command:

time rsync --progress --verbose --acls --xattrs --exclude="/lib/mysql/ibdata1" --exclude="*.tmp" --stats --human-readable --recursive --del --force --times --links --hard-links --executability --numeric-ids --owner --group --perms --sparse --compress-level=6 diligence-test:/usr/ /data/temp/2017-11-15-163925/usr/

getting stuck during “receiving incremental file list” then giving up with:

Timeout, server diligence-test not responding.
rsync: connection unexpectedly closed (16384 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [receiver=3.1.2]
rsync: connection unexpectedly closed (32569 bytes received so far) [generator]
rsync error: unexplained error (code 255) at io.c(235) [generator=3.1.2]
Command exited with non-zero status 255

I could see the server-side process hang in select() with:

root@diligence-test:/home/jj5# ps aux | grep rsync
root      5421  0.0  0.1  15636  2660 ?        Ss   18:55   0:00 rsync --server --sender -vlHogtpAXrSe.iLsfxC --numeric-ids . /usr/

root@diligence-test:/home/jj5# strace -p 5421
strace: Process 5421 attached
select(1, [0], [], [0], {42, 979828})   = 0 (Timeout)

Anyway I figured out how to dodge the problem by nominating –delete-before instead of –del, e.g.:

time rsync --progress --verbose --acls --xattrs --exclude="/lib/mysql/ibdata1" --exclude="*.tmp" --stats --human-readable --recursive --delete-before --force --times --links --hard-links --executability --numeric-ids --owner --group --perms --sparse --compress-level=6 diligence-test:/usr/ /data/temp/2017-11-15-163925/usr/

Keeping Your SSH Sessions Alive Through NAT Firewalls

I found this article Keeping Your SSH Sessions Alive Through Pesky NAT Firewalls which explained how to keep SSH connections alive through NAT firewalls. I’m behind a NAT router and my SSH connections are always timing out due to inactivity, and it annoys the shit out of me. I’ve been putting up with it for ages, and tonight I finally got around to searching for a solution. The solution is to edit your ~/.ssh/config file and add:

Host *
    ServerAliveInterval 240

That will make the server send a keep-alive packet every four minutes, which out to do it. Haven’t tried it yet, but expect it will work. Will configure my systems now…

Update: that didn’t seem to work for me. :(

Maybe this is a client setting?

Anyway, I did some more research, and I found that PuTTY has a configuration option in the Connection settings “Sending of null packets to keep session active”, “Seconds between keepalives” which defaults to 0 (turned off). So I’m gonna try with that now.