從 /etc/samba 刪除設定檔後無法重新安裝 samba

從 /etc/samba 刪除設定檔後無法重新安裝 samba

我對損壞的 samba 設定檔很生氣。我剛剛刪除了該/etc/samba資料夾。現在我想重新安裝 samba 但不能。

這就是我所做的:

sudo apt-get install samba
sudo vim /etc/samba/... # broke something in the config
sudo apt-get remove --purge samba
# realized that the config file in the `/etc/samba` is still there.
sudo rm -r /etc/samba
sudo apt-get install samba # getting error

我想刪除森巴(徹底刪除)然後像什麼都沒發生一樣安裝它?

這個怎麼做?

[編輯]

dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (215-17+deb8u4) ...
Errors were encountered while processing:
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

  • 首次安裝大小為 54.2MB
  • 卸載後大小為11.5MB
  • 第二次安裝大小為 11.5MB

答案1

大多數情況下,您的安裝除了 samba 軟體包之外還安裝了更多依賴軟體套件。那麼為什麼您的下一次安裝不需要之前下載的檔案的大小。因此,如果您需要像您要求的那樣完全刪除它,那麼您需要卸載它並刪除不需要的依賴項。

sudo apt-get remove --purge samba samba-*
sudo apt-get autoremove

之後,如果您在 /etc/samba 中找到配置文件,最好將其重命名。

sudo mv  /etc/samba /etc/samba.old

現在您可以透過發出命令來安裝 samba

sudo apt-get install samba

就是這樣。

相關內容