Debian

為什麼 apt-get 忽略目標參數?

  • March 8, 2019

我的 Debian 系統設置為預設安裝不穩定的軟體包

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

但是,我想automakestable1.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 stable,都會apt忽略該部分。

$ 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 -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

您看到的行為來自您定義的優先級。設置預設發布,使用Default-Releaseor -t,對應版本設置優先級為 990;你對不穩定的 1001 的優先級總是超過它。

詳情請參閱man apt_preferences

引用自:https://unix.stackexchange.com/questions/505097