由于 Ubuntu precise 上的多架构问题,无法安装 libc6

由于 Ubuntu precise 上的多架构问题,无法安装 libc6

由于我dpkg-query -L libc6无法在我的计算机上工作,因此无法安装任何软件包。

# apt-cache policy libc6
libc6:
  Installed: 2.15-0ubuntu10.15
  Candidate: 2.15-0ubuntu10.17
  Version table:
     2.15-0ubuntu10.17 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
 *** 2.15-0ubuntu10.15 0
        100 /var/lib/dpkg/status
     2.15-0ubuntu10 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

# apt-cache policy libc6
libc6:
  Installed: 2.15-0ubuntu10.15
  Candidate: 2.15-0ubuntu10.17
  Version table:
     2.15-0ubuntu10.17 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
 *** 2.15-0ubuntu10.15 0
        100 /var/lib/dpkg/status
     2.15-0ubuntu10 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libc6 libc6-dbg libc6-dev libc6-dev-i386 libc6-i386
Suggested packages:
  glibc-doc
The following packages will be upgraded:
  libc6 libc6-dbg libc6-dev libc6-dev-i386 libc6-i386
5 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
4 not fully installed or removed.
Need to get 0 B/16.0 MB of archives.
After this operation, 13.3 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Preconfiguring packages ...
(Reading database ... 792434 files and directories currently installed.)
Preparing to replace libc6:amd64 2.15-0ubuntu10.15 (using .../libc6_2.15-0ubuntu10.17_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/libc6_2.15-0ubuntu10.17_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.15-0ubuntu10.17_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

现在,为了深入研究该问题,我从 /var/cache/apt/archives/libc6_2.15-0ubuntu10.17_amd64.deb 中提取了 preinst 脚本,并使用 ./preinst upgrade 2.15-0ubuntu10.15 运行它,结果显示存在问题

# dpkg-query -L libc6
dpkg-query: error: --listfiles needs a valid package name but 'libc6' is not: ambiguous package name 'libc6' with more than one installed instance

Use --help for help about querying packages.

显示已安装的软件包:

# dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-===============================================================================================================
ii  libc6:amd64                                           2.15-0ubuntu10.15               amd64                           Embedded GNU C Library: Shared libraries
rc  libc6:i386                                            2.15-0ubuntu10.15               i386                            Embedded GNU C Library: Shared libraries

尝试使用以下命令删除所有 i386 软件包:

aptitude purge `dpkg --get-selections | grep ":i386" | awk '{print $1}'`

不幸的是,问题仍然存在,dpkg -l libc6仍然显示 i386 架构。

现在我陷入困境。有什么想法吗?

答案1

通过以下步骤以某种方式修复了此问题:

aptitude download libc6

mkdir tmp
dpkg-deb -R libc6_2.15-0ubuntu10.17_amd64.deb tmp
# edit DEBIAN/preinst replaced 'dpkg-query -L libc6' with 'dpkg-query -L libc6:amd64'
dpkg-deb -b tmp libc6_2.15-0ubuntu10.17fixed_amd64.deb

dpkg -i libc6_2.15-0ubuntu10.17fixed_amd64.deb

现在我能够解决冲突了。要摆脱我现在使用的所有 i386 软件包,请执行以下操作:

dpkg -l | grep :i386 | awk '{ print $2 }' | xargs dpkg -P

现在看来我已经摆脱了 i386 包:

dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-===============================================================================================================
ii  libc6:amd64                                           2.15-0ubuntu10.17               amd64                           Embedded GNU C Library: Shared libraries

相关内容