Debian

無法刪除 CLI 庫包

  • December 15, 2018

我正在安裝一些軟體包,在安裝一個軟體包期間,系統掛起並且未安裝軟體包。但是,該軟體包已添加到已安裝軟體包的列表中。因此,我重新啟動系統並嘗試以下操作:

  • 當我嘗試刪除軟體包時,它不起作用,因為它找不到配置文件。
  • 當我嘗試安裝該軟體包時,它說該軟體包已安裝,因此不會安裝它
  • 當我嘗試更新時,它會嘗試刪除包,並遇到上述錯誤。

所以,我的問題是問是否有辦法從已安裝的包列表中手動刪除一個包,或者有沒有另一種方法來解決這個問題?

當我執行時:sudo apt-get upgrade

錯誤是:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
 libglade2.0-cil libglib2.0-cil libgtk2.0-cil
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
18 not fully installed or removed.
After this operation, 2,819 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 119043 files and directories currently installed.)
Removing libglade2.0-cil (2.12.26-0xamarin1) ...
E: File does not exist: /usr/share/cli-common/packages.d/policy.2.8.glade-sharp.installcligac
dpkg: error processing package libglade2.0-cil (--remove):
subprocess installed post-removal script returned error exit status 1
Removing libgtk2.0-cil (2.12.26-0xamarin1) ...
E: File does not exist: /usr/share/cli-common/packages.d/policy.2.6.gtk-dotnet.installcligac
dpkg: error processing package libgtk2.0-cil (--remove):
subprocess installed post-removal script returned error exit status 1
Removing libglib2.0-cil (2.12.26-0xamarin1) ...
E: File does not exist: /usr/share/cli-common/packages.d/policy.2.6.glib-sharp.installcligac
dpkg: error processing package libglib2.0-cil (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
libglade2.0-cil
libgtk2.0-cil
libglib2.0-cil
E: Sub-process /usr/bin/dpkg returned an error code (1)

有幾種方法可以嘗試。

第一個是修復/usr/share/cli-common/policy-remove,以便在沒有策略的情況下不會失敗:編輯其最後一行,使其執行rm -f而不是rm. 這應該允許正確刪除包。

postrm如果失敗了,並且由於您正在嘗試刪除所有 Mono 包,那麼刪除失敗的腳本應該足夠安全:

sudo rm /var/lib/dpkg/info/lib{glade,glib,gtk}2.0-cil.postrm

腳本所做的唯一操作postrm是取消註冊策略,您並不關心這一點,因為無論如何您都在刪除所有內容。

您不是唯一遭受此問題的人:它在 2012 年被報告為Debian bug 692962

引用自:https://unix.stackexchange.com/questions/357798