rsyncd / firewall

david blunkett dav1dblunk3tt at
Tue Feb 15 12:00:49 GMT 2005


I am running an rsyncd on my backup host - I now think the problem is NOT 
the firewall (complicated: originally port 873 was blocked elsewhere).  Now 
I get the same problem with or without the firewall and at the client end I 
get this:

rsync: connection unexpectedly closed (196 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(342)

At the server end I get this in the logs:

2005/02/15 11:24:09 [27494] rsync to archive/matt_incs/Wednesday from 
home at (
2005/02/15 11:24:09 [27495] wrote 196 bytes  read 146 bytes  total size 0
2005/02/15 11:24:10 [27496] rsync to archive/matt from 
home at (

So no error at the server end.

Now this previously worked for 2 years until last week.  Last week we 
install FC2 on the server,
installed a firewall with iptables and moved the disks around.  At the 
client end nothing has changed.

Since the error persists with or without the firewall we think we have 
eliminated it from the problem.

Working from the advice in:

(1) disk space? there is plenty of space on disks at both ends
    (df /dev/hdb2             74864892  15374792  55687116  22% /optics)
(2) network error? - unlikely as it worked before updating the system
(3) rysnc executable missing? It is there
(4) remote shell issues - not relevant to daemon

Following the advice about tracing the system calls using:

ulimit -c unlimited
strace -f rsync --daemon --no-detach 2>/tmp/rsync-$$.out

I did this and got (boring bits deleted)

[pid 27864] stat64("/usr/lib/i686", 0xfef74ac8) = -1 ENOENT (No such file or 
[pid 27864] open("/usr/lib/", O_RDONLY) = -1 ENOENT (No 
such file or directory)
[pid 27864] stat64("/usr/lib", 0xfef74ac8) = -1 ENOENT (No such file or 
[pid 27864] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 27864 detached
<... select resumed> )                  = ? ERESTARTNOHAND (To be restarted)
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(-1, NULL, WNOHANG)              = 27864
waitpid(-1, NULL, WNOHANG)              = -1 ECHILD (No child processes)
rt_sigaction(SIGCHLD, {0x805e2a0, [CHLD], SA_RESTART}, {0x805e2a0, [CHLD], 
SA_RESTART}, 8) = 0
sigreturn()                             = ? (mask now [])
select(6, [4 5], NULL, NULL, NULL[root at diesel root]#

And I have no idea what this all means...

If you look at my script (below) you can see rsync runs 3 times, the first 2 
passes run fine, the thrid always fails.

Any advice?


Below my clinet side script:


# backup your trouble script with incremental backups
# provides 6 days notice against disasters

date > /home/matt/.backup_date

set OPTIONS     = " -vaz --stats --delete --delete-excluded --exclude-from 
.mirror.excludes --backup --temp-dir /tmp"
set DAY         = `date +%A`
set EMPTY       = "/tmp/backupyourtroublesempty/"
echo Throttling the network to enhance interactive response
setenv RSYNC_PASSWORD   censored

echo Today is $DAY

if( $DAY == 'Monday' ) then
        set LAST="Tuesday"
if( $DAY == 'Tuesday' ) then
        set LAST="Wednesday"
if( $DAY == 'Wednesday' ) then
        set LAST="Thursday"
if( $DAY == 'Thursday' ) then
        set LAST="Friday"
if( $DAY == 'Friday' ) then
        set LAST="Saturday"
if( $DAY == 'Saturday' ) then
        set LAST="Sunday"
if( $DAY == 'Sunday' ) then
        set LAST="Monday"

echo The oldest incremental backup is $LAST

echo Deleting incremental ${LAST} with
echo rsync --delete -a $EMPTY home at diesel::archive/matt_incs/$LAST

[ -d $EMPTY ] || mkdir $EMPTY
rsync --delete -a $EMPTY home at diesel::archive/matt_incs/$LAST
rmdir $EMPTY

echo Starting main backup with incremental backup for $DAY

if { nice +20 rsync $OPTIONS  /home/matt/ home at diesel::archive/matt 
--backup-dir=/matt_incs/$DAY } then
        echo "."
        echo " ."
        echo "  ."
        echo Backup was probably successful!
        echo "  ."
        echo " ."
        echo "."
        sleep 10
        echo " "
        echo " "
        echo BACKUP ERROR ! Tell Matt!
        echo " "
        echo " "
        echo "E       R     R R    R  O      O R     R"
        echo "E       R     R R    R  O      O R     R"
        echo "E       R     R R    R  O      O R     R"
        echo "EEEEEE  RRRRR   RRRRR   O      O RRRRRR"
        echo "E       R R     R R     O      O R R"
        echo "E       R  R    R  R    O      O R  R"
        echo "E       R   R   R   R   O      O R   R"
        echo "EEEEEE  R    R  R    R   OOOOOO  R    R"
        echo " "
        echo " "
        echo " "
        echo " "
        echo "This message will stay for 1hr, type cntl-c to get rid of it"
        date > /home/matt/.backup_error
        sleep 3600
echo Finished backup
echo Releasing the network throttle

>From: Wayne Davison <wayned at>
>To: david blunkett <dav1dblunk3tt at>
>CC: rsync at
>Subject: Re: rsyncd / firewall
>Date: Mon, 14 Feb 2005 16:33:55 -0800
>On Mon, Feb 14, 2005 at 11:45:07PM +0000, david blunkett wrote:
> > If I have a firewall it doesn't work - just times out.  This problem
> > occurs <even> if I open port 873.
>Are you connecting to a daemon or using a remote shell?  While the
>daemon protocol does use port 873 (only), a remote shell uses its own
>port, such as ssh's port 22.

Don’t just search. Find. Check out the new MSN Search!

More information about the rsync mailing list