![为什么使用 apt-get 安装 Samba 时会出现 initscript 错误?](https://linux22.com/image/524925/%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8%20apt-get%20%E5%AE%89%E8%A3%85%20Samba%20%E6%97%B6%E4%BC%9A%E5%87%BA%E7%8E%B0%20initscript%20%E9%94%99%E8%AF%AF%EF%BC%9F.png)
我正在尝试解决这个问题......
...通过重新安装 Samba,但我收到以下错误:
# apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdns45 libisccc40 liblwres40 libbind9-40 libisccfg40 libisc45
Use 'apt-get autoremove' to remove them.
Suggested packages:
openbsd-inetd inet-superserver smbldap-tools ldb-tools
The following NEW packages will be installed
samba
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/4780kB of archives.
After this operation, 12.7MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package samba.
(Reading database ... 56732 files and directories currently installed.)
Unpacking samba (from .../samba_2%3a3.2.5-4lenny13_amd64.deb) ...
Processing triggers for man-db ...
Setting up samba (2:3.2.5-4lenny13) ...
Generating /etc/default/samba...
Starting Samba daemons: nmbd failed!
invoke-rc.d: initscript samba, action "start" failed.
dpkg: error processing samba (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
samba
E: Sub-process /usr/bin/dpkg returned an error code (1)
之前我曾运行过以下命令:
apt-get remove --purge samba
rm -fr /etc/samba/
rm -fr /var/log/samba/*
答案1
要么你仍然有一个正在运行的
nmbd
,要么有一个杂散的pid文件,在这种情况下终止该nmbd
进程,删除pid文件,然后运行dpkg --configure nmbd
;或者您看到与重新安装之前相同的错误,这不是由于 samba 本身而是由于依赖项(例如
libwbclient0
或libtalloc2
或libc6
或内核或硬件)。运行nmbd -i
是否也会产生堆栈跟踪?您最近是否升级了其中一个依赖项?您最近是否运行了内存测试?
答案2
我遇到了同样的问题,只是我之前曾手动禁用过 smbd 和 nmbd,但不记得我是怎么做的。
检查是否可以启动 smbd 和 nmbd,方法是尝试启动两者:/etc/init.d/_mbd start
然后测试两者以查看它们是否仍在运行/etc/init.d/_mbd status
。如果它们仍未运行,请尝试确保两者的 init conf 文件仍然存在:/etc/init/_mbd.conf
。
答案3
嗯,这些命令似乎可以使安装正常工作(但没有解决我原来的问题):
apt-get remove --purge samba samba-common
apt-get install samba