我把本地包裹系统弄乱了,该如何修复?

我把本地包裹系统弄乱了,该如何修复?

最近删除 PPA 后,我的本地软件包系统变得一团糟。它现在要求我运行sudo apt-get -f install以修复依赖项。

等了几天问题才解决(有时依赖关系会因新软件包发布而发生变化),但最终还是没有解决。所以我的问题是:有什么办法?重新安装系统是唯一的方法吗?

Note:我知道这里不是处理 alpha 版本问题的地方,但是我认为值得就如何解决该问题给出一个一般性的答案。

PS:我的具体问题的终端输出

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  libx264-118
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libglib2.0-0 libglib2.0-bin libglib2.0-dev
Suggested packages:
  libglib2.0-doc
The following packages will be upgraded:
  libglib2.0-0 libglib2.0-bin libglib2.0-dev
3 upgraded, 0 newly installed, 0 to remove and 150 not upgraded.
9 not fully installed or removed.
Need to get 0 B/3.062 kB of archives.
After this operation, 130 kB disk space will be freed.
Do you want to continue [Y/n]? y
dpkg: error processing libglib2.0-0 (--configure):
 libglib2.0-0:amd64 2.31.14-0ubuntu1~build1 cannot be configured because libglib2.0-0:i386 is in a different version (2.31.14-0ubuntu1)
dpkg: dependency problems prevent configuration of libglib2.0-bin:
 libglib2.0-bin depends on libglib2.0-0 (= 2.31.14-0ubuntu1~build1); however:
  Package libglib2.0-0 is not configured yet.
dpkg: error processing libglib2.0-bin (--configure):
 dependency problems - leaving unconfiguredNo apport report written because the error message indicates its a followup error from a previous failure.

dpkg: dependency problems prevent configuration of libglib2.0-dev:
 libglib2.0-dev depends on libglib2.0-0 (= 2.31.14-0ubuntu1~build1); however:
  Package libglib2.0-0 is not configured yet.
 libglib2.0-dev depends on libglib2.0-bin (= 2.31.14-0ubuntu1~build1); however:
  Package libglib2.0-bin is not configured yet.
dpkg: error processing libglib2.0-dev (--configure):
 dependency problems - leaving unconfigured
dpkg: error processing libglib2.0-0:i386 (--configure):
 libglib2.0-0:i386 2.31.14-0ubuntu1 cannot be configured because libglib2.0-0:amd64 is in a different version (2.31.14-0ubuntu1~build1)
dpkg: dependency problems prevent configuration of libgtk-3-0:
 libgtk-3-0 depends on libglib2.0-0 (>= 2.31.14); however:
  Package libglib2.0-0 is not configured yet.
dpkg: error processing libgtk-3-0 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgail-3-0:
 libgail-3-0 depends on libglib2.0-0 (>= 2.31.14); however:
  Package libNo 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
                                              No apport report written because MaxReports is reached already
                                                                                                            No apport report written because MaxReports is reached already
                                   No apport report written because MaxReports is reached already
                                                                                                 No apport report written because MaxReports is reached already
                        glib2.0-0 is not configured yet.
 libgail-3-0 depends on libgtk-3-0 (= 3.3.12-0ubuntu1~build1); however:
  Package libgtk-3-0 is not configured yet.
dpkg: error processing libgail-3-0 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gir1.2-gtk-3.0:
 gir1.2-gtk-3.0 depends on libgtk-3-0 (>= 3.3.12); however:
  Package libgtk-3-0 is not configured yet.
dpkg: error processing gir1.2-gtk-3.0 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgtk-3-bin:
 libgtk-3-bin depends on libgtk-3-0 (>= 3.3.12-0ubuntu1~build1); however:
  Package libgtk-3-0 is not configured yet.
dpkg: error processing libgtk-3-bin (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgtk-3-dev:
 libgtk-3-dev depends on libgtk-3-0 (= 3.3.12-0ubuntu1~build1); however:
  Package libgtk-3-0 is not configured yet.
 libgtk-3-dev depends on gir1.2-gtk-3.0 (= 3.3.12-0ubuntu1~build1); however:
  Package gir1.2-gtk-3.0 is not configured yet.
 libgtk-3-dev depends on libglib2.0-dev (>= 2.31.14); however:
  Package libglib2.0-dev is not configured yet.
dpkg: error processing libgtk-3-dev (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libglib2.0-0
 libglib2.0-bin
 libglib2.0-dev
 libglib2.0-0:i386
 libgtk-3-0
 libgail-3-0
 gir1.2-gtk-3.0
 libgtk-3-bin
 libgtk-3-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

sudo dpkg --configure -a然后跑步sudo apt-get -f install就可以了

答案2

这对我有用:

  1. 打开突触
  2. 它可能会说“There are broken packages on your system.如果是,请转到Edit -> Mark broken packages并点击应用”。
  3. 关闭 Synaptic 并执行此操作sudo apt-get update && sudo apt-get upgrade,一切可能都会恢复正常。

答案3

sudo dpkg --configure --pending应该清理未完全安装的软件包。安装后,或者如果失败,请尝试sudo apt-get purge <packages>

相关内容