apt 和 apt-get 升级不同的软件包

apt 和 apt-get 升级不同的软件包

今天想尝试一下sudo apt upgrade而不是sudo apt-get upgrade,但不知为何它们的结果却不同。

输出sudo apt upgrade

The following package was automatically installed and is no longer required:
  libllvm3.8:i386
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  caribou libcapnp-0.5.3 libinput-bin libllvm4.0 libllvm4.0:i386 libmircommon7 libmircore1 libsensors4:i386 python-dbus python-pyatspi
The following packages will be upgraded:
  gnome-shell gnome-shell-common kmod libappstream-glib8 libegl1-mesa libgbm1 libgl1-mesa-dri libgl1-mesa-dri:i386 libinput10 libkmod2
  libmirclient9 libwayland-egl1-mesa libwhoopsie0 libxatracker2 mesa-vdpau-drivers shim-signed whoopsie
17 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 41,4 MB of archives.
After this operation, 123 MB of additional disk space will be used.
Do you want to continue? [Y/n] n

输出sudo apt-get upgrade

The following packages have been kept back:
  gnome-shell gnome-shell-common libegl1-mesa libgbm1 libgl1-mesa-dri libgl1-mesa-dri:i386 libinput10 libmirclient9 libwayland-egl1-mesa
  libxatracker2 mesa-vdpau-drivers
The following packages will be upgraded:
  kmod libappstream-glib8 libkmod2 libwhoopsie0 shim-signed whoopsie
6 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
Need to get 572 kB of archives.
After this operation, 3.072 B of additional disk space will be used.
Do you want to continue? [Y/n] n

如您所见,apt-get仅升级了 6 个软件包并保留了 11 个软件包,而apt提供升级所有 17 个软件包。另外apt尝试新安装 10 个软件包。

sudo apt update我已经检查了和的输出sudo apt-get update,但两者都使用相同的包源。

现在我很好奇这是怎么回事。

答案1

man 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
       statisfy dependencies, but existing packages will never be removed.
       If an upgrade for a package requires the remove of an installed
       package the upgrade for this package isn't performed.

因此,为了满足依赖关系,apt将安装新的应用程序。其中apt-get指出。您正在运行的under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed应用程序将作为而不是像您只使用应用程序那样运行它。held backapt-getdist-upgradeupgradeapt

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

两者的描述如下:

   apt provides a high-level commandline interface for the package
   management system. It is intended as an end user interface and enables
   some options better suited for interactive usage by default compared to
   more specialized APT tools like apt-get(8) and apt-cache(8).

   apt-get is the command-line tool for handling packages, and may be
   considered the user's "back-end" to other tools using the APT library.
   Several "front-end" interfaces exist, such as aptitude(8), synaptic(8)
   and wajig(1).

希望这可以帮助!

相关内容