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


14

我知道有关使用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:

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

我想保留这些软件包的更新,直到我明确要求它们带有apt-get install

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

补充问题:据我所知,我注意到Apt::NeverAutoRemoveApt::Never-MarkAuto-Sections(以及其他)文献均未记录。它们不在联机帮助页中。aptitude::Keep-Unused-Pattern和都不是aptitude::Get-Root-Command

是否有完整而完整的文档apt.conf


内核示例取决于和之间的区别upgradedist-upgrade并且不能基于每个软件包进行配置。
enzotib 2011年

爆破!(对不起。。。)我仍然坚信它曾经是可配置的。现在它已经过时了,这不会令我感到惊讶。

1
我没有说不能做,我说内核示例不合适,因为“软件包已被保留”这一事实并不取决于任何配置,而是取决于upgrade命令的语义apt-get
enzotib 2011年

这个答案askubuntu.com/questions/18654/…似乎不使用pinnig。
enzotib 2011年

我看到了 我一直希望有一个apt.conf参数-一个徒劳的希望,它现在出现了。我倾向于使用dpkg --set-selections。我发现一个问题,表明使用dpkg和使用aptitude不等效(即dpkg不遵守aptitude设置)。

Answers:


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

在这种情况下,请考虑以下包装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.

现在,让我们对其进行更改-将包裹搁置:

$ echo dnsutils hold | sudo dpkg --set-selections

检查结果:

$ dpkg --get-selections | grep dnsutils
dnsutils                                        hold

再次尝试更新:

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

现在,dnsutils-及其相关软件包-像我们希望的那样受到阻碍。


您应该考虑提供一些有关root帐户使用的信息。
enzotib

以root身份登录肯定更容易;但是,sudo在适当的地方使用是更好的做法。在示例中,命令apt-get upgradedpkg --set-selections需要根访问权限-因此,sudo应将这些命令使用。其他人应该没事。
梅,

我完全知道如何以及何时使用sudo,我只建议在初学者的答案中进行澄清。
enzotib

那就是我以为你的意思。我在评论中对此进行了澄清...我现在也已经确定了答案。
梅,

-1

APT-MARK的手册页

APT-MARK(8)                                                            APT                                                            APT-MARK(8)

NAME
       apt-mark - show, set and unset various settings for a package

SYNOPSIS
       apt-mark {-f=filename | {auto | manual} pkg...  | {showauto | showmanual} [pkg...] } | {-v | --version} | {-h | --help}

       apt-mark {hold | unhold | install | remove | purge} pkg...  | {showhold | showinstall | showremove | showpurge} [pkg...]

DESCRIPTION
       apt-mark can be used as a unified front-end to set various settings for a package, such as marking a package as being
       automatically/manually installed or changing dpkg selections such as hold, install, deinstall and purge which are respected e.g. by
       apt-get dselect-upgrade or aptitude.

AUTOMATICALLY AND MANUALLY INSTALLED PACKAGES
       When you request that a package is installed, and as a result other packages are installed to satisfy its dependencies, the dependencies
       are marked as being automatically installed, while the package you installed explicitly is marked as manually installed. Once an
       automatically installed package is no longer depended on by any manually installed package it is considered no longer needed and e.g.
       apt-get or aptitude will at least suggest removing them.

       auto
           auto is used to mark a package as being automatically installed, which will cause the package to be removed when no more manually
           installed packages depend on this package.

       manual
           manual is used to mark a package as being manually installed, which will prevent the package from being automatically removed if no
           other packages depend on it.

       showauto
           showauto is used to print a list of automatically installed packages with each package on a new line. All automatically installed
           packages will be listed if no package is given. If packages are given only those which are automatically installed will be shown.

       showmanual
           showmanual can be used in the same way as showauto except that it will print a list of manually installed packages instead.

   Options
       -f=filename, --file=filename
           Read/Write package stats from the filename given with the parameter filename instead of from the default location, which is
           extended_status in the directory defined by the Configuration Item: Dir::State.

PREVENT CHANGES FOR A PACKAGE
       hold
           hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.

       unhold
           unhold is used to cancel a previously set hold on a package to allow all actions again.

       showhold
           showhold is used to print a list of packages on hold in the same way as for the other show commands.

SCHEDULE PACKAGES FOR INSTALL, REMOVE AND PURGE
       Some front-ends like apt-get dselect-upgrade can be used to apply previously scheduled changes to the install state of packages. Such
       changes can be scheduled with the install, remove (also known as deinstall) and purge commands. Packages with a specific selection can be
       displayed with showinstall, showremove and showpurge respectively. More information about these so called dpkg selections can be found in
       dpkg(1).

OPTIONS
       -h, --help
           Show a short usage summary.

       -v, --version
           Show the program version.

       -c, --config-file
           Configuration File; Specify a configuration file to use. The program will read the default configuration file and then this
           configuration file. If configuration settings need to be set before the default configuration files are parsed specify a file with the
           APT_CONFIG environment variable. See apt.conf(5) for syntax information.

       -o, --option
           Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o Foo::Bar=bar.  -o and --option can be
           used multiple times to set different options.

FILES
       /var/lib/apt/extended_states
           Status list of auto-installed packages. Configuration Item: Dir::State::extended_states.

SEE ALSO
       apt-get(8),aptitude(8),apt.conf(5)

DIAGNOSTICS
       apt-mark returns zero on normal operation, non-zero on error.

BUGS
       APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.

AUTHORS
       Mike O'Connor

       APT team

NOTES
        1. APT bug page
           http://bugs.debian.org/src:apt

APT 1.2.10                                                      25 September 2015                                                     APT-MARK(8)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.