为什么 apt-get 忽略目标参数?

为什么 apt-get 忽略目标参数?

我的 Debian 系统设置为默认安装不稳定的软件包

$ cat /etc/apt/apt.conf.d/99defaultrelease 
APT::Default-Release "unstable";

但是,我想automakestable,即版本 1.15 中提取

$ apt-cache policy automake
automake:
  Installed: (none)
  Candidate: 1:1.16.1-4
  Version table:
     1:1.16.1-4 990
        500 http://deb.debian.org/debian testing/main amd64 Packages
        500 http://deb.debian.org/debian testing/main i386 Packages
        990 http://deb.debian.org/debian unstable/main amd64 Packages
        990 http://deb.debian.org/debian unstable/main i386 Packages
        990 http://deb.debian.org/debian sid/main amd64 Packages
        990 http://deb.debian.org/debian sid/main i386 Packages
     1:1.15-6 500
        500 http://deb.debian.org/debian stable/main amd64 Packages
        500 http://deb.debian.org/debian stable/main i386 Packages

但每当我告诉它 installautomake/stableautomakewith 时-t stableapt就会忽略该部分。

$ apt-get install automake -t stable --dry-run
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  autoconf autotools-dev
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc libtool
The following NEW packages will be installed:
  autoconf automake autotools-dev
0 upgraded, 3 newly installed, 0 to remove and 125 not upgraded.
Inst autoconf (2.69-11 Debian:testing, Debian:unstable [all])
Inst autotools-dev (20180224.1 Debian:testing, Debian:unstable [all])
Inst automake (1:1.16.1-4 Debian:testing, Debian:unstable [all])
Conf autoconf (2.69-11 Debian:testing, Debian:unstable [all])
Conf autotools-dev (20180224.1 Debian:testing, Debian:unstable [all])
Conf automake (1:1.16.1-4 Debian:testing, Debian:unstable [all])

我可以这样指定包版本:

apt-get install automake=1:1.15-6

这应该可以解决我的问题,尽管依赖项(autoconf、autotools-dev 等)仍将从不稳定版本安装,这有点令人担忧。

无论如何,为什么在这种情况下 apt 会忽略给定的目标?

apt另外 - 这不是一个问题 - 如果这种行为是“设计使然”,我认为如果可以打印一些信息性通知,那就太好了。

编辑

这是输出apt -t stable policy automake(注意:已安装automake

$ apt -t stable policy automake
automake:
  Installed: 1:1.16.1-4
  Candidate: 1:1.16.1-4
  Version table:
 *** 1:1.16.1-4 1001
        500 http://deb.debian.org/debian testing/main amd64 Packages
        500 http://deb.debian.org/debian testing/main i386 Packages
       1001 http://deb.debian.org/debian unstable/main amd64 Packages
       1001 http://deb.debian.org/debian unstable/main i386 Packages
       1001 http://deb.debian.org/debian sid/main amd64 Packages
       1001 http://deb.debian.org/debian sid/main i386 Packages
        100 /var/lib/dpkg/status
     1:1.15-6 990
        990 http://deb.debian.org/debian stable/main amd64 Packages
        990 http://deb.debian.org/debian stable/main i386 Packages

由于这可能是一个优先级问题,因此这也可能是相关的:

$ cat /etc/apt/preferences
Package: *
Pin: release a=unstable
Pin-Priority: 1001

答案1

您看到的行为来自您定义的优先级。设置默认版本,使用Default-Release-t,将对应版本的优先级设置为990;你对不稳定的优先级 1001 总是比这个优先级高。

man apt_preferences了解详情。

相关内容