尝试在 14.04 LTS 上安装 libx32z1-dev:i386 后,APT 在每个命令后都报告依赖性问题

尝试在 14.04 LTS 上安装 libx32z1-dev:i386 后,APT 在每个命令后都报告依赖性问题

[现已解决]

我有一台搭载 14.04 LTS x64 的机器。

有人试图安装错误的软件包libx32z1-dev:i386,这似乎搞砸了一些事情。它出于某种原因删除了许多重要的软件包(记录如下),现在当我运行任何apt-get install/remove命令时,我都会得到如下信息:

$ sudo apt-get install gcc-4.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 gcc-4.6 : Depends: binutils (>= 2.24) but it is not going to be installed
 libc6-dev-x32:i386 : Depends: libc6-dev-amd64:i386 (= 2.19-0ubuntu6.14) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

gcc-4.6在安装过程中被删除)

我发现了几个类似的问题(例如如何从 apt-get 问题中恢复),但解决方案不起作用:

$ sudo apt-get remove libc6-amd64:i386 libc6-dev-amd64:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libc6-amd64:i386' is not installed, so not removed
Package 'libc6-dev-amd64:i386' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libc6-dev-x32:i386 : Depends: libc6-dev-amd64:i386 (= 2.19-0ubuntu6.14) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

直接使用dpkg没有帮助:

sudo dpkg --purge libc6-dev-amd64:i386
dpkg: warning: ignoring request to remove libc6-dev-amd64 which isn't installed
 sudo dpkg --purge libc6-amd64:i386 
(Reading database ... 567282 files and directories currently installed.)
Removing libc6-amd64 (2.19-0ubuntu6.14) ...
Purging configuration files for libc6-amd64 (2.19-0ubuntu6.14) ...
Processing triggers for libc-bin (2.19-0ubuntu6.14) ...

如果我按照 APT 的建议去做,那么:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  at augeas-lenses binutils:i386 bridge-utils cpp-4.6 cpu-checker cryptsetup
  debugedit dh-apparmor ebtables fakeroot gcc-4.6-base ipxe-qemu jfsutils
  ldmtool ledit lib32asan0 lib32atomic1 lib32gcc1 lib32gomp1 lib32itm1
  lib32quadmath0 lib32stdc++6 lib64asan0:i386 lib64atomic1:i386
  lib64gcc-4.8-dev:i386 lib64gcc1:i386 lib64gomp1:i386 lib64itm1:i386
  lib64quadmath0:i386 libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libasan0:i386 libatomic1:i386 libaugeas0
  libclang-common-3.5-dev libclang1-3.5 libcloog-isl4:i386 libconfig9
  libdevmapper-event1.02.1 libfakeroot libfontconfig1-dev libfreetype6-dev
  libgcc-4.8-dev:i386 libgd-gd2-perl libgfortran-4.8-dev libgmp10:i386
  libgomp1:i386 libhivex0 libice-dev libisl10:i386 libitm1:i386 libldm-1.0-0
  libllvm3.5 libltdl-dev libmail-sendmail-perl libmpc3:i386 libmpfr4:i386
  libnetcf1 libnetpbm10 libquadmath0:i386 librpmbuild3 librpmsign1 libsm-dev
  libstring-shellquote-perl libsys-hostname-long-perl libsys-virt-perl
  libvirt-bin libvirt0 libwin-hivex-perl libx32asan0:i386 libx32atomic1:i386
  libx32gcc-4.8-dev:i386 libx32gcc1:i386 libx32gomp1:i386 libx32itm1:i386
  libx32quadmath0:i386 libxft-dev libxml-xpath-perl libxrender-dev libxss-dev
  libxt-dev linux-image-4.4.0-38-generic linux-image-extra-4.4.0-38-generic
  llvm-3.5 llvm-3.5-dev llvm-3.5-runtime llvm-3.6 llvm-3.6-dev
  llvm-3.6-runtime lsb-security lvm2 msr-tools netpbm ocaml-base-nox pax
  po-debconf qemu-system-x86 rpm scrub seabios supermin watershed
  x11proto-render-dev x11proto-scrnsaver-dev zerofree zfs-fuse
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libc6-amd64:i386 libc6-dev-amd64:i386
Recommended packages:
  gcc-multilib:i386
The following NEW packages will be installed:
  libc6-amd64:i386 libc6-dev-amd64:i386
0 upgraded, 2 newly installed, 0 to remove and 27 not upgraded.
8 not fully installed or removed.
Need to get 0 B/3,872 kB of archives.
After this operation, 20.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Selecting previously unselected package libc6-amd64.
(Reading database ... 566979 files and directories currently installed.)
Preparing to unpack .../libc6-amd64_2.19-0ubuntu6.14_i386.deb ...
Unpacking libc6-amd64 (2.19-0ubuntu6.14) ...
Replaced by files in installed package libc6:amd64 (2.19-0ubuntu6.14) ...
Selecting previously unselected package libc6-dev-amd64.
Preparing to unpack .../libc6-dev-amd64_2.19-0ubuntu6.14_i386.deb ...
Unpacking libc6-dev-amd64 (2.19-0ubuntu6.14) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-amd64_2.19-0ubuntu6.14_i386.deb (--unpack):
 trying to overwrite '/usr/include/fpu_control.h', which is also in package libc6-dev-i386 2.19-0ubuntu6.14
Errors were encountered while processing:
 /var/cache/apt/archives/libc6-dev-amd64_2.19-0ubuntu6.14_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

除了自动删除的一大堆内容之外,最初的安装尝试还包括以下步骤:

The following extra packages will be installed:
  libc6-amd64:i386 libc6-dev:i386 libc6-dev-amd64:i386 libc6-dev-x32:i386
  libc6-x32:i386 libx32z1:i386 linux-libc-dev linux-libc-dev:i386
  zlib1g-dev:i386
Suggested packages:
  glibc-doc:i386 manpages-dev:i386
Recommended packages:
  gcc:i386 c-compiler:i386 gcc-multilib:i386
The following packages will be REMOVED:
  alien binutils build-essential camlp4 clang-3.5 clang-3.6 debhelper dkms
  dpkg-dev g++ g++-4.8 g++-4.8-multilib g++-multilib gcc gcc-4.6
  gcc-4.6-multilib gcc-4.8 gcc-4.8-multilib gcc-multilib gfortran gfortran-4.8
  hardening-includes lcov lib32gcc-4.8-dev lib32stdc++-4.8-dev libc6-dev-x32
  libc6-x32 libguestfs-dev libguestfs-perl libguestfs-tools libguestfs0
  libtool libx32asan0 libx32atomic1 libx32gcc-4.8-dev libx32gcc1 libx32gomp1
  libx32itm1 libx32quadmath0 libx32stdc++-4.8-dev libx32stdc++6 libx32z1
  libx32z1-dev lintian lsb-core network-manager-pptp
  network-manager-pptp-gnome ocaml-compiler-libs ocaml-interp ocaml-nox
  pptp-linux python-guestfs tcl-dev tcl8.6-dev tk-dev tk8.6-dev
The following NEW packages will be installed:
  libc6-amd64:i386 libc6-dev:i386 libc6-dev-amd64:i386 libc6-dev-x32:i386
  libc6-x32:i386 libx32z1:i386 libx32z1-dev:i386 linux-libc-dev:i386
  zlib1g-dev:i386
The following packages will be upgraded:
  linux-libc-dev

这个问题,dpkg 错误:“尝试覆盖文件,该文件也在……”,有一个答案说要删除冲突的软件包。模式匹配 apt 输出,它看起来像是libc6-dev-i386libc6-dev-amd64

但我似乎无法删除它:

$ sudo apt-get remove libc6-dev-i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 lib32ncurses5-dev : Depends: lib32c-dev
 lib32tinfo-dev : Depends: lib32c-dev
 lib32z1-dev : Depends: lib32c-dev
 libc6-dev-x32:i386 : Depends: libc6-dev-amd64:i386 (= 2.19-0ubuntu6.14) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

$ sudo dpkg --purge libc6-dev-i386                                                                 
dpkg: dependency problems prevent removal of libc6-dev-i386:
 lib32ncurses5-dev depends on lib32c-dev; however:
  Package lib32c-dev is not installed.
  Package libc6-dev-i386 which provides lib32c-dev is to be removed.
 lib32z1-dev depends on lib32c-dev; however:
  Package lib32c-dev is not installed.
  Package libc6-dev-i386 which provides lib32c-dev is to be removed.
 lib32tinfo-dev depends on lib32c-dev; however:
  Package lib32c-dev is not installed.
  Package libc6-dev-i386 which provides lib32c-dev is to be removed.
dpkg: error processing package libc6-dev-i386 (--purge):
 dependency problems - not removing
Errors were encountered while processing:
 libc6-dev-i386

$ sudo apt-get remove libc6-dev-amd64                                                              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libc6-dev-amd64:i386' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libc6-dev-x32:i386 : Depends: libc6-dev-amd64:i386 (= 2.19-0ubuntu6.14) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

$ sudo dpkg --purge libc6-dev-amd64
dpkg: warning: ignoring request to remove libc6-dev-amd64 which isn't installed

或者我也做错了什么,不知道如何应用该解决方案。

答案1

这个重复的问题当我弄清楚自己在做什么之后,就提供了大部分答案。

冲突的软件包是libc6-dev-i386libc6-dev-amd64。我尝试使用 删除前者dpkg --purge libc6-dev-i386,它给出了依赖于它的另外三个软件包的列表,如上面的消息所示。

但删除这些:

dpkg --purge lib32ncurses5-dev
dpkg --purge lib32tinfo-dev
dpkg --purge lib32z1-dev

(也许按照另一种顺序,再次由它们的依赖关系指导)然后让我清除冲突的包。

然后,只需获取与原始版本一起删除的软件包列表apt-get install,然后通过 重新安装它们即可apt。一切似乎现已恢复正常并开始工作。

相关内容