当我尝试同步时,rsync给了我这个奇怪的错误。 我认为升级到Ubuntu 14.04后,错误开始了。
root@****:~# rsync -avvv --exclude-from '/root/rsync/exclude_nas' -e "ssh -i /root/rsync/rsync-key -p 369" /srv/nas/home/ martin@*******:/backup/martin/nas/ opening connection using: ssh -i /root/rsync/rsync-key -p 369 -l martin ****** rsync --server -******* . /backup/martin/nas/ (13 args) /usr/local/bin/rsync: Undefined symbol "locale_charset" rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0] [sender] _exit_cleanup(code=12, file=io.c, line=226): about to call exit(12)
解决了这个问题。 显然,FreeBSD服务器的接收服务器安装了一个错误的rsync 3.0.9版本。 升级rsync到3.1.0后,它工作。
就像在之前的文章中提到的那样,它可能是一个错误的iconv编译。
你错过了这个function,可能是因为你编译时没有iconv支持:
$ rsync --version rsync version 3.1.0 protocol version 31 Copyright (C) 1996-2013 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, prealloc
您可以使用--iconv标志来testing这种function的存在:
$ touch leão $ rsync -av --iconv=UTF-8,ISO-8859-1 leão . sending incremental file list leão sent 112 bytes received 35 bytes 294.00 bytes/sec total size is 0 speedup is 0.00 $ ls leão le?o
在我们的例子中,我们使用了一个本地编译的rsync,并且库path没有正确设置:
$ /usr/local/bin/rsync -av source dest ld.so.1: rsync: fatal: relocation error: file /usr/local/bin/rsync: symbol locale_charset: referenced symbol not found
临时解决方法是设置$LD_LIBRARY_PATH :
$ LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/rsync -av source dest sending incremental file list ...
正确的修复方法是使用ldconfig将/ usr / local / lib添加到系统path中,但是这是一个Solaris机器。 我认为在Solaris上的等价物是类似crle,但不能确定我们坚持$LD_LIBRARY_PATH 。