10

I've been trying to understand the difference between these two commands and noticed that I get different results.

apt-get install -t testing appX
apt-get install appX/testing

Background

I setup my sources lists and pinning config as per https://serverfault.com/a/382101/132528

Current outcomes

root@home:/etc/apt# apt-cache policy i3
i3:
Installed: (none)
Candidate: 4.2-2
Version table:
   4.8-1 0
    750 http://debian.mirror.ac.za/debian/ testing/main amd64 Packages
    750 http://ftp.us.debian.org/debian/ testing/main amd64 Packages
    50 http://debian.mirror.ac.za/debian/ unstable/main amd64 Packages
    50 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
   4.8-1~bpo70+1 0
    100 http://debian.mirror.ac.za/debian/ wheezy-backports/main amd64 Packages
   4.2-2 0
    995 http://debian.mirror.ac.za/debian/ wheezy/main amd64 Packages
    995 http://debian.mirror.ac.za/debian/ stable/main amd64 Packages
    995 http://ftp.us.debian.org/debian/ stable/main amd64 Packages

It chooses 4.2-2, when doing

apt-get install -t testing appX

And chooses 4.8 when doing

apt-get install appX/testing

Debian handbook:

-t targetRelease

To tell apt-get to use a specific distribution when searching for upgraded packages, you need to use the -t or --target-release option, followed by the name of the distribution you want (for example: apt-get -t stable upgrade).

pkg/distribution

If the file sources.list mentions several distributions, it is possible to give the version of the package to install. A specific version number can be requested with apt-get install package=version, but indicating its distribution of origin (Stable, Testing or Unstable) — with apt-get install package/distribution — is usually preferred.

Question

In both cases you specify the distribution you want, but the behaviour at hand is not consistent between the two cases?

eugenevd
  • 419
  • 5
  • 12

1 Answers1

13

I was having the same problem, but I figured it out!!!

(I originally wanted to comment this on the original answer because other people seem to be having this problem too, but I didn't have enough magic "reputation" points at the time for my opinion to be valuable, so here goes.)

It's a quirk of the values he chose for apt-pinning. When you run apt-get install my_package, apt chooses which source to install that package from based on whichever has the highest pinning priority.

Your overall system setting (Default Release) has a priority of 990.

Adding -t unstable to the apt-get command temporarily makes "unstable" the Default Release for that command.

He set up his Pinning Priority for "stable" to be 995. That means that no matter what, packages will always be installed from stable since its priority is even higher than the Default Release priority.

So the fix? Easy - just change the pin priority in /etc/apt/preferences.d/security.pref from 995 to 900.

Alex Ryan
  • 231
  • 1
  • 2
  • 5