我正在安装一些软件包,在安装其中一个软件包的过程中,系统挂起并且该软件包未安装。但是,该软件包已添加到已安装软件包的列表中。因此,我重新启动系统并尝试以下操作:
当我尝试删除该包时,它不起作用,因为它找不到配置文件。
当我尝试安装该软件包时,它说该软件包已安装,因此不会安装它
当我尝试更新时,它尝试删除该包,并遇到上述错误。
所以,我的问题是问是否有办法从已安装的软件包列表中手动删除软件包,或者是否有其他方法来解决这个问题?
当我跑步时: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)
答案1
有几种方法可以尝试。
第一个是修复/usr/share/cli-common/policy-remove
,以便在策略不存在时它不会失败:编辑其最后一行,使其运行rm -f
而不是rm
.那应该允许正确删除软件包。
如果失败,并且由于您正在尝试删除所有 Mono 软件包,因此删除失败的脚本应该足够安全postrm
:
sudo rm /var/lib/dpkg/info/lib{glade,glib,gtk}2.0-cil.postrm
脚本执行的唯一操作postrm
是取消注册策略,您并不关心该策略,因为无论如何您都会删除所有内容。
您不是唯一一个遭受此问题困扰的人:2012 年有报道称Debian 错误 692962。