On a computer running "stable" Debian, when trying to install a package which is in the unstable list on the Debian web site using the aptitude install <package>/unstable command, I get output similar to this:

Couldn't find any package whose name or description matched "<package>"
Couldn't find any package whose name or description matched "<package>"
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

What can I do to be able to install "unstable" packages? (I thought of adding the repository to sources.list, but I don't want everything to start being installed from "unstable").

So: how can I install unstable packages (with using /stable at the end of the package name)?

up vote 23 down vote accepted

You do need to have unstable listed in your sources.list. Otherwise apt just won't find the package.

To avoid unstable packages being pulled in, you have two ways.

  • The easy way is to add a Default-Release clause to /etc/apt/apt.conf (or to a file under /etc/apt/apt.conf.d/, e.g. /etc/apt/apt.conf.d/my-default-release).

    APT::Default-Release "stable";
    
  • The hard way is to use APT preferences. In /etc/apt/preferences:

    Package: *
    Pin: release o=Debian,a=unstable
    Pin-Priority: 10
    

Note that for most of the lifetime of a Debian release, it's not practical to install most packages from unstable on a stable system, because they'll pull in a lot of libraries from unstable, and you'll end up with an unstable system. If you want to run unstable, it'll save you trouble to just target unstable (or testing). It's best to stick to a single release, or testing with the occasional unstable if you're feeling daring. And of course, on a production system, stick to stable.

If you're running stable but you need a newer version of one application, first look if there is a backport for them. Otherwise, if you want to install a package from unstable but not have to pull in its dependencies, try getting the source from unstable and recompiling.

apt-get source foo=1.42
apt-get build-dep foo  # pulls the dependencies of foo in stable but that's often good enough
dpkg-source -x foo_1.42.dsc
cd foo-1.4210126#10126
dpkg-buildpackage -rfakeroot -us -uc -b -nc
dpkg -i ../foo_1.42_$(arch).deb
  • +1 for mentioning backports, but you really should point out more emphatically that mixing stable/unstable is really bloody dangerous and if you don't know what you're doing you should not do this on a production system. – Shadur Aug 8 '17 at 11:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.