0

There is a similar question, apt-get cannot install specific version listed in apt-cache policy. But that is not my case.

I want to install a specific older version of python-nova (1:2013.2.3-0ubuntu1~cloud0), but failed, this is what I done:

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.

I am sorry. I miss posting some important info. The dependencies packages are there, but apt-cache policy doesn't prefers they , for example:

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 is there , but apt-cache policy doesn't prefers it. What does the priority -10 mean?

sosogh
  • 1

2 Answers2

4

Packages can have dependencies on other packages. In your case, python-nova depends on python-anyjson, python-boto, python-cinderclient and so on. So, to install python-nova, those packages need to be installed as well.

This dependency is also version-specific. To install python-nova of a specific version, you need to install the depending packages of specific versions, too. For example, for python-nova in version 1:2013.2.3-0ubuntu1~cloud0 you'd need python-anyjson in version 0.3.3 or later, but only version 0.3.1-1build1 is available:

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

So, you not only need to check whether python-nova itself is available in the version you need, but also whether all the packages python-nova depends on are available in the respective versions, as well. Those packages that python-nova depends on can have other dependencies as well.

Because of that, I'd suggest to recheck whether you really need that specific version. It can become a hassle to satisfy all dependencies of package A, then all dependencies of the depencies of A, then ... You could also look into using another distribution or an older Ubuntu release, where the version of python-nova you need is the default and you don't need to handle all the dependencies yourself. That, of course, highly depends on the details of what you intend to do.

0

Finally , I figure out it from the hint of How to forbid a specific package to be installed?

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

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

There is such a config on my server, after rm it , it works

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

Thank you for all who concern with this issuse, especially Henning Kockerbeck.

sosogh
  • 1