背景:需要在windows下共享ubuntu中的文件
安装过程挺坎坷,还好在下班前解决了。记录一下遇到的问题。
1.tcp连接建立失败
在windows下输入ubuntu的ip地址,根本不显示内容,连接不上,通过抓包发现tcp连接都没建立起来,client一直发syn包,server回复destination unreachable。想着会不会是ubuntu上有防火墙,通过iptables发现,果然REJECT:
-A INPUT -j REJECT --reject-with icmp-host-prohibited
解决办法就是在上述规则之前,打开对445端口的权限。
需要查看一下为什么会有这些iptables规则.
2.samba crash
解决完tcp问题之后,发现还是不行,可以看到文件夹了,但是很不稳定,根本不能用。
一通排查之后,在log里发现了有backtrace,通过查看进程发现,果然samba崩了。这下估计是samba程序本身有问题了,上网发现确实,由于版本比较低,samba有bug. 重新卸载samba,再把软件源update,再安装,一切OK.
dumping core in /var/log/samba/cores/smbd
[2017/08/25 17:44:57.846274, 0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
Bad talloc magic value - unknown value
[2017/08/25 17:44:57.846305, 0] ../source3/lib/util.c:789(smb_panic_s3)
PANIC (pid 29643): Bad talloc magic value - unknown value
[2017/08/25 17:44:57.846770, 0] ../source3/lib/util.c:900(log_stack_trace)
BACKTRACE: 28 stack frames:
#0 /usr/lib/x86_64-linux-gnu/samba/libsmbregistry.so.0(log_stack_trace+0x1a) [0x7fc48be871da]
#1 /usr/lib/x86_64-linux-gnu/samba/libsmbregistry.so.0(smb_panic_s3+0x20) [0x7fc48be872b0]
#2 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(smb_panic+0x2f) [0x7fc48cbfe8df]
#3 /usr/lib/x86_64-linux-gnu/libtalloc.so.2(_talloc_free+0x4de) [0x7fc4899862fe]
#4 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(+0x1246c) [0x7fc48cbf546c]
#5 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x18b457) [0x7fc48c840457]
#6 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(get_share_mode_lock+0x17e) [0x7fc48c840f1e]
#7 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0xfc5be) [0x7fc48c7b15be]
#8 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x100c5c) [0x7fc48c7b5c5c]
#9 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(create_file_default+0x1cf) [0x7fc48c7b70ef]
#10 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x1d962e) [0x7fc48c88e62e]
#11 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smb_vfs_call_create_file+0xd8) [0x7fc48c7bd928]
#12 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_smb2_request_process_create+0x1a24) [0x7fc48c7ec244]
#13 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_smb2_request_dispatch+0xc4d) [0x7fc48c7e3ced]
#14 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x12f972) [0x7fc48c7e4972]
#15 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(run_events_poll+0x16c) [0x7fc48ab1f95c]
#16 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(+0x25bb0) [0x7fc48ab1fbb0]
#17 /usr/lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x8d) [0x7fc489778d5d]
#18 /usr/lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x1b) [0x7fc489778efb]
#19 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_process+0x6c9) [0x7fc48c7d30b9]
#20 smbd(+0x96b6) [0x5628cbad26b6]
#21 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(run_events_poll+0x16c) [0x7fc48ab1f95c]
#22 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(+0x25bb0) [0x7fc48ab1fbb0]
#23 /usr/lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x8d) [0x7fc489778d5d]
#24 /usr/lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x1b) [0x7fc489778efb]
#25 smbd(main+0x15b4) [0x5628cbad06c4]
#26 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fc4893d1f45]
#27 smbd(+0x7a96) [0x5628cbad0a96]
[2017/08/25 17:44:57.846831, 0] ../source3/lib/util.c:801(smb_panic_s3)
smb_panic(): calling panic action [/usr/share/samba/panic-action 29643]
[2017/08/25 17:44:57.848460, 0] ../source3/lib/util.c:809(smb_panic_s3)
smb_panic(): action returned status 0
本来一个很简单的共享文件,花费了挺多时间。也学会了一些解决问题的思路。