aptitude 安装错误

aptitude 安装错误

我正在运行apt-get install aptitude但它给出了这个错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 aptitude : Depends: libcwidget3 but it is not going to be installed
            Depends: libstdc++6 (>= 4.9) but 4.8.4-2ubuntu1~14.04 is to be installed
            Depends: libxapian22 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

怎么了 ?

以下是一些附加信息:

$ uname -a
Linux ubuntu 3.19.0-47-generic #53~14.04.1-Ubuntu SMP Mon Jan 18 16:09:14 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -r
Release:    15.04

$ apt-cache policy aptitude libcwidget3 libstdc++6 libxapian22
 aptitude:
  Installed: (none)
  Candidate: 0.6.11-1ubuntu3
  Version table:
     0.6.11-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
     0.6.8.2-1ubuntu4 0
        100 /var/lib/dpkg/status
libcwidget3:
  Installed: (none)
  Candidate: 0.5.17-2ubuntu1
  Version table:
     0.5.17-2ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
     0.5.16-3.5ubuntu1 0
        100 /var/lib/dpkg/status
libstdc++6:
  Installed: 4.8.4-2ubuntu1~14.04
  Candidate: 4.9.2-10ubuntu13
  Version table:
     4.9.2-10ubuntu13 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
 *** 4.8.4-2ubuntu1~14.04 0
        100 /var/lib/dpkg/status
libxapian22:
  Installed: (none)
  Candidate: 1.2.19-1
  Version table:
     1.2.19-1 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
     1.2.16-2ubuntu1 0
        100 /var/lib/dpkg/status

更新

$ sudo apt-get install libstdc++6=4.9.2-10ubuntu13 :
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libstdc++6
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.

$ apt-cache policy libstdc++6
libstdc++6:
  Installed: 4.8.4-2ubuntu1~14.04
  Candidate: 4.9.2-10ubuntu13
  Version table:
     4.9.2-10ubuntu13 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
 *** 4.8.4-2ubuntu1~14.04 0
        100 /var/lib/dpkg/status

$ sudo dpkg -i libstdc++6_4.9.2-10ubuntu13_amd64.deb
(Reading database ... 103371 files and directories currently installed.)
Preparing to unpack libstdc++6_4.9.2-10ubuntu13_amd64.deb ...
Unpacking libstdc++6:amd64 (4.9.2-10ubuntu13) over (4.9.2-10ubuntu13) ...
dpkg: dependency problems prevent configuration of libstdc++6:amd64:
 libstdc++6:amd64 depends on gcc-4.9-base (= 4.9.2-10ubuntu13); however:
  Version of gcc-4.9-base:amd64 on system is 4.9.3-0ubuntu4.

dpkg: error processing package libstdc++6:amd64 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libstdc++6:amd64

$ sudo apt-get install gcc-4.9-base=4.9.2-10ubuntu13
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.9-base : Breaks: gcc-4.9-base:i386 (!= 4.9.2-10ubuntu13) but 4.9.3-0ubuntu4 is to be installed
 gcc-4.9-base:i386 : Breaks: gcc-4.9-base (!= 4.9.3-0ubuntu4) but 4.9.2-10ubuntu13 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

$ apt-cache policy gcc-4.9-base
gcc-4.9-base:
  Installed: 4.9.3-0ubuntu4
  Candidate: 4.9.3-0ubuntu4
  Version table:
 *** 4.9.3-0ubuntu4 0
        100 /var/lib/dpkg/status
     4.9.2-10ubuntu13 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages

   $ sudo apt-get install gcc-4.9=4.9.2-10ubuntu13 gcc-4.9-base=4.9.2-10ubuntu13 gcc-4.9:i386=4.9.2-10ubuntu13 gcc-4.9-base:i386=4.9.2-10ubuntu13
    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.9 : Depends: cpp-4.9 (= 4.9.2-10ubuntu13) but it is not going to be installed
               Depends: libgcc-4.9-dev (= 4.9.2-10ubuntu13) but it is not going to be installed
               Conflicts: gcc-4.9:i386 but 4.9.2-10ubuntu13 is to be installed
     gcc-4.9:i386 : Depends: cpp-4.9:i386 (= 4.9.2-10ubuntu13) but it is not going to be installed
                    Depends: binutils:i386 (>= 2.25) but it is not going to be installed
                    Depends: libgcc-4.9-dev:i386 (= 4.9.2-10ubuntu13) but it is not going to be installed
                    Depends: libcloog-isl4:i386 (>= 0.17) but it is not going to be installed
                    Depends: libgmp10:i386 (>= 2:5.0.1~) but it is not going to be installed
                    Depends: libisl13:i386 (>= 0.10) but it is not going to be installed
                    Depends: libmpc3:i386 but it is not going to be installed
                    Depends: libmpfr4:i386 (>= 3.1.2) but it is not going to be installed
                    Recommends: libc6-dev:i386 (>= 2.13-0ubuntu6) but it is not going to be installed
                    Conflicts: gcc-4.9 but 4.9.2-10ubuntu13 is to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

答案1

主要问题是:

Depends: libstdc++6 (>= 4.9) but 4.8.4-2ubuntu1~14.04 is to be installed

所需版本的安装失败

$ apt-get download libstdc++6
$ sudo dpkg -i libstdc++6_4.9.2-10ubuntu13_amd64.deb
...
dpkg: dependency problems prevent configuration of libstdc++6:amd64:
 libstdc++6:amd64 depends on gcc-4.9-base (= 4.9.2-10ubuntu13); however:
  Version of gcc-4.9-base:amd64 on system is 4.9.3-0ubuntu4.

输出apt-cache policy gcc-4.9-base告诉我,您已gcc-4.9-base使用 DEB 文件或存储库进行安装,但该系统中不再存在该文件或存储库。原因如下:

  1. 降级您的gcc-4.9安装,并且由于您已经安装了 32 位软件包,因此 32 位软件包也同样如此。

    下面的命令没有帮助,因此我们必须选择困难的方法,参见第 2 点。

    sudo apt-get install gcc-4.9=4.9.2-10ubuntu13 gcc-4.9-base=4.9.2-10ubuntu13 gcc-4.9:i386=4.9.2-10ubuntu13 gcc-4.9-base:i386=4.9.2-10ubuntu13
    
  2. 艰难之路

    mkdir ~/debs$$
    cd ~/debs$$
    wget http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-4.9/gcc-4.9-base_4.9.2-10ubuntu13_amd64.deb
    wget http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-4.9/gcc-4.9-base_4.9.2-10ubuntu13_i386.deb
    wget http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-4.9/gcc-4.9_4.9.2-10ubuntu13_amd64.deb
    wget http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-4.9/gcc-4.9_4.9.2-10ubuntu13_i386.deb
    sudo dpkg -i --force-all *.deb
    sudo apt-get install -f
    
  3. 安装aptitude

    sudo apt-get install aptitude
    

相关内容