![Samba 4.1.6 在 14.04 LTS 上出现段错误](https://linux22.com/image/979401/Samba%204.1.6%20%E5%9C%A8%2014.04%20LTS%20%E4%B8%8A%E5%87%BA%E7%8E%B0%E6%AE%B5%E9%94%99%E8%AF%AF.png)
每当我使用 Windows 资源管理器打开文件时,我的 Samba 网络文件夹就会在 Windows 7 机器上断开连接。文件夹图标会变灰一分钟左右,然后才再次可用。但是,始终可以通过 Python 脚本等以编程方式读取相同的文件。
我网络上的所有 Windows 7 机器都受到影响,除了位于 Ubuntu 服务器(托管 Samba)上的 Windows 7 Virtualbox VM。目前没有身份验证,即所有来宾一旦连接即可读取和写入。共享文件夹权限为 777。
下面的 Samba 日志片段证实,每当网络驱动器断开连接时,我都会遇到段错误。有人告诉我,这可能是未解决的错误 #913809,我找到的最接近的描述是荷兰的讨论。设置完全限定的主机名没有帮助。
此外,在所有 Windows 7 机器(虚拟机和非虚拟机)上,我还可以看到大量文件状态“权限被拒绝”错误。它们显然是良性的,因为我在未遭受段错误/断开连接的 Windows 7 VM 上仍然会遇到大量此类错误。但我不知道它们是否与段错误有关。这些错误源自:
../source3/param/loadparm.c:4365(process_usershare_file)
如果不升级 14.04 LTS,尝试较新版本的 Samba(看看问题是否消失)的最安全方法是什么?我不知道 Ubuntu 是否有可下载的 Samba 二进制文件,似乎人们只是手动卸载 Samba 并从源代码重新编译?
总结一下:我的 Samba 大部分时间都“正常工作”,直到我尝试双击 Windows 资源管理器中的文件。浏览和程序化文件读取始终工作正常。Samba 仅在与 Ubuntu/Samba 服务器通信的本地网络上的 Windows 7 计算机上发生段错误。它在位于 Ubuntu/Samba 服务器上的 Windows 7 VM 上工作正常,从未发生段错误,只是我在日志中收到令人困惑的文件状态“权限被拒绝”错误流。
这是段错误:
===============================================================
[2015/03/17 11:12:51.861983, 0] ../lib/util/fault.c:73(fault_report)
INTERNAL ERROR: Signal 11 in pid 10219 (4.1.6-Ubuntu)
Please read the Trouble-Shooting section of the Samba HOWTO
[2015/03/17 11:12:51.862024, 0] ../lib/util/fault.c:75(fault_report)
===============================================================
[2015/03/17 11:12:51.862049, 0] ../source3/lib/util.c:785(smb_panic_s3)
PANIC (pid 10219): internal error
[2015/03/17 11:12:51.863249, 0] ../source3/lib/util.c:896(log_stack_trace)
BACKTRACE: 27 stack frames:
#0 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(log_stack_trace+0x1a) [0x7f4fb8ffdf3a]
#1 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(smb_panic_s3+0x20) [0x7f4fb8ffe010]
#2 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(smb_panic+0x2f) [0x7f4fba526c6f]
#3 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(+0x1ae86) [0x7f4fba526e86]
#4 /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f4fba74e340]
#5 /lib/x86_64-linux-gnu/libc.so.6(strlen+0x2a) [0x7f4fb76ac56a]
#6 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(push_ucs2_talloc+0x1e) [0x7f4fba52bc1e]
#7 /usr/lib/x86_64-linux-gnu/samba/libcliauth.so.0(E_md4hash+0x1e) [0x7f4fb9b198fe]
#8 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(create_volume_objectid+0x3a) [0x7f4fba0e2b7a]
#9 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(+0x1c428b) [0x7f4fba1c528b]
#10 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(smb_vfs_call_fsctl+0x58) [0x7f4fba104c88]
#11 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(smb2_ioctl_filesys+0x76) [0x7f4fba137bb6]
#12 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(smbd_smb2_request_process_ioctl+0x7ee) [0x7f4fba1377ce]
#13 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(smbd_smb2_request_dispatch+0xbcd) [0x7f4fba128f5d]
#14 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(+0x128c8b) [0x7f4fba129c8b]
#15 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(+0x1298fc) [0x7f4fba12a8fc]
#16 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(run_events_poll+0x16c) [0x7f4fb90140ac]
#17 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(+0x37300) [0x7f4fb9014300]
#18 /usr/lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x8d) [0x7f4fb79ec5ed]
#19 /usr/lib/x86_64-linux-gnu/samba/libsmbd_base.so.0(smbd_process+0x9ca) [0x7f4fba1165ca]
#20 smbd(+0x9fa4) [0x7f4fbab8afa4]
#21 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(run_events_poll+0x16c) [0x7f4fb90140ac]
#22 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(+0x37300) [0x7f4fb9014300]
#23 /usr/lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x8d) [0x7f4fb79ec5ed]
#24 smbd(main+0x13eb) [0x7f4fbab87b8b]
#25 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f4fb7644ec5]
#26 smbd(+0x6f1d) [0x7f4fbab87f1d]
这是正在使用的用户共享文件的示例。我认为它是在您浏览目标文件夹以启用共享时由 GUI 自动创建的。
$ cat /var/lib/samba/usershares/foobar
#VERSION 2
path=/data/foobar
comment=
usershare_acl=S-1-1-0:f
guest_ok=y
sharename=foobar
这几乎是默认的 samba.conf。
#=================================================================
[global]
## Browsing/Identification ###
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
; wins server = w.x.y.z
dns proxy = no
#### Networking ####
; interfaces = 127.0.0.0/8 eth0
; bind interfaces only = yes
#### Debugging/Accounting ####
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
########## Domains ###########
; logon path = \\%N\profiles\%U
; logon drive = H:
; logon script = logon.cmd
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
; add group script = /usr/sbin/addgroup --force-badname %g
############ Misc ############
; include = /home/samba/etc/smb.conf.%m
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash
; usershare max shares = 100
usershare allow guests = yes
#======================= Share Definitions =======================
;[homes]
; comment = Home Directories
; browseable = no
; read only = yes
; create mask = 0700
; directory mask = 0700
; valid users = %S
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
; write list = root, @lpadmin