Samba 安装失败,缺少目录

Samba 安装失败,缺少目录

我尝试在我的 Debian 服务器上安装 Samba,但安装失败,

$ sudo apt install samba -y

Preparing to unpack .../samba_2%3a4.9.5+dfsg-5+deb10u1_amd64.deb ...
Unpacking samba (2:4.9.5+dfsg-5+deb10u1) ...
Setting up samba (2:4.9.5+dfsg-5+deb10u1) ...
Samba is not being run as an AD Domain Controller: Masking samba-ad-dc.service
Please ignore the following error about deb-systemd-helper not finding those services.
(samba-ad-dc.service masked)
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 Sun 2021-01-24 15:08:59 CET; 20ms ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 30205 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
  Process: 30214 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=1/FAILURE)
 Main PID: 30214 (code=exited, status=1/FAILURE)

Jan 24 15:08:59 domain.not systemd[1]: Starting Samba SMB Daemon...
Jan 24 15:08:59 domain.not update-apparmor-samba-profile[30205]: grep: /etc/apparmor.d/samba/smbd-shares: No such file or directory
Jan 24 15:08:59 domain.not update-apparmor-samba-profile[30205]: diff: /etc/apparmor.d/samba/smbd-shares: No such file or directory
Jan 24 15:08:59 domain.not systemd[1]: smbd.service: Main process exited, code=exited, status=1/FAILURE
Jan 24 15:08:59 domain.not systemd[1]: smbd.service: Failed with result 'exit-code'.
Jan 24 15:08:59 domain.not 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 systemd (241-7~deb10u5) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
Errors were encountered while processing:
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

虽然我想按照说明忽略错误 ( Please ignore the following error),但它让我的软件包没有完全安装。没关系,我相信这个问题可以以某种方式修复。

问题是该包不起作用。通过谷歌搜索并手动运行(以 root 身份)

$ /usr/sbin/nmbd -S -d 1

我得到了相关信息

mkdir failed on directory /var/log/samba/cores: No such file or directory
Failed to create /var/log/samba/cores for user 0 with mode 0700
Unable to setup corepath for nmbd: No such file or directory
ERROR: Can't log to stdout (-S) unless daemon is in foreground (-F) or interactive (-i)

/var/log/samba存在。所以我创建了它并重试,现在有了-i并获得了另一个相关信息

nmbd version 4.9.5-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2018
mkdir failed on directory /var/lib/samba/private/msg.sock: No such file or directory

再次,该文件夹/var/lib/samba/private不存在。此时,我怀疑自己手动创建此文件夹是否是正确的方向,因为 /var/lib 可能安装在某种临时存储上。

基本上我有两个问题

  • 我们(管理员)是否应该手动修补安装(众所周知的、广泛使用的软件)?
  • 我做错了什么,导致我无法像其他人一样安装 Samba(我已经安装过了Debian GNU/Linux 10 (buster) (4.19.0-8-amd64)

答案1

重新安装 samba(使用apt-get remove --purge sambaapt-get install samba)不起作用,但有效的是重新安装 samba-common 和 samba-common-bin

apt-get install --reinstall samba-common samba-common-bin

相关内容