当我登录 Ubuntu 10.04.2 LTS 服务器时,我看到以下消息:
42 packages can be updated.
18 updates are security updates.
但是当我尝试更新它时,没有任何内容像预期的那样得到升级:
$ sudo apt-get update
....snip....
Reading package lists... Done
$ sudo 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
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
有什么想法可以解释为什么没有更新任何内容,或者为什么计数 3(来自 apt-get)与 42 不同?如果不是 apt,哪个软件会显示 42?
(其他详细信息:这是服务器版本,没有 GUI;我没有接触过 apt 配置文件;当我安装软件时,我拒绝允许自动更新)
答案1
为了安装软件包被阻止你必须运行:
sudo apt-get update && sudo apt-get dist-upgrade
尝试运行,但sudo apt-get update && sudo apt-get upgrade
无法安装软件包被阻止因为apt-get upgrade
默认情况下不会尝试安装新的软件包(例如新的内核版本);从手册页中:在任何情况下都不会删除当前安装的软件包,也不会检索和安装尚未安装的软件包。
但是apt-get dist-upgrade
允许您在需要时安装新的软件包(即新的内核版本);从手册页:
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.
答案2
此消息来自 MOTD(每日消息)系统。有关如何修复此消息与包管理器之间的不一致的详细信息,最近已在这个答案。