加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

ssh – 使用rsync的BackupPC失败,“协议版本不匹配 – 你的shell

发布时间:2020-12-13 17:10:28 所属栏目:Linux 来源:网络整理
导读:我刚刚在Debian框中安装了BackupPC,将其用作备份服务器.如 你知道,这个软件可以使用rsync等.使用时 rsync选项,它失败了. 服务器:Debian Jessie. BackupPC 3.3.1从源代码构建,由执行 用户“backup-user”. Rsync 3.1.2使用默认值从源代码构建 选项. 客户:De
我刚刚在Debian框中安装了BackupPC,将其用作备份服务器.如
你知道,这个软件可以使用rsync等.使用时
rsync选项,它失败了.

>服务器:Debian Jessie. BackupPC 3.3.1从源代码构建,由执行
用户“backup-user”. Rsync 3.1.2使用默认值从源代码构建
选项.
>客户:Debian Jessie. Rsync 3.1.2使用默认值从源代码构建
选项.

失败后,可以在BackupPC的日志中找到使用的rsync命令.
在shell中尝试命令,以BackupPC用户身份登录,我遇到了这个问题
“协议版本不匹配 – 你的shell干净了吗?”错误.命令是:

/usr/bin/ssh -q -x -l backup-user 192.168.10.20 /usr/local/bin/rsync
--server --sender --numeric-ids --perms --owner --group -D --links
--hard-links --times --block-size=2048 --recursive --ignore-times .
/home/backup-user/test

在发送给客户端的rsync命令中添加一些详细信息,它说(注意远程协议版本):

FILE_STRUCT_LEN=24,EXTRA_LEN=4

(Server) Protocol versions: remote=168430090,negotiated=31
protocol version mismatch -- is your shell clean? 
(see the rsync man page for an explanation) 
[sender] _exit_cleanup(code=2,file=compat.c,line=178): entered rsync error: protocol incompatibility (code 2) at compat.c(178) [sender=3.1.2] 
[sender] _exit_cleanup(code=2,line=178): about to call exit(2)

看起来远程协议中的168430090是十进制的
代表0xA0A0??A0A,但不知道是什么写的.我在列表中搜索了类似的错误,但我找到的所有错误都归功于我已经检查过的内容.

在客户端中,使用我在rsync站点中找到的调试脚本:

/usr/bin/ssh -q -x -l backup-user 192.168.206.103
/home/backup-user/rsync-debug --server --sender --numeric-ids --perms
--owner --group -D --links --hard-links --times --block-size=2048
--recursive --ignore-times . /home/backup-user/test

rsync-2991.out内容:

2997  00:58:30 brk(0)                   = 0xefb000
2997  00:58:30 access("/etc/ld.so.nohwcap",F_OK) = -1 ENOENT (No such file
or directory)
2997  00:58:30 mmap(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7fefc7341000
2997  00:58:30 access("/etc/ld.so.preload",R_OK) = -1 ENOENT (No such file
or directory)
2997  00:58:30 open("/etc/ld.so.cache",O_RDONLY|O_CLOEXEC) = 3
2997  00:58:30 fstat(3,{st_mode=S_IFREG|0644,st_size=33837,...}) = 0
2997  00:58:30 mmap(NULL,33837,PROT_READ,MAP_PRIVATE,3,0) =
0x7fefc7338000
2997  00:58:30 close(3)                 = 0
2997  00:58:30 access("/etc/ld.so.nohwcap",F_OK) = -1 ENOENT (No such file
or directory)
2997  00:58:30 open("/lib/x86_64-linux-gnu/libc.so.6",O_RDONLY|O_CLOEXEC)
= 3
2997  00:58:30 read(3,"177ELF21133>1P342@
300T32@008n@
DC65@@@000200021034000303260003032600030326343420153643523136435231
16@36731@3679@3679370O340222
26240 32240 :240
:340134011044p2p2p2DD474@
36731@3679@
36792020010P345td4L30326L30326L30326$j$j4Q345td620R345td4@
36731@3679@
36793008300814243GNU371?y343344|332K|C=2323!316@34J20514201GNU26
3633n11600020D240
212103346220305E214300105200`300200r212f420210D210.@210P4,16"H&2043002144102216241254324f3003002300P1
20110204v  ($4 P20X200312DB(62002030B
@200tPQ212@20102120",832) = 832
2997  00:58:30 fstat(3,{st_mode=S_IFREG|0755,st_size=1729984,3836448,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_DENYWRITE,0) = 0x7fefc6d7a000
2997  00:58:30 mprotect(0x7fefc6f19000,2097152,PROT_NONE) = 0
2997  00:58:30 mmap(0x7fefc7119000,24576,MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE,0x19f000) = 0x7fefc7119000
2997  00:58:30 mmap(0x7fefc711f000,14880,MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS,0) = 0x7fefc711f000
2997  00:58:30 close(3)                 = 0
2997  00:58:30 mmap(NULL,4096,0) = 0x7fefc7337000
2997  00:58:30 mmap(NULL,0) = 0x7fefc7336000
2997  00:58:30 mmap(NULL,0) = 0x7fefc7335000
2997  00:58:30 arch_prctl(ARCH_SET_FS,0x7fefc7336700) = 0
2997  00:58:30 mprotect(0x7fefc7119000,16384,PROT_READ) = 0
2997  00:58:30 mprotect(0x7fefc7343000,PROT_READ) = 0
2997  00:58:30 munmap(0x7fefc7338000,33837) = 0
2997  00:58:30 rt_sigaction(SIGUSR1,{0x41c690,[],SA_RESTORER|SA_NOCLDSTOP,0x7fefc6daf180},NULL,8) = 0
2997  00:58:30 rt_sigaction(SIGUSR2,{0x41d220,8) = 0
2997  00:58:30 rt_sigaction(SIGCHLD,{0x41c630,8) = 0
2997  00:58:30 geteuid()                = 1001
2997  00:58:30 getegid()                = 1001
2997  00:58:30 umask(0)                 = 022
2997  00:58:30 umask(022)               = 0
2997  00:58:30 brk(0)                   = 0xefb000
2997  00:58:30 brk(0xf1c000)            = 0xf1c000
2997  00:58:30 open("/usr/lib/locale/locale-archive",O_RDONLY|O_CLOEXEC) =
3
2997  00:58:30 fstat(3,st_size=1607632,1607632,0) =
0x7fefc71ac000
2997  00:58:30 close(3)                 = 0
2997  00:58:30 open("/etc/popt",O_RDONLY) = -1 ENOENT (No such file or
directory)
2997  00:58:30 open("/home/backup-user/.popt",O_RDONLY) = -1 ENOENT (No
such file or directory)
2997  00:58:30 rt_sigaction(SIGINT,{0x40cca0,8) = 0
2997  00:58:30 rt_sigaction(SIGHUP,8) = 0
2997  00:58:30 rt_sigaction(SIGTERM,8) = 0
2997  00:58:30 rt_sigprocmask(SIG_UNBLOCK,[HUP INT USR1 USR2 TERM CHLD],8) = 0
2997  00:58:30 rt_sigaction(SIGPIPE,{SIG_IGN,8) = 0
2997  00:58:30 rt_sigaction(SIGXFSZ,8) = 0
2997  00:58:30 getcwd("/home/backup-user",4095) = 13
2997  00:58:30 fcntl(0,F_GETFL)        = 0 (flags O_RDONLY)
2997  00:58:30 fcntl(0,F_SETFL,O_RDONLY|O_NONBLOCK) = 0
2997  00:58:30 fcntl(1,F_GETFL)        = 0x1 (flags O_WRONLY)
2997  00:58:30 fcntl(1,O_WRONLY|O_NONBLOCK) = 0
2997  00:58:30 fcntl(0,F_GETFL)        = 0x800 (flags O_RDONLY|O_NONBLOCK)
2997  00:58:30 fcntl(1,F_GETFL)        = 0x801 (flags O_WRONLY|O_NONBLOCK)
2997  00:58:30 write(1,"37",4) = 4

这是脚本停止的地方.我必须在服务器中多次返回.然后它继续:

2997  00:58:30 select(1,[0],{60,0}) = 1 (in [0],left {55,558348})
2997  00:58:34 read(0,"n",4)         = 1
2997  00:58:34 select(1,left {59,793510})
2997  00:58:35 read(0,3)         = 1
2997  00:58:35 select(1,975726})
2997  00:58:35 read(0,2)         = 1
2997  00:58:35 select(1,968630})
2997  00:58:35 read(0,1)         = 1
2997  00:58:35 write(2,"protocol version mismatch -- is your shell
clean?",49) = 49
2997  00:58:35 write(2,1)        = 1
2997  00:58:35 write(2,"(see the rsync man page for an explanation)",43)
= 43
2997  00:58:35 write(2,1)        = 1
2997  00:58:35 rt_sigaction(SIGUSR1,SA_RESTORER,8) = 0
2997  00:58:35 rt_sigaction(SIGUSR2,8) = 0
2997  00:58:35 write(2,"rsync error: protocol incompatibility (code 2) at
compat.c(178) [sender=3.1.2]",78) = 78
2997  00:58:35 write(2,1)        = 1
2997  00:58:35 nanosleep({0,100000000},NULL) = 0
2997  00:58:35 exit_group(2)            = ?
2997  00:58:35     exited with 2

经过几个小时的研究,我无法弄清楚出了什么问题.我删除了
并检查了所有可以写任何文本的内容(ssh welcome message,
.bashrc echos,passphrase甚至系统提示)和rsync仍然是
无法收集文件. ssh连接是无密码的.

我也做了真正的> testfile测试,没有问题:

backup-user@backup:~$/usr/bin/ssh -q -x -l backup-user 192.168.10.20 true
> testfile
backup-user@backup:~$ll testfile
-rw-r--r-- 1 backup-user backup-user 0 feb 16 02:26 testfile

线条:

2997  00:58:30 open("/etc/popt",O_RDONLY) = -1 ENOENT (No
such file or directory)

看起来很可疑,但也检查了涉及的库.

选项–server和–sender由BackupPC添加,但不应该
正如rsync文档所述,需要在常规使用中使用.

有人发现了同样的问题吗?我知道通常这是由在终端上写入数据的东西引起的,但是使用调试脚本我可以看到rsync是写入数据的过程.

希望这些信息足够清晰.谢谢你的时间.

解决方法

BackupPC可能使用Perl File :: Rsync模块连接到客户端.我怀疑这个模块中存在错误或兼容性问题.

Debian有一个BackupPC包.它应该列出所有适当的依赖项.源包可以列出依赖项.

我通常更喜欢打包模块,因为它们更有可能定期打补丁.如果您确实想从源代码构建,请考虑下载构建包并使用您自己的源代码替换源代码.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读