我想知道为什么upgrade
有时不想升级系统的某些部分,而dist-upgrade
却可以。下面是一个运行apt-get upgrade
后的例子。
`apt-get upgrade':
rimmer@rimmer-Lenovo-IdeaPad-S10-2:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-generic linux-headers-generic linux-image-generic
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
与 "apt-get dist-upgrade "相比。
rimmer@rimmer-Lenovo-IdeaPad-S10-2:~$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-3.0.0-13 linux-headers-3.0.0-13-generic
linux-image-3.0.0-13-generic
The following packages will be upgraded:
linux-generic linux-headers-generic linux-image-generic
3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 48.5 MB of archives.
After this operation, 215 MB of additional disk space will be used.
Do you want to continue [Y/n]?
换句话说,为什么不能用upgrade
来执行?
来自apt-get
手册。
upgrade
upgrade is used to install the newest versions of all packages
currently installed on the system from the sources enumerated in
/etc/apt/sources.list. Packages currently installed with new
versions available are retrieved and upgraded; under no
circumstances are currently installed packages removed, or packages
not already installed retrieved and installed. New versions of
currently installed packages that cannot be upgraded without
changing the install status of another package will be left at
their current version. An update must be performed first so that
apt-get knows that new versions of packages are available.
dist-upgrade
dist-upgrade in addition to performing the function of upgrade,
also intelligently handles changing dependencies with new versions
of packages; apt-get has a "smart" conflict resolution system, and
it will attempt to upgrade the most important packages at the
expense of less important ones if necessary. So, dist-upgrade
command may remove some packages. The /etc/apt/sources.list file
contains a list of locations from which to retrieve desired package
files. See also apt_preferences(5) for a mechanism for overriding
the general settings for individual packages.
并使用从14.04起可用的较新的apt
工具。
full-upgrade
full-upgrade performs the function of upgrade but may also remove
installed packages if that is required in order to resolve a
package conflict.
在你的特定案例中,我看到,例如,linux-headers
是一个虚拟包,由linux-headers-3.0.0-12
和linux-headers-3.0.0-13
提供,这听起来像是由dist-upgrade
处理的那种包的安装和移除,但不是由upgrade
。
apt-get upgrade
仅限于软件包被更新的版本取代,但不需要添加或删除软件包的情况。例如,一个新版本的Firefox,应该可以用apt-get upgrade
来安装。
然而,当更新的版本需要增加或删除时,apt-get upgrade
会拒绝工作。例如,当你安装了linux-image-3.2.0-10-generic
内核,而linux-image-3.2.0-11-generic
出现时,linux-image-generic
包会被更新为依赖新版本。为了安装新的内核,你需要运行apt-get dist-upgrade
。
注意apt-get upgrade
会说内核包被保留'了。这就是使用
apt-get dist-upgrade`的提示。
基本上,升级将只把现有的软件包从一个版本升级到另一个版本。 它不会安装或删除软件包,即使这样做是为了升级其他软件包。 在内核更新的情况下,升级linux-generic软件包需要安装新的linux-3.0.0-13-generic软件包,由于upgrade拒绝安装或删除软件包,它拒绝升级linux-generic。
有时,软件包之间的各种不兼容会要求删除一些软件包,以便升级其他软件包,这也需要dist-upgrade。 内核更新总是需要dist-upgrade,因为它们是如何处理的。 与其说有一个内核包被更新,不如说每次都会创建一个全新的内核包,而内核元包也会被更新为依赖新的内核包而不是旧的。 这样做是为了让你保留旧的内核版本,以便在启动新的内核时出现问题,你可以从启动菜单中选择旧的内核并恢复。