在没有 APT Pin 的情况下阻止软件包更新?

Mei*_*Mei 14 apt

我知道用 Apt 固定包。那不是我想做的。其他问题已通过使用固定或暂时使用固定来回答。我不想这样做。

我想要做的是让软件包保持与内核相同的方式:

# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  linux-generic-pae linux-headers-generic-pae linux-image-generic-pae
The following packages will be upgraded:
Run Code Online (Sandbox Code Playgroud)

我想补充tomcat-*,并mysql-*sun-*到这个列表。过去,有一个配置参数可以做到这一点。我一直认为它是类似的东西Apt::Get::HoldPkgsApt::HoldPkgs但我找不到它。

我想保留这些软件包的更新,直到我用apt-get install.

我找到了apt-get配置Apt::NeverAutoRemove。这会做我想要的吗?

添加的问题:我注意到Apt::NeverAutoRemoveApt::Never-MarkAuto-Sections(除其他外)据我所知没有记录。它们不在联机帮助页中。也不是aptitude::Keep-Unused-Patternaptitude::Get-Root-Command

是否有任何全面和完整的文档apt.conf

Mei*_*Mei 15

答案是使用dpkg --set-selections. 如果您运行该命令,dpkg --get-selections您可以看到已经设置的内容:

$ dpkg --get-selections | head
acct                                            install
adduser                                         install
apparmor                                        install
apparmor-utils                                  install
apt                                             install
apt-transport-https                             install
apt-utils                                       install
aptitude                                        install
at                                              install
auditd                                          install
Run Code Online (Sandbox Code Playgroud)

在这种情况下,请考虑包dnsutils

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  bind9-host dnsutils libbind9-60 libdns64 libisc60 libisccc60 libisccfg60 liblwres60
8 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,257kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
Run Code Online (Sandbox Code Playgroud)

现在让我们改变它 - 暂停包裹:

$ echo dnsutils hold | sudo dpkg --set-selections
Run Code Online (Sandbox Code Playgroud)

检查结果:

$ dpkg --get-selections | grep dnsutils
dnsutils                                        hold
Run Code Online (Sandbox Code Playgroud)

再次尝试更新:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  bind9-host dnsutils libbind9-60 libdns64 libisc60 libisccfg60 liblwres60
The following packages will be upgraded:
  libisccc60
1 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Need to get 29.9kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
Run Code Online (Sandbox Code Playgroud)

现在,dnsutils正如我们所希望的那样,- 及其相关的软件包 - 正在被阻止。