apt-get 无法安装特定旧版本的 python-nova

apt-get 无法安装特定旧版本的 python-nova

有一个类似的问题,apt-get 无法安装 apt-cache 策略中列出的特定版本。但我的情况不是这样。

我想安装特定的旧版本的 python-nova(1:2013.2.3-0ubuntu1~cloud0),但是失败了,这是我所做的:

root@ip-10-20-17:~# apt-cache policy python-nova
python-nova:
  Installed: (none)
  Candidate: 1:2014.1.3-0ubuntu1~cloud0.1
  Version table:
     1:2014.1.3-0ubuntu1~cloud0.1 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud0-5 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud0-4 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud0-2 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud0~-1 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud063 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud062 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud061 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2014.1.2-0ubuntu1.1~cloud0~3 0
        900 http://apt.myserver.com/game-cloud-ops/ precise/main amd64 Packages
     1:2013.2.3-0ubuntu1~cloud0 0
        -10 http://apt.myserver.com/ubuntu-cloud-archive/ precise-updates/havana/main amd64 Packages
     2012.1.3+stable-20130423-e52e6912-0ubuntu1.4 0
        900 http://mirror.myserver.com/ubuntu/ precise-security/main amd64 Packages
        900 http://mirror.myserver.com/ubuntu/ precise-updates/main amd64 Packages
     2012.1-0ubuntu2 0
        900 http://mirror..myserver.com/ubuntu/ precise/main amd64 Packages


root@ip-10-20-17:~# apt-get -o Debug::pkgProblemResolver=yes  install python-nova=1:2013.2.3-0ubuntu1~cloud0
Reading package lists... Done
Building dependency tree... 0%
Building dependency tree       
Reading state information... Done
Starting
Starting 2
Investigating (0) python-nova [ amd64 ] < none -> 1:2014.1.3-0ubuntu1~cloud0.1 > ( python )
Broken python-nova:amd64 Depends on python-anyjson [ amd64 ] < none -> 0.3.3-1~cloud0 > ( python ) (>= 0.3.3)
.....
.....
.....
The following packages have unmet dependencies:
 python-nova : Depends: python-anyjson (>= 0.3.3) but 0.3.1-1build1 is to be installed
               Depends: python-boto (>= 2.4.0) but 2.2.2-0ubuntu3 is to be installed
               Depends: python-cinderclient (>= 1:1.0.5) but it is not installable
               Depends: python-eventlet (>= 0.13.0) but 0.9.16-1ubuntu4.2 is to be installed
               Depends: python-greenlet (>= 0.3.2) but 0.3.1-1ubuntu5.1 is to be installed
               Depends: python-glanceclient (>= 1:0.9.0) but it is not installable
               Depends: python-keystoneclient (>= 1:0.3.2) but 2012.1-0ubuntu1 is to be installed
               Depends: python-neutronclient (>= 1:2.3.0) but it is not installable
               Depends: python-jsonschema (>= 1.3.0) but it is not installable
               Depends: python-kombu (>= 2.5.12) but 1.4.3-1 is to be installed
               Depends: python-netaddr (>= 0.7.6) but 0.7.5-4build2 is to be installed
               Depends: python-oslo.config (>= 1:1.2.0) but it is not installable
               Depends: python-paramiko (>= 1.8.0) but 1.7.7.1-2ubuntu1 is to be installed
               Depends: python-sqlalchemy-ext (>= 0.7.8-1~) but 0.7.4-1ubuntu0.1 is to be installed or
                        python-sqlalchemy (< 0.6.3-2) but 0.7.4-1ubuntu0.1 is to be installed
               Depends: python-stevedore (>= 0.10) but it is not installable
               Depends: python-webob (>= 1.2.3) but 1.1.1-1ubuntu0 is to be installed
               Depends: python-pbr but it is not installable
               Depends: python-sqlalchemy (>= 0.8~) but 0.7.4-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.

很抱歉。我忘了发布一些重要信息。依赖包在那里,但 apt-cache 策略不喜欢它们,例如:

root@ip-10-20-17:~# apt-cache policy python-anyjson
python-anyjson:
  Installed: (none)
  Candidate: 0.3.1-1build1
  Version table:
     0.3.3-1~cloud0 0
        -10 http://apt.myserver.com/ubuntu-cloud-archive/ precise-updates/havana/main amd64 Packages
     0.3.1-1build1 0
        900 http://mirror.myserver.com/ubuntu/ precise/main amd64 Packages

python-anyjson 0.3.3-1~cloud0 有,但是 apt-cache 策略不推荐它。优先级 -10 是什么意思?

答案1

软件包可以依赖于其他软件包。在你的情况下,python-nova依赖于python-anyjsonpython-boto等等python-cinderclient。因此,要安装python-nova,还需要安装这些软件包。

此依赖项也是特定于版本的。要安装python-nova特定版本,您还需要安装特定版本的依赖包。例如,对于python-nova版本1:2013.2.3-0ubuntu1~cloud0你需要的python-anyjson版本0.3.3 或更高版本,但仅限版本0.3.1-1build1可用:

python-nova : Depends: python-anyjson (>= 0.3.3) but 0.3.1-1build1 is to be installed

因此,您不仅需要检查python-nova其自身是否在您需要的版本中可用,还需要检查所有python-nova依赖的软件包是否在相应的版本中可用。依赖的软件包python-nova也可能有其他依赖项。

因此,我建议重新检查您是否真的需要该特定版本。满足软件包 A 的所有依赖项,然后满足 A 依赖项的所有依赖项,然后……可能会很麻烦。您还可以考虑使用另一个发行版或较旧的 Ubuntu 版本,其中python-nova您需要的版本是默认版本,您不需要自己处理所有依赖项。当然,这在很大程度上取决于您打算做什么的细节。

答案2

最后,我从提示中明白了如何禁止安装特定的包?

To block the installation of a given package we may put the following lines in /etc/apt/preferences

Package: 
Pin: origin ""
Pin-Priority: -1

我的服务器上有这样的配置,rm 之后就可以正常工作了

root@ip-10-20-17:~# cat /etc/apt/preferences.d/00fix_codename 
Explanation: Uninstall or do not install any other DISTRIB_CODENAME
Explanation: package versions other than those in the precise distro
Package: *
Pin: release n=precise
Pin-Priority: 900

Package: *
Pin: release n=*
Pin-Priority: -10

感谢所有关注此问题的人,特别是 Henning Kockerbeck。

相关内容