使用 apt 时 Samba SMB 守护进程未启动

使用 apt 时 Samba SMB 守护进程未启动

在 Ubuntu 18.04 上,无论何时我这样做apt upgrade(即使没有要升级的软件包):

root@JohnPC:/home/john# apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
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] y
Setting up samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.2) 

...

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 "restart" failed.
● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-08-17 08:13:54 BST; 27ms ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 28404 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=1/FAILURE)
 Main PID: 28404 (code=exited, status=1/FAILURE)

Aug 17 08:13:54 JohnPC systemd[1]: Starting Samba SMB Daemon...
Aug 17 08:13:54 JohnPC systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
Aug 17 08:13:54 JohnPC systemd[1]: smbd.service: Failed with result 'exit-code'.
Aug 17 08:13:54 JohnPC 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)
root@JohnPC:/home/john# systemctl status smbd.service
● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-08-17 08:13:54 BST; 43s ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 28404 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, st
 Main PID: 28404 (code=exited, status=1/FAILURE)

Aug 17 08:13:54 JohnPC systemd[1]: Starting Samba SMB Daemon...
Aug 17 08:13:54 JohnPC systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
Aug 17 08:13:54 JohnPC systemd[1]: smbd.service: Failed with result 'exit-code'.
Aug 17 08:13:54 JohnPC systemd[1]: Failed to start Samba SMB Daemon.

答案1

打开终端并运行以下命令:

testparm -s

您是否收到以下错误:

WARNING: Ignoring invalid value 'share' for parameter 'security'
Error loading services.

如果您确实编辑了 /etc/samba/smb.conf,请找到“security = share”行并将其删除。然后重新运行 systemctl status smbd.service。

可能是另一个参数导致了问题,但这是最常见的。在所有情况下,testparm 都会提示有问题的参数,并以“加载服务错误”错误结束。

编辑:如果 /etc/samba 没有 smb.conf,但 /usr/share/samba 有一个,则将其复制到标准位置:

sudo cp /usr/share/samba/smb.conf /etc/samba

再次运行“testparm -s”以确保其正常运行。

答案2

同样的问题。nmbd-logfile 抱怨 ipv6 上的 netbios 存在一些问题。所以我检查了 smb.conf,在 [globals] 中,我发现接口绑定到了“eth*”,但我的接口名称是“enp0s31f6”。更改后,smbd 和 nmbd 都启动正常。我的“apt-get upgrade”问题也消失了 :)

答案3

我遇到了同样的问题,并将绑定接口从 更改smb.confeno0eno1我的实际接口),但问题仍然存在。

smb.conf.ucf-dist然后我意识到在同一个文件夹中有一个/etc/samba绑定了错误的接口eth0

我将其更改为eno1,保存,然后就可以apt update并且upgrade不再出现问题...看起来某些配置或全部配置都取自此文件(如果它存在于文件夹中)。

相关内容