Ubuntu下重新安装软件 配置文件不重新生成得问题解决

今天在Ubuntu中实验时,突然Samba服务器失灵了,决定卸载重新安装,使用apt-get remove 命令之后,发现原来的配置文件/etc/samba/smb.conf和其他的一些Samba相关的文件夹都存在,决定手工删除(怀疑是配置文件出了问题),

然而在删除了Samba相关的文件夹和文件之后,使用apt-get  install 重新安装Samba时突然发现根本不会重新生成配置文件,这些蒙圈了。。。。。

百度了好久,在群里面问  也没找到答案

仔细查看重新安装时的提示信息,发现有一句

Not replacing deleted config file /etc/samba/smb.conf

如图


这个是突破口了,

查找到如下资料

If you installed phpmyadmin in your Debian and you receive this kind of errors:

Not replacing deleted config file /etc/phpmyadmin/apache.conf
Not replacing deleted config file /etc/phpmyadmin/config.footer.inc.php
Not replacing deleted config file /etc/phpmyadmin/config.header.inc.php
Not replacing deleted config file /etc/phpmyadmin/config.inc.php
Not replacing deleted config file /etc/phpmyadmin/htaccess
Not replacing deleted config file /etc/phpmyadmin/apache.conf
Not replacing deleted config file /etc/phpmyadmin/config.footer.inc.php
Not replacing deleted config file /etc/phpmyadmin/config.header.inc.php
Not replacing deleted config file /etc/phpmyadmin/config.inc.php
Not replacing deleted config file /etc/phpmyadmin/htaccess

Do as follow:

apt-get remove phpmyadmin
dpkg -P phpmyadmin
apt-get install phpmyadmin

And you will see this text as output:

Creating config file /etc/phpmyadmin/apache.conf with new version

Creating config file /etc/phpmyadmin/config.footer.inc.php with new version

Creating config file /etc/phpmyadmin/config.header.inc.php with new version

Creating config file /etc/phpmyadmin/config.inc.php with new version

Creating config file /etc/phpmyadmin/htaccess with new version

于是

按照  先 remove  然后  dpkg -P 再重新install的顺序 成功搞定

生成了新的smb.conf

linux@linux-virtual-machine:/etc$ sudo dpkg -P samba-client
dpkg:警告:ignoring request to remove samba-client which isn't installed
linux@linux-virtual-machine:/etc$ sudo apt-get install samba-common samba
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列软件包是自动安装的并且现在不需要了:
  apturl apturl-common libntdb1 python-ntdb
Use 'apt-get autoremove' to remove them.
将会安装下列额外的软件包:
  samba-common-bin
建议安装的软件包:
  bind9 bind9utils ldb-tools ntp smbldap-tools winbind heimdal-clients
下列【新】软件包将被安装:
  samba samba-common samba-common-bin
升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 542 个软件包未被升级。
需要下载 0 B/1,503 kB 的软件包。
解压缩后会消耗掉 13.5 MB 的额外空间。
您希望继续执行吗? [Y/n] y
正在预设定软件包 ...
Selecting previously unselected package samba-common.
(正在读取数据库 ... 系统当前共安装有 172908 个文件和目录。)
Preparing to unpack .../samba-common_2%3a4.3.11+dfsg-0ubuntu0.14.04.3_all.deb ...
Unpacking samba-common (2:4.3.11+dfsg-0ubuntu0.14.04.3) ...
Selecting previously unselected package samba-common-bin.
Preparing to unpack .../samba-common-bin_2%3a4.3.11+dfsg-0ubuntu0.14.04.3_i386.deb ...
Unpacking samba-common-bin (2:4.3.11+dfsg-0ubuntu0.14.04.3) ...
Selecting previously unselected package samba.
Preparing to unpack .../samba_2%3a4.3.11+dfsg-0ubuntu0.14.04.3_i386.deb ...
Unpacking samba (2:4.3.11+dfsg-0ubuntu0.14.04.3) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
正在设置 samba-common (2:4.3.11+dfsg-0ubuntu0.14.04.3) ...


Creating config file /etc/samba/smb.conf with new version
正在设置 samba-common-bin (2:4.3.11+dfsg-0ubuntu0.14.04.3) ...
正在设置 samba (2:4.3.11+dfsg-0ubuntu0.14.04.3) ...
smbd start/running, process 11833
nmbd start/running, process 11873
samba-ad-dc start/running, process 11912
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...
linux@linux-virtual-machine:/etc$ ls /etc/samba/
gdbcommands  smb.conf  tls
linux@linux-virtual-machine:/etc$ 

你可能感兴趣的:(Linux经典【原创】)