23

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)?

7
  • See unix.stackexchange.com/q/112157/4671 for an in-depth answer to this question. Commented Apr 11, 2014 at 1:39
  • 2
    Short version: Don't. Longer version: do not do this. Use backports if you have to, but don't mix stable/unstable. Commented Aug 8, 2017 at 11:08
  • 1
    I believe this is called a "FrankenDebian": "Debian Stable should not be combined with other releases. If you're trying to install software that isn't available in the current Debian Stable release, it's not a good idea to add repositories for other Debian releases. The problems might not happen right away, but the next time you install updates." From Don't Break Debian.
    – mas
    Commented May 8, 2019 at 13:18
  • 1
    @Shadur Answering "don`t" to a question is useless at best.
    – Silidrone
    Commented May 15, 2021 at 11:37
  • @silidrone It most emphatically is not, when the question in itself is a terrible idea. Commented May 15, 2021 at 19:21

1 Answer 1

41

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
3
  • 5
    +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. Commented Aug 8, 2017 at 11:10
  • 1
    Adding "Default-Release" thinky to a file under /etc/apt/apt.conf.d didn't work. I would go for adding files with pin priority in the /etc/apt/preferences.d folder. It's fine to mixing stable with testing if you know what you are doing. Stable with unstable is also possible (also assuming you know what you are doing). Commented Jun 11, 2022 at 22:44
  • 1
    Also during dpkg-source I get the error: gpgv: unknown type of key resource 'trustedkeys.kbx'. I already tryied to import the public keyring. Commented Jun 11, 2022 at 23:09

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .