首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么apt升级意味着要安装更多的软件包,而不是apt升级?

为什么apt升级意味着要安装更多的软件包,而不是apt升级?
EN

Unix & Linux用户
提问于 2020-09-08 07:09:29
回答 2查看 1.3K关注 0票数 1

在运行apt upgrade时,我会得到与运行apt-get upgrade不同的要安装的“新包”列表。

我阅读了一些关于apt upgradeapt-get upgrade之间的区别的比较,但是所有的文章都描述它们来做同样的事情。

下面是我在运行apt upgrade时所得到的信息:

代码语言:javascript
复制
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-5.4.0-47 linux-headers-5.4.0-47-generic linux-image-5.4.0-47-generic linux-modules-5.4.0-47-generic linux-modules-extra-5.4.0-47-generic motd-news-config
The following packages will be upgraded:
  base-files linux-generic linux-headers-generic linux-headers-virtual linux-image-generic linux-image-virtual linux-virtual ubuntu-server
8 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 74.2 MB of archives.
After this operation, 360 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

这是我对apt-get upgrade的输出:

代码语言:javascript
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  base-files linux-generic linux-headers-generic linux-headers-virtual linux-image-generic linux-image-virtual linux-virtual ubuntu-server
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded

好的,所以apt-get upgrade决定保留一些软件包是个好主意,而apt upgrade会很高兴地安装它们。如果我想要安装最新的安全更新,有人能解释一下为什么是这样吗?如果我想要安装最新的安全更新,我应该使用哪个upgrade路径?

EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2020-09-08 07:19:18

apt upgrade允许在升级期间默认安装新包,而apt-get upgrade则不允许。这是级联式的,因此apt-get upgrade拒绝接触任何升级会导致安装新包的包;这就是在您的情况下发生的情况。

您应该使用apt upgrade来确保您拥有所有最新的安全更新。在某些情况下,如果更新涉及删除包,甚至可能需要apt full-upgrade (或apt-get ...,在这里它们是等效的)。Debian常见问题直接推荐后者(当不使用aptitude时);由于您使用的是另一个发行版,所以您应该遵循该发行版的说明。

另见去找升级阻止内核更新。在Debian 9上应用更新的官方说明是什么?

票数 3
EN

Unix & Linux用户

发布于 2020-09-08 07:19:10

请参见man 8 apt

代码语言:javascript
复制
upgrade (apt-get(8))
   upgrade is used to install available upgrades of all packages currently installed on
   the system from the sources configured via sources.list(5). New packages will be
   installed if required to satisfy dependencies, but existing packages will never be
   removed. If an upgrade for a package requires the removal of an installed package the
   upgrade for this package isn't performed.

这使apt upgrade能够通过安装其他软件包来升级apt-get upgrade无法升级的包。正如apt upgrade输出中提到的那样:

代码语言:javascript
复制
The following NEW packages will be installed:
  linux-headers-5.4.0-47 linux-headers-5.4.0-47-generic linux-image-5.4.0-47-generic linux-modules-5.4.0-47-generic linux-modules-extra-5.4.0-47-generic motd-news-config

较早版本的大写使其更加明确:

代码语言:javascript
复制
DIFFERENCES TO APT-GET(8)

The apt command is meant to be pleasant for end users and does not need to be 
backward compatible like apt-get(8). Therefore some options are different:
[...]

- The option upgrade has --with-new-pkgs enabled by default.
票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/608389

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档