無法停止 postfix.service: 單元 postfix.service 未載入

無法停止 postfix.service: 單元 postfix.service 未載入

當我嘗試刪除時postfix出現此錯誤:

Removing postfix (3.1.0-3) ...
Failed to stop postfix.service: Unit postfix.service not loaded.
invoke-rc.d: initscript postfix, action "stop" failed.
dpkg: error processing package postfix (--remove):
 subprocess installed pre-removal script returned error exit status 5
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 postfix
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

原因是因為/etc/init.d/postfix不存在。

我創建了一個空白/etc/init.d/postfix文件並使用 使其可執行sudo chmod +x /etc/init.d/postfix,然後問題解決了。

答案2

這對我有用:

建立 postfix 檔案後,執行以下命令:

sudo apt-get purge postfix 

然後重新安裝postfix:

sudo apt-get --reinstall install postfix

相關內容