在我的 ubuntu 機器上,嘗試安裝 openntpd 時出現錯誤,然後就持續錯誤無法安裝也無法移除。
錯誤訊息如下:
user@HTPC:/home$ sudo apt-get install -f 正在讀取套件清單... 完成 正在重建相依關係 正在讀取狀態資料... 完成 升級 0 個,新安裝 0 個,移除 0 個,有 59 個未被升級。 1 個沒有完整得安裝或移除。 此操作完成之後,會多佔用 0 B 的磁碟空間。 正在設定 openntpd (3.9p1+debian-9) ... Starting openntpd: /etc/openntpd/ntpd.conf: Permission denied invoke-rc.d: initscript openntpd, action "start" failed. dpkg:在處理 openntpd (--configure) 時發生錯誤: 子程序 已安裝的 post-installation script 傳回了錯誤退出狀態 1 在處理時有錯誤發生: openntpd E: Sub-process /usr/bin/dpkg returned an error code (1)
解決方法~用 --purge 移除套件及設定檔即可,例如:
sudo apt-get remove --purge openntpd結果如下:
正在讀取套件清單... 完成 正在重建相依關係 正在讀取狀態資料... 完成 下列套件將會被【移除】: openntpd* 升級 0 個,新安裝 0 個,移除 1 個,有 59 個未被升級。 1 個沒有完整得安裝或移除。 此操作完成之後,會空出 162 kB 的磁碟空間。 是否繼續進行 [Y/n]? (正在讀取資料庫 ... 目前共安裝了 203010 個檔案和目錄。) 正在移除 openntpd ... Stopping openntpd: ntpd. 正在清除 openntpd 的設定檔 ... 正在進行 man-db 的觸發程式 ... 正在進行 ureadahead 的觸發程式 ...
2014-06-24 補充:
又遇到一次類似的問題,但是上面完整移除的方法無效。
錯誤訊息如下:
dpkg: error processing nova-common (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of nova-compute: nova-compute depends on nova-common (= 1:2014.1-0ubuntu1~cloud0); however: Package nova-common is not configured yet. dpkg: error processing nova-compute (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of nova-compute-libvirt: nova-compute-libvirt depends on nova-compute (= 1:2014.1-0ubuntu1~cloud0); however: Package nova-compute is not configured yet. dpkg: error processing nova-compute-libvirt (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of nova-compute-kvm: nova-compute-kvm depends on nova-compute-libvirt (= 1:2014.1-0ubuntu1~cloud0); however: Package nova-compute-libvirt is not configured yet. dpkg: error processing nova-compute-kvm (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. No apport report written because the error message indicates its a followup error from a previous failure. No apport report written because MaxReports is reached already Errors were encountered while processing: nova-common nova-compute nova-compute-libvirt nova-compute-kvm E: Sub-process /usr/bin/dpkg returned an error code (1)
這次找到的方法有蠻多種的,看起來比較安全(沒有要自己直接去改 dpkg 的記錄檔)的方法 [2] 如下:
1. 使用 dpkg 指令移除壞掉的軟體
sudo dpkg -r nova-common nova-compute nova-compute-libvirt nova-compute-kvm
此時顯示的結果如下
(Reading database ... 95796 files and directories currently installed.) Removing nova-compute ... Removing nova-compute-libvirt ... Removing nova-compute-kvm ... Processing triggers for man-db ... Processing triggers for ureadahead ...
2. 執行修復
sudo apt-get install -f
3. 重新更新
sudo apt-get update
參考資料:
1、Sub-process /usr/bin/dpkg returned an error code (1)
2、trying to overwrite '/usr/bin/opencv_haartraining', which is also in package libopencv2.3-bin 2.3.1+svn6514+branch23-12~oneiric
沒有留言:
張貼留言