之前在ubuntu上配置samba已经多次,今天突然发现,我的电脑映射到服务器的网盘无法访问了,在输入用户名和密码后,界面一直在“连接中”的界面,或者干脆提示无法访问。但删除网盘后再连接,还是会提示输入用户名和密码(这说明至少连接是正常的),输入之后同之前一样,连接中,或者无法访问。
一般这种情况应该是服务出了问题,类似之前配置SVN服务也是一样。不好检查,那我就卸载后重装下samba吧,结果除了挺多问题的。大概过程如下:
//卸载命令
sudo apt autoremove samba
//卸载最后提示有异常
Error: Sub-process /usr/bin/dpkg returned an error code (1)
按照gpt的提示,如下操:
//卸载 Samba 和依赖
sudo apt remove --purge samba samba-common-bin
//清理不再需要的依赖包
sudo apt autoremove
//删除残留的配置文件和数据
sudo rm -rf /etc/samba
sudo rm -rf /var/lib/samba
//重启
sudo reboot
//重启后再安装
apt-get install samba
//安装最后提示如下错误
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
samba : Depends: python-samba but it is not going to be installed
Depends: samba-common (= 2:4.3.11+dfsg-0ubuntu0.16.04.34) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed
Depends: samba-common-bin (= 2:4.3.11+dfsg-0ubuntu0.16.04.34) but it is not going to be installed
Depends: libpython2.7 (>= 2.7) but it is not going to be installed
Depends: libwbclient0 (= 2:4.3.11+dfsg-0ubuntu0.16.04.34) but 2:4.15.13+dfsg-0ubuntu0.20.04.7 is to be installed
Depends: samba-libs (= 2:4.3.11+dfsg-0ubuntu0.16.04.34) but it is not going to be installed
Recommends: attr
Recommends: samba-dsdb-modules but it is not going to be installed
Recommends: samba-vfs-modules but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
如上提示,gpt提示2种可能:
错误表明你正在尝试安装的软件包版本之间存在不兼容性,特别是关于依赖关系。可能的原因是你的软件包存储库配置中存在问题,或者系统中有一些软件包处于 "held" 状态,无法进行升级或安装。
按照提示执行:
sudo apt update
sudo apt-get -f install
dpkg --get-selections | grep held //没有发现held的包
#s