Debian – How to Install a Single Package from Testing or Unstable on Stable

aptdebian

I want to install a single package (and its dependencies, but only to the extent those are not satisfiable in Wheezy) from Debian Jessie onto my Wheezy system, without upgrading "everything and the kitchen sink" to the Jessie versions. Specifically, I'd like to install kpcli, which is available packaged in Jessie but not in Wheezy.

Everything I've found indicates that I should add the Jessie repositories to my sources list, set pinning to keep everything at wheezy and only take the single package from jessie, and it'll pretty much just fall into place. However, it isn't falling into place for me. If I create /etc/apt.d/sources.list.d/jessie.list with the following content:

deb ftp://ftp.debian.org/debian/ jessie main
deb-src ftp://ftp.debian.org/debian/ jessie main

and then create /etc/apt/preferences.d/jessie with:

Package: *
Pin: release a=wheezy
Pin-Priority: 1001

Package: kpcli
Pin: release a=jessie
Pin-Priority: 450

and run apt-get -u update followed by apt-get -u install kpcli/jessie, then I expect apt-get to pull in kpcli and maybe a small handful of other packages from Jessie, and leave the remainder of my installed system untouched. (My system is a fully up to date installation of Wheezy.) Alternatively, if I got the pin priority too low, I'd expect it to do nothing. Rather, on my system, apt-get wants to upgrade several hundred packages.

What, exactly, is needed to install just this one single package of a Jessie version while leaving the remainder of my Wheezy system untouched?

Note that in this particular case, the software is actually written in Perl so there's no compilation to binary or anything like that involved; however, there is a handful of Perl module dependencies. Hence, one possible alternative would be to install the .deb (downloaded manually) using something that only (1) allows specifying a single, local .deb archive that is to be installed, like dpkg -i, and (2) handles dependencies in an intelligent way, which plain dpkg -i doesn't. However, for all the searching I've done on several occasions and failed to come up with a simple-to-follow guide for how to do this, a generic solution (one that works for binary, compiled packages as well) would be great.

Best Answer

For each entry (stable, testing, unstable) you have pin-priority 500. You shouldn't use pin > 1000. I use 1001 only when I want to downgrade something. I have testing+sid+experimental entries specified in /etc/apt/sources.list and the following /etc/apt/preferences file:

Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 900

Package: *
Pin: release o=Debian,a=experimental
Pin-Priority: 130

The value 500 is default for unstable. So, let's try to check iceweasel:

# apt-cache policy iceweasel
iceweasel:
  Installed: (none)
  Candidate: 17.0.10esr-1~deb7u1
  Version table:
     26.0-1 0
        130 http://ftp.pl.debian.org/debian/ experimental/main amd64 Packages
     24.2.0esr-1 0
        500 http://ftp.pl.debian.org/debian/ sid/main amd64 Packages
     17.0.10esr-1~deb7u1 0
        900 http://ftp.pl.debian.org/debian/ testing/main amd64 Packages

So, if I tried to install iceweasel, it would be downloaded from the testing branch because it has the highest priority.

Try to change the priorities to:

Package: *
Pin: release a=wheezy
Pin-Priority: 900

Package: kpcli
Pin: release a=jessie
Pin-Priority: 910
Related Question