在运行apt upgrade时,我会得到与运行apt-get upgrade不同的要安装的“新包”列表。
我阅读了一些关于apt upgrade和apt-get upgrade之间的区别的比较,但是所有的文章都描述它们来做同样的事情。
下面是我在运行apt upgrade时所得到的信息:
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的输出:
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路径?
发布于 2020-09-08 07:19:18
apt upgrade允许在升级期间默认安装新包,而apt-get upgrade则不允许。这是级联式的,因此apt-get upgrade拒绝接触任何升级会导致安装新包的包;这就是在您的情况下发生的情况。
您应该使用apt upgrade来确保您拥有所有最新的安全更新。在某些情况下,如果更新涉及删除包,甚至可能需要apt full-upgrade (或apt-get ...,在这里它们是等效的)。Debian常见问题直接推荐后者(当不使用aptitude时);由于您使用的是另一个发行版,所以您应该遵循该发行版的说明。
发布于 2020-09-08 07:19:10
请参见man 8 apt:
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输出中提到的那样:
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较早版本的大写使其更加明确:
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.https://unix.stackexchange.com/questions/608389
复制相似问题