Samba 4.13.14-Ubuntu 在连接的 macOS 客户端重新启动时出现混乱

Samba 4.13.14-Ubuntu 在连接的 macOS 客户端重新启动时出现混乱

刚刚全新安装Ubuntu 服务器 21.10然后Samba 4.13.14-Ubuntu通过:

sudo apt install samba avahi-daemon

每当连接到 Samba 的 macOS 客户端重新启动时,我都会收到以下电子邮件:

The Samba 'panic action' script, /usr/share/samba/panic-action,
was called for PID 24963 (/usr/sbin/smbd).

This means there was a problem with the program, such as a segfault.
Below is a backtrace for this process generated with gdb, which shows
the state of the program at the time the error occurred.  The Samba log
files may contain additional information about the problem.

If the problem persists, you are encouraged to first install the
samba-dbgsym package, which contains the debugging symbols for the Samba
binaries.  Then submit the provided information as a bug report to
Ubuntu by visiting this link:
https://launchpad.net/ubuntu/+source/samba/+filebug

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fb71b7be70f in __GI___wait4 (pid=25382, stat_loc=stat_loc@entry=0x7ffd2c2bb578, options=options@entry=0, usage=usage@entry=0x0) at ..
/sysdeps/unix/sysv/linux/wait4.c:30
#0  0x00007fb71b7be70f in __GI___wait4 (pid=25382, stat_loc=stat_loc@entry=0x7ffd2c2bb578, options=options@entry=0, usage=usage@entry=0x0) a
t ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007fb71b7be68b in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc@entry=0x7ffd2c2bb578, options=options@entry=0) at waitpid.c
:38
#2  0x00007fb71b72594b in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3  0x00007fb71bc4842f in smb_panic_s3 () from /lib/x86_64-linux-gnu/libsmbconf.so.0
#4  0x00007fb71bcb8fdb in smb_panic () from /lib/x86_64-linux-gnu/libsamba-util.so.0
#5  0x00007fb71bcb92b5 in ?? () from /lib/x86_64-linux-gnu/libsamba-util.so.0
#6  <signal handler called>
#7  0x0000000000000000 in ?? ()
#8  0x00007fb71b26448f in dbwrap_record_delete () from /usr/lib/x86_64-linux-gnu/samba/libdbwrap.so.0
#9  0x00007fb71be805e5 in smbXsrv_session_logoff () from /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0
#10 0x00007fb71be62e17 in ?? () from /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0
#11 0x00007fb71b8ff8ea in tevent_common_invoke_immediate_handler () from /lib/x86_64-linux-gnu/libtevent.so.0
#12 0x00007fb71b8ff90e in tevent_common_loop_immediate () from /lib/x86_64-linux-gnu/libtevent.so.0
#13 0x00007fb71b905760 in ?? () from /lib/x86_64-linux-gnu/libtevent.so.0
#14 0x00007fb71b903afb in ?? () from /lib/x86_64-linux-gnu/libtevent.so.0
#15 0x00007fb71b8feb28 in _tevent_loop_once () from /lib/x86_64-linux-gnu/libtevent.so.0
#16 0x00007fb71b8fee0b in tevent_common_loop_wait () from /lib/x86_64-linux-gnu/libtevent.so.0
#17 0x00007fb71b903a8b in ?? () from /lib/x86_64-linux-gnu/libtevent.so.0
#18 0x00007fb71be4cc38 in smbd_process () from /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0
#19 0x000055cc54ea793d in smbd_accept_connection (ev=0x55cc551e1c20, fde=<optimized out>, flags=<optimized out>, private_data=<optimized out
>) at ../../source3/smbd/server.c:1014

#20 0x00007fb71b8ff4a1 in tevent_common_invoke_fd_handler () from /lib/x86_64-linux-gnu/libtevent.so.0
#21 0x00007fb71b90597f in ?? () from /lib/x86_64-linux-gnu/libtevent.so.0
#22 0x00007fb71b903afb in ?? () from /lib/x86_64-linux-gnu/libtevent.so.0
#23 0x00007fb71b8feb28 in _tevent_loop_once () from /lib/x86_64-linux-gnu/libtevent.so.0
#24 0x00007fb71b8fee0b in tevent_common_loop_wait () from /lib/x86_64-linux-gnu/libtevent.so.0
#25 0x00007fb71b903a8b in ?? () from /lib/x86_64-linux-gnu/libtevent.so.0
#26 0x000055cc54ea5c3b in smbd_parent_loop (parent=0x55cc551f5040, ev_ctx=0x55cc551e1c20) at ../../source3/smbd/server.c:1361
#27 main (argc=<optimized out>, argv=<optimized out>) at ../../source3/smbd/server.c:2214
A debugging session is active.

/var/log/samba/log.smbd 显示:

[2021/11/17 11:21:31.378403,  0] ../../lib/util/fault.c:159(smb_panic_log)
  ===============================================================
[2021/11/17 11:21:31.378525,  0] ../../lib/util/fault.c:160(smb_panic_log)
  INTERNAL ERROR: Signal 11: Segmentation fault in pid 24963 (4.13.14-Ubuntu)
[2021/11/17 11:21:31.378565,  0] ../../lib/util/fault.c:164(smb_panic_log)
  If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
[2021/11/17 11:21:31.378595,  0] ../../lib/util/fault.c:169(smb_panic_log)
  ===============================================================
[2021/11/17 11:21:31.378621,  0] ../../lib/util/fault.c:170(smb_panic_log)
  PANIC (pid 24963): Signal 11: Segmentation fault in 4.13.14-Ubuntu
[2021/11/17 11:21:31.379046,  0] ../../lib/util/fault.c:274(log_stack_trace)
  BACKTRACE: 4 stack frames:
   #0 /lib/x86_64-linux-gnu/libsamba-util.so.0(log_stack_trace+0x34) [0x7fb71bcb63f4]
   #1 /lib/x86_64-linux-gnu/libsamba-util.so.0(smb_panic+0x2a) [0x7fb71bcb8fca]
   #2 /lib/x86_64-linux-gnu/libsamba-util.so.0(+0x232b5) [0x7fb71bcb92b5]
   #3 /lib/x86_64-linux-gnu/libc.so.6(+0x46520) [0x7fb71b717520]
[2021/11/17 11:21:31.379162,  0] ../../source3/lib/util.c:838(smb_panic_s3)
  smb_panic(): calling panic action [/usr/share/samba/panic-action 24963]
gdb: warning: Couldn't determine a path for the index cache directory.
30  ../sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
[2021/11/17 11:21:32.341990,  0] ../../source3/lib/util.c:845(smb_panic_s3)
  smb_panic(): action returned status 0
[2021/11/17 11:21:32.342045,  0] ../../source3/lib/dumpcore.c:317(dump_core)
  coredump is handled by helper binary specified at /proc/sys/kernel/core_pattern

我的客户是 macOS Monterey,其 /etc/nsmb.conf 中有以下内容:

signing_required = no
protocol_vers_map=6
port445=no_netbios

我的 Ubuntu Server 21.10 的 /etc/samba/smb.conf:

[global]
allow dns updates = disabled
bind interfaces only = Yes
client min protocol = SMB3_02
dcerpc endpoint servers = rpcecho
delete veto files = Yes
disable netbios = Yes
disable spoolss = Yes
dns forwarder = 192.168.1.1
dns proxy = No
enhanced browsing = No
# Next line requires catia (needed if no Windows clients?)
fruit:encoding = native
fruit:metadata = stream
# Next line never worked which is why I configure Avahi to set the icon
;fruit:model = Macmini7
# Do not use NFS access control entries
fruit:nfs_aces = No
# Enable extended attributes (requires streams_xattr)
fruit:resource = xattr
# Next line is already the default
;fruit:zero_file_id = Yes
host msdfs = No
inherit acls = Yes
inherit permissions = Yes
interfaces = lan
lm announce = No
load printers = No
log file = /var/log/samba/log.smbd
log level = 2
logging = file
max log size = 10000
# Next 2 lines defer mDNS config to Avahi
mdns name = mdns
multicast dns register = No
name resolve order = host bcast
pam password change = Yes
panic action = /usr/share/samba/panic-action %d
passwd chat = "*New Password:*" %n\n "*Reenter New Password:*" %n\n "*Password changed.*"
passwd program = /usr/bin/passwd %u
printcap cache time = 0
printcap name = /dev/null
printing = bsd
restrict anonymous = 2
rpc_daemon:spoolssd = disabled
rpc_server:epmapper = disabled
rpc_server:winreg = disabled
rpc_server:lsarpc = disabled
rpc_server:samr = disabled
rpc_server:netlogon = disabled
rpc_server:netdfs = disabled
rpc_server:dssetup = disabled
rpc_server:wkssvc = disabled
rpc_server:spoolss = disabled
rpc_server:svcctl = disabled
rpc_server:ntsvcs = disabled
rpc_server:eventlog = disabled
rpc_server:initshutdown = disabled
rpc_server:mdssvc = disabled
server max protocol = SMB3_11
server min protocol = SMB3_02
# Next line experimental until 4.15
server multi channel support = Yes
server role = standalone server
server services = rpc, smb
server string = %h server (Samba 4.13.14, Ubuntu 21.10)
show add printer wizard = No
smb ports = 445
unix password sync = Yes
use sendfile = Yes
veto files = /._*/.DS_Store/
vfs objects = catia fruit streams_xattr

[homes]
browseable = No
comment = Home Directory
fruit:time machine = No
guest ok = No
spotlight = No
valid users = %S
writable = Yes

[Backup]
comment = Time Machine
fruit:time machine = Yes
guest ok = No
path = /external/%U
spotlight = No
valid users = %U
writable = Yes

为了完整起见,这是我的 /etc/avahi/services/samba.service:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name replace-wildcards="yes">Saint James</name>
 <service>
   <type>_smb._tcp</type>
   <port>445</port>
 </service>
 <service>
   <type>_device-info._tcp</type>
   <port>0</port>
   <txt-record>model=Macmini7</txt-record>
 </service>
 <service>
   <type>_adisk._tcp</type>
   <txt-record>sys=waMa=0,adVF=0x100</txt-record>
   <txt-record>dk0=adVN=Backup,adVF=0x82</txt-record>
 </service>
</service-group>

只需要为 macOS Monterey 客户端提供文件共享和 Time Machine(无需 Windows 客户端、无需打印、无需 Active Directory、无需 DFS)。

有谁看到这个吗?

答案1

不,您需要从源代码安装。您能从 PPA 获得的最佳版本是 4.14(“samba 最新 PPA” 已 178 个工作日未更新)。

PANIC(pid 1772):信号 11:4.13.14-Ubuntu 中的分段错误

如果在此错误上方和下方多添加几行代码,您可能会得到更好的结果。仅此一行代码,我就找不到遇到相同问题的人。

分段错误是安全漏洞,因此将被移植到所有受支持的版本中。这些错误对于 Samba 来说相当常见;我在每个 Samba 版本中都见过它们,4.15.2已经不完美了,所以从源代码安装可能无法解决您的问题。所以最好提交错误报告并等待更新。

答案2

问题出在我的 smb.conf 中的这行...

server multi channel support = Yes

显然,这个实验性功能在 4.15 之前的版本中运行不佳(虽然我使用的是 macOS 客户端,但其他类型的客户端可能也会这样)。关闭它可以解决问题。

相关内容