无法启动 Samba SMB 守护程序。结果为“退出代码”

无法启动 Samba SMB 守护程序。结果为“退出代码”

我的 ubuntu 运行正常,我登录了一个 shell 并发现一些软件包可以升级,因此我启动了一个apt update && apt upgrade,过了一会儿我收到一个错误:

fmf@kodi:~$ sudo apt upgrade
[sudo] password for fmf:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.3) ...
Samba is not being run as an AD Domain Controller.
Please ignore the following error about deb-systemd-helper not finding samba-ad-dc.service.
Job for smbd.service failed because the control process exited with error code.
See "systemctl status smbd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript smbd, action "start" failed.
● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-11-07 17:05:30 CET; 25ms ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 1873 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=1/FAILURE)
 Main PID: 1873 (code=exited, status=1/FAILURE)

Nov 07 17:05:30 kodi systemd[1]: Starting Samba SMB Daemon...
Nov 07 17:05:30 kodi systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
Nov 07 17:05:30 kodi systemd[1]: smbd.service: Failed with result 'exit-code'.
Nov 07 17:05:30 kodi systemd[1]: Failed to start Samba SMB Daemon.
dpkg: error processing package samba (--configure):
 installed samba package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)
fmf@kodi:~$

我尝试完全删除 Samba 并apt remove --purge samba从头开始重新安装,但仍然没有成功。我还删除了文件/etc/samba/smb.conf并再次尝试,仍然没有成功。重新启动,仍然没有成功。

fmf@kodi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
fmf@kodi:~$
fmf@kodi:~$ samba
[2018/11/07 17:04:05.862379,  0] ../lib/util/debug.c:1053(reopen_logs_internal)
  Unable to open new log file '/var/log/samba/log.samba': No such file or directory
[2018/11/07 17:04:05.862951,  0] ../source4/smbd/server.c:448(binary_smbd_main)
  samba version 4.7.6-Ubuntu started.
  Copyright Andrew Tridgell and the Samba Team 1992-2017

有什么建议吗?

编辑按照评论的要求:

fmf@kodi:~$ grep smbd /var/log/auth.log
Nov  7 16:34:44 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/bin/systemctl status smbd.service
Nov  7 16:36:10 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/bin/systemctl status smbd.service
Nov  7 16:37:26 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/sbin/service smbd restart
Nov  7 16:41:12 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/sbin/service smbd restart
Nov  7 16:46:19 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/sbin/dpkg-reconfigure smbd
Nov  7 16:46:44 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/sbin/dpkg-reconfigure smbd
Nov  7 16:47:26 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/sbin/service smbd stop
Nov  7 16:47:50 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/bin/apt install smbd
Nov  7 17:07:41 kodi sudo:      fmf : TTY=pts/0 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/bin/dpkg --install smbd
Nov  8 11:00:57 kodi sudo:      fmf : TTY=pts/2 ; PWD=/home/fmf ; USER=root ; COMMAND=/usr/sbin/service smbd restart
fmf@kodi:~$

我觉得这里没什么问题,对吗?

答案1

Fedora 29、docker 容器中也存在同样的问题。

至少在 Docker 容器中,问题是服务总线的日志记录现在已关闭,因此无法正常工作......

解决方案是将我的配置更改为以-i标志开头。例如

/sbin/smbd -i -F

/sbin/nmbd -i -F

然后日志就转到控制台了,一切正常。

Ubuntu 问题很可能也是日志记录失败的问题。

答案2

这可能是一个错误,正如所报告的Debian 错误跟踪器上

您可以尝试删除 winbind 包并重试。

sudo apt-get remove winbind
sudo apt-get update
sudo apt-get dist-upgrade

答案3

Ubuntu 服务器 22.04 中也存在同样的问题。解决方案是创建一个新的文件共享,然后运行:

smbd start

相关内容