我想阻止来自 的所有包non-free,除了那些我明确命名的包。目前,我有:
/etc/apt/sources.list :
deb http://ftp.us.debian.org/debian stable main contrib non-free
Run Code Online (Sandbox Code Playgroud)
/etc/apt/preferences.d/non-free_policy :
Explanation: Disable packages from `non-free` tree by default
Package: *
Pin: release c=non-free
Pin-Priority: -1
Run Code Online (Sandbox Code Playgroud)
(这个想法是,我为我想要的每个非免费包添加一个明确的节。)
但它不起作用:
root@silber:/etc/apt/preferences.d# apt-get -s install firmware-linux-nonfree
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden NEUEN Pakete werden installiert:
firmware-linux-nonfree
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Inst firmware-linux-nonfree (0.43 Debian:8.4/stable [all])
Conf firmware-linux-nonfree (0.43 Debian:8.4/stable [all])
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
您需要确保没有其他更通用的 pin 优先级优先于您的 - non-freeexclude 规则。(这包括为APT::Default-Release给定版本分配高优先级的配置设置。)
例如,如果您的/etc/apt/preferences文件(或 中的另一个文件/etc/apt/preferences.d)包含如下内容:
Package: *
Pin: release a=unstable
Pin-Priority: 200
Run Code Online (Sandbox Code Playgroud)
那么unstable无论组件如何,封装的引脚优先级为 200。要使其与您的附加文件一起使用,您应该将其更改为
Package: *
Pin: release a=unstable, c=main
Pin-Priority: 200
Run Code Online (Sandbox Code Playgroud)
(contrib如果你关心的话,可以添加一个额外的节)。(在你的情况下,你当然会有stable。)
您可以通过运行来检查您的 pin 优先级的效果
apt-cache policy
Run Code Online (Sandbox Code Playgroud)
如果您的 - non-freeexclude 配置工作正常,您应该会看到您正在跟踪的所有套件的条目,在 上non-free,引脚优先级为 -1。一旦它起作用了,你会发现你不能再安装raccoon,或者实际上任何non-free包(即使明确提到)——你需要将non-free你想要的包添加到配置文件中,并具有适当的引脚优先级。
例如,这是我使用的设置:我有一个名为的文件,/etc/apt/preferences.d/non-free其中包含
Package: intel-microcode
Pin: release n=buster, c=non-free
Pin-Priority: 100
Explanation: Disable packages from non-free tree by default
Package: *
Pin: release c=non-free
Pin-Priority: -1
Run Code Online (Sandbox Code Playgroud)
非免费软件包仍会出现在搜索中,但我无法安装它们:
$ sudo apt install lmbench
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package lmbench is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'lmbench' has no installation candidate
Run Code Online (Sandbox Code Playgroud)
并apt policy同意:
$ apt policy lmbench
lmbench:
Installed: (none)
Candidate: (none)
Version table:
3.0-a9+debian.1-2 -1
-1 http://ftp.fr.debian.org/debian buster/non-free amd64 Packages
-1 http://ftp.fr.debian.org/debian testing/non-free amd64 Packages
-1 http://ftp.fr.debian.org/debian unstable/non-free amd64 Packages
Run Code Online (Sandbox Code Playgroud)
但intel-microcode可安装和升级。因此,在强制降级到 oldstable 版本后,我得到
$ apt policy intel-microcode
intel-microcode:
Installed: 3.20190618.1~deb9u1
Candidate: 3.20190618.1
Version table:
3.20190618.1 100
-1 http://ftp.fr.debian.org/debian buster/non-free amd64 Packages
-1 http://ftp.fr.debian.org/debian testing/non-free amd64 Packages
-1 http://ftp.fr.debian.org/debian unstable/non-free amd64 Packages
*** 3.20190618.1~deb9u1 100
100 /usr/var/lib/dpkg/status
$ apt list --upgradable
intel-microcode/stable,testing,unstable 3.20190618.1 amd64 [upgradable from: 3.20190618.1~deb9u1]
Run Code Online (Sandbox Code Playgroud)
在apt policy输出结束有些混乱-指的是“候选人”行,看到底发生了什么事情发生。
| 归档时间: |
|
| 查看次数: |
1014 次 |
| 最近记录: |