“apt-get -f install”如何识别“dpkg”中的问题?

“apt-get -f install”如何识别“dpkg”中的问题?

当我安装 Discord 时,需要一些包 -libgconf-2-4和。libappindicator1libc++1

这是错误信息。

Selecting previously unselected package discord.
(Reading database ... 281442 files and directories currently installed.)
Preparing to unpack discord-0.0.14.deb ...
Unpacking discord (0.0.14) ...
dpkg: dependency problems prevent configuration of discord:
 discord depends on libgconf-2-4; however:
  Package libgconf-2-4 is not installed.
 discord depends on libappindicator1; however:
  Package libappindicator1 is not installed.
 discord depends on libc++1; however:
  Package libc++1 is not installed.

dpkg: error processing package discord (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Errors were encountered while processing:
 discord

互联网说用它sudo apt-get -f install来修复这个问题,而且效果很好。

但如何

如何apt-get识别dpkg的依赖问题并修复它?

我猜 Linux 系统中是否存在一些有问题的软件包/依赖项列表文件?

你能解释一下吗?谢谢。

答案1

我将尽我所能解释这一点。 aptapt-getaptitudedpkg联系在一起。 dpkg实际上是“Debian 的软件包管理器”,来源man dpkg。如果您运行,dpkg --help您将在帮助底部看到以下行:

Use 'apt' or 'aptitude' for user-friendly package management.

apt而其他的则比dpkg它更方便用户使用,因此它们能够读取未配置的内容,这些内容是尝试安装.deb从互联网而不是从存储库下载的包时遗留下来的。基本上,当您看到时,dependency problems - leaving unconfigured意味着它留下了需要安装的依赖项的“日志”。因此,当您运行sudo apt -f installsudo apt-get -f install

   man apt-get:

   -f, --fix-broken
       Fix; attempt to correct a system with broken dependencies in place.
       This option, when used with install/remove, can omit any packages
       to permit APT to deduce a likely solution. If packages are
       specified, these have to completely correct the problem. The option
       is sometimes necessary when running APT for the first time; APT
       itself does not allow broken package dependencies to exist on a
       system. It is possible that a system's dependency structure can be
       so corrupt as to require manual intervention (which usually means
       using dpkg --remove to eliminate some of the offending packages).
       Use of this option together with -m may produce an error in some
       situations. Configuration Item: APT::Get::Fix-Broken.

它发送一个命令来apt-get读取损坏安装的“日志”(如果存在),下载并安装依赖项(如果可用)。

您可以跳过此步骤,直接进入下载文件的文件夹.deb并运行:

sudo apt-get install ./discord-0.0.14.deb

现在将告诉apt-get安装.deb包并且下载所有依赖项(如果可用于正在安装的包)。

我希望这有帮助!

相关内容