rsync FAQ

unix and linux 2008. 4. 10. 20:06


rsync에 대한 FAQ에 대한 내용이다.


current issues and debugging

  1. Q: Rsync appears hung -- what should I do?

    A: When experiencing a hang or freeze please gather the following information before killing the rsync process:

    • The state of the send/receive queues shown with netstat on the two ends.
    • The system call that each of the 3 processes is stuck in (use truss on solaris, strace on Linux, etc.).

    See the "rsync-debug" script below for an example of how to grab strace information from the remote rsync process(es). If you need help, send email to the mailing list.

  2. Q: Why does my chrooted rsync daemon crash when doing an LDAP lookup for a user or group?

    A: There is a bug in some LDAP libraries (e.g. Fedora Core 3) where it crashes when someone looks up a name from inside a chrooted process (one that does not contain copies of the libraries to perform the lookup). This is a bug that the LDAP libraries will need to fix, and is out of rsync's hands. You can work around the problem by using the --numeric-ids option, turning chroot off, or getting rid of LDAP lookups.

  3. Q: Why does my transfer die with something like the following error?

    rsync: error writing 4 unbuffered bytes - exiting: Broken pipe
    rsync error: error in rsync protocol data stream (code 12) at io.c(463)


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

    A: This error tells you that the local rsync was trying to talk to the remote rsync, but the connection to that rsync is now gone. The thing you must figure out is why, and that can involve some investigative work.

    If the remote rsync is a daemon, your first step should be to look at the daemon's log file to see if it logged an error explaining why it aborted the transfer.

    Beginning with version 2.6.3, rsync now does a better job of retreiving the error from the remote process than older versions of rsync, so you may wish to try upgrading and see if you now get sent the error message from the remote rsync.

    There are several common causes for a remote rsync process going away:

    • The destination disk is full (remember that you need at least the size of the largest file that needs to be updated available in free disk space for the transfer to succeed).
    • An idle connection caused a router or remote-shell server to close the connection.
    • A network error caused the connection to be dropped.
    • The remote rsync executable wasn't found.
    • Your remote-shell setup isn't working right or isn't "clean" (i.e. it is sending spurious text to rsync).

    If you think the problem might be an idle connection getting closed, you might be able to work around the problem by using a --timeout option (newer rsyncs send keep-alive messages during lulls). You can also configure ssh to send keep-alive messages when using Protocol 2 (look for KeepAlive, ServerAliveInterval, ClientAliveInterval, ServerAliveCountMax, and ClientAliveCountMax). You can also avoid some lulls by switching from --delete (aka --delete-before) to --del (aka --delete-during).

    If you can't figure out why the failure happened, there are steps you can take to debug the situation. One way is to create a shell script on the remote system such as this one named "rsync-debug". You would use the script like this:

    rsync -av --rsync-path=/some/path/rsync-debug HOST:SOURCE DEST
    rsync -av --rsync-path=/some/path/rsync-debug SOURCE HOST:DEST

    This script enables core dumps and also logs all the OS system calls that lead up to the failure to a file in the /tmp dir. You can use the resulting files to help figure out why the remote rsync failed.

    If you are rsyncing directly to an rsync daemon (without using a remote-shell transport), the above script won't have any effect. Instead, halt the current daemon and run a debug version with core-dumps enabled and (if desired) using a system-call tracing utility such as strace, truss, or tusc. For strace, you would do it like this (the -f option tells strace to follow the child processes too):

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

    Then, use a separate window to actually run the failing transfer, after which you can kill the debug rsync daemon (pressing Ctrl-C should do it).

    If you are using rsync under inetd, I'd suggest temporarily disabling that and using the above daemon approach to debug what is going on.

  4. Q: Why does my connection to an rsync daemon (using the "::" syntax) fail immediately with an error like the following?

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

    A: Older rsync daemons (before 2.6.3) were unable to return errors that were generated during the option-parsing phase of the transfer. Look in the logfile on the server to see if an error was reported, such as a "refused" option, an option that the server rsync doesn't support (e.g. perhaps links are not supported by the server), or some other failure (such as trying to send data to a read-only module). Upgrading the version of rsync that is running as a daemon to at least 2.6.3 will allow these errors to get returned to all rsync clients, old or new alike.

  5. Q: Why doesn't --dry-run (-n) show all the changed directories?

    A: This was a bug in versions prior to 2.6.4. Upgrade both rsync versions (or at least the receiving side).

  6. Q: Aren't there more issues than this?

    A: Yes. You can find some of them in the TODO file or search the bugzilla database.

<FORM action="" method="get" target="_top">
<INPUT type="hidden" value="" name="domains"></INPUT> <INPUT maxLength="255" size="31" value="rsync " name=q></INPUT> <INPUT type="submit" value="Search" name="sa"></INPUT>
<INPUT type="radio" value="" name=sitesearch></INPUT> Search WWW <INPUT type="radio" CHECKED value="" name="sitesearch"></INPUT> Search
<INPUT type="hidden" value="pub-1444957896811922" name="client"></INPUT> <INPUT type="hidden" value="1" name="forid"></INPUT> <INPUT type="hidden" value="ISO-8859-1" name="ie"></INPUT> <INPUT type="hidden" value="ISO-8859-1" name="oe"></INPUT> <INPUT type="hidden" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:60;LW:470;L:;S:;FORID:1;" name="cof"></INPUT> <INPUT type="hidden" value="en" name="hl"></INPUT>


'unix and linux' 카테고리의 다른 글

서비스 장애  (0) 2008.05.03
option parsing - bash, perl, c  (0) 2008.04.15
ssh 로그인할 때, 암호 안물어보게 하기  (0) 2008.03.28
Redhat 리눅스 버젼 보기  (0) 2008.03.28
Why I love Perl  (0) 2008.02.20
Posted by '김용환'

댓글을 달아 주세요