在linux上安装软件时如何解决循环依赖?
How to solve cyclic dependencies while installing software on linux?
我是计算机界的新手。 我的目的是想出一种通用方法来解决在 Linux 上安装新软件时的循环依赖关系(如果存在的话)。在这里,我使用 Google chrome 的情况来更好地说明我的问题。在安装 Google chrome 时(同时使用包管理器和 apt-get)我遇到了以下问题:
Selecting previously unselected package google-chrome-stable.
(Reading database ... 262709 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (55.0.2883.87-1) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
google-chrome-stable depends on libappindicator1; however:
Package libappindicator1 is not installed.
为了解决上述错误,我尝试安装 libappindicator1
但是 returns 另一个依赖错误:
The following packages have unmet dependencies:
libappindicator1 : Depends: libindicator7 (>= 0.4.90) but it is not going to be installed
现在我们遇到了循环依赖。尝试安装 libindicator7
时收到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
google-chrome-stable : Depends: libappindicator1 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
如您所见,由于依赖关系,我无法安装该软件包。现在一种方法是使用 apt-get -f install
并让 Linux 神奇地完成它的工作。但这不会教我太多。使用这个例子(或建议一个更好的例子),我们能否找出更好的方法来解决循环依赖问题?如果这是循环依赖的独立案例 在安装新软件时 或者我在解释错误时犯了错误,那么我可以删除这个问题。
一些有用的链接-
[1]: https://askubuntu.com/questions/764040/im-having-a-hard-time-installing-google-chrome-on-16-04-lts-please-help [2]: How to solve Cyclic Dependency [3]: How to Solve Circular Dependency [4]: cyclic dependency ... how to solve?
问题是使用 dpkg 安装 google-chrome-stable。 DPKG 现在确实安装了所需的依赖项并使系统处于损坏状态。
sudo apt install ./google-chrome-stable.deb
这将安装具有所需依赖项的包。
dpkg
只安装一个包,所以 dpkg -i packageName.deb
只会安装这个 Deb 包,并会通知你任何需要安装的依赖项安装,但它不会安装它们,也不会配置 packageName.deb
因为好吧......依赖项不存在。
apt
是一个包管理系统,用于处理 Debian-based Linux 发行版上的 Deb 包安装。包管理系统是一组工具,可帮助您轻松安装、删除和更改包。所以 apt
就像一个聪明的 dpkg
DPKG
是自由操作系统 Debian 及其众多衍生产品中包管理系统的基础软件。 dpkg 用于安装、删除和提供有关 .deb 包的信息。 dpkg(Debian 软件包)本身就是一个 low-level 工具。 [1]
APT
(Advanced Package Tool)是一组用于管理 Debian 软件包的工具,因此也用于管理 Debian 系统上安装的应用程序。 APT 使安装应用程序、删除应用程序、使您的应用程序保持最新等成为可能。[2]
因此,如果您在安装过程中逐步移动
下载 .deb
包后,您可以将其解压缩。解压缩包含的 control.tar.gz 文件。您会找到一组所有必需的软件包。
找到特定 Debian 软件包的所有依赖项。对于 google-chrome 你会得到类似
的东西
Package: google-chrome-stable
Version: 55.0.2883.87-1
Architecture: amd64
Maintainer: Chrome Linux Team <chromium-dev@chromium.org>
Installed-Size: 175549
Pre-Depends: dpkg (>= 1.14.0)
Depends: gconf-service, libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.11), libcairo2 (>= 1.6.0), libcups2 (>= 1.4.0), libdbus-1-3 (>= 1.1.4), libexpat1 (>= 2.0.1), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.3.9), libgcc1 (>= 1:4.1.1), libgconf-2-4 (>= 2.31.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.26.0), libgtk2.0-0 (>= 2.24.0), libnspr4 (>= 2:4.9-2~) | libnspr4-0d (>= 1.8.0.10) | libnspr4 (>= 4.9.5-0ubuntu0), libnss3 (>= 2:3.13.4-2~) | libnss3-1d (>= 3.12.4), libpango1.0-0 (>= 1.14.0), libstdc++6 (>= 4.8.0), libx11-6 (>= 2:1.4.99.1), libx11-xcb1, libxcb1 (>= 1.6), libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxi6 (>= 2:1.2.99.4), libxrandr2 (>= 2:1.2.99.3), libxrender1, libxss1, libxtst6, ca-certificates, fonts-liberation, libappindicator1, libnss3 (>= 3.17.2), lsb-base (>= 4.1), xdg-utils (>= 1.0.2), wget
Provides: www-browser
Section: web
Priority: optional
Description: The web browser from Google
Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.
您需要安装该特定包的所有依赖项。每个依赖项可能依赖于一组其他依赖项。您将拥有这些依赖项的树。您可以手动安装所有这些依赖项或使用 apt
或 yum
或 aptitude
...
这些软件包管理器中的任何一个都会为您做的是,他们会为您构建一个依赖关系树,并在安装您的 Debian 软件包之前安装所有相关的软件包。
因此,理想情况下,依赖树中不应有任何循环,但可能会出现某些现有软件包已经安装并且处于当前安装的 newer/older 版本的情况已安装软件包的必需软件包。然后你可能会陷入循环依赖循环。
所以,apt
如何处理循环依赖在[3]中提到,我认为你可以将其视为手动解决依赖的通用算法,但不推荐这样做。循环依赖发生在存储库中,但是那些保留下来的依赖遵循一些特定的规则。通常,这些是紧密绑定的包。所以它们之间的 Depends
关系指定了确切的版本号。
帮助我在 Debian 和 Docker 上安装 libappindicator1
的是手动安装这个软件包。另外,它取决于另一个 libindicator7
.
RUN curl -p --insecure "http://ftp.de.debian.org/debian/pool/main/liba/libappindicator/libappindicator1_0.4.92-7_amd64.deb" --output libappindicator1_0.4.92-8_amd64.deb \
&& curl -p --insecure "http://ftp.de.debian.org/debian/pool/main/libi/libindicator/libindicator7_0.5.0-4_amd64.deb" --output libindicator7_0.5.0-4_amd64.deb \
&& dpkg -i libindicator7_0.5.0-4_amd64.deb \
&& dpkg -i libappindicator1_0.4.92-8_amd64.deb \
&& rm libindicator7_0.5.0-4_amd64.deb \
&& rm libappindicator1_0.4.92-8_amd64.deb
我是计算机界的新手。 我的目的是想出一种通用方法来解决在 Linux 上安装新软件时的循环依赖关系(如果存在的话)。在这里,我使用 Google chrome 的情况来更好地说明我的问题。在安装 Google chrome 时(同时使用包管理器和 apt-get)我遇到了以下问题:
Selecting previously unselected package google-chrome-stable.
(Reading database ... 262709 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (55.0.2883.87-1) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
google-chrome-stable depends on libappindicator1; however:
Package libappindicator1 is not installed.
为了解决上述错误,我尝试安装 libappindicator1
但是 returns 另一个依赖错误:
The following packages have unmet dependencies:
libappindicator1 : Depends: libindicator7 (>= 0.4.90) but it is not going to be installed
现在我们遇到了循环依赖。尝试安装 libindicator7
时收到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
google-chrome-stable : Depends: libappindicator1 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
如您所见,由于依赖关系,我无法安装该软件包。现在一种方法是使用 apt-get -f install
并让 Linux 神奇地完成它的工作。但这不会教我太多。使用这个例子(或建议一个更好的例子),我们能否找出更好的方法来解决循环依赖问题?如果这是循环依赖的独立案例 在安装新软件时 或者我在解释错误时犯了错误,那么我可以删除这个问题。
一些有用的链接-
[1]: https://askubuntu.com/questions/764040/im-having-a-hard-time-installing-google-chrome-on-16-04-lts-please-help [2]: How to solve Cyclic Dependency [3]: How to Solve Circular Dependency [4]: cyclic dependency ... how to solve?
问题是使用 dpkg 安装 google-chrome-stable。 DPKG 现在确实安装了所需的依赖项并使系统处于损坏状态。
sudo apt install ./google-chrome-stable.deb
这将安装具有所需依赖项的包。
dpkg
只安装一个包,所以 dpkg -i packageName.deb
只会安装这个 Deb 包,并会通知你任何需要安装的依赖项安装,但它不会安装它们,也不会配置 packageName.deb
因为好吧......依赖项不存在。
apt
是一个包管理系统,用于处理 Debian-based Linux 发行版上的 Deb 包安装。包管理系统是一组工具,可帮助您轻松安装、删除和更改包。所以 apt
就像一个聪明的 dpkg
DPKG
是自由操作系统 Debian 及其众多衍生产品中包管理系统的基础软件。 dpkg 用于安装、删除和提供有关 .deb 包的信息。 dpkg(Debian 软件包)本身就是一个 low-level 工具。 [1]
APT
(Advanced Package Tool)是一组用于管理 Debian 软件包的工具,因此也用于管理 Debian 系统上安装的应用程序。 APT 使安装应用程序、删除应用程序、使您的应用程序保持最新等成为可能。[2]
因此,如果您在安装过程中逐步移动
下载
.deb
包后,您可以将其解压缩。解压缩包含的 control.tar.gz 文件。您会找到一组所有必需的软件包。找到特定 Debian 软件包的所有依赖项。对于 google-chrome 你会得到类似
的东西
Package: google-chrome-stable
Version: 55.0.2883.87-1
Architecture: amd64
Maintainer: Chrome Linux Team <chromium-dev@chromium.org>
Installed-Size: 175549
Pre-Depends: dpkg (>= 1.14.0)
Depends: gconf-service, libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.11), libcairo2 (>= 1.6.0), libcups2 (>= 1.4.0), libdbus-1-3 (>= 1.1.4), libexpat1 (>= 2.0.1), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.3.9), libgcc1 (>= 1:4.1.1), libgconf-2-4 (>= 2.31.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.26.0), libgtk2.0-0 (>= 2.24.0), libnspr4 (>= 2:4.9-2~) | libnspr4-0d (>= 1.8.0.10) | libnspr4 (>= 4.9.5-0ubuntu0), libnss3 (>= 2:3.13.4-2~) | libnss3-1d (>= 3.12.4), libpango1.0-0 (>= 1.14.0), libstdc++6 (>= 4.8.0), libx11-6 (>= 2:1.4.99.1), libx11-xcb1, libxcb1 (>= 1.6), libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxi6 (>= 2:1.2.99.4), libxrandr2 (>= 2:1.2.99.3), libxrender1, libxss1, libxtst6, ca-certificates, fonts-liberation, libappindicator1, libnss3 (>= 3.17.2), lsb-base (>= 4.1), xdg-utils (>= 1.0.2), wget
Provides: www-browser
Section: web
Priority: optional
Description: The web browser from Google
Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.
您需要安装该特定包的所有依赖项。每个依赖项可能依赖于一组其他依赖项。您将拥有这些依赖项的树。您可以手动安装所有这些依赖项或使用
apt
或yum
或aptitude
...这些软件包管理器中的任何一个都会为您做的是,他们会为您构建一个依赖关系树,并在安装您的 Debian 软件包之前安装所有相关的软件包。
因此,理想情况下,依赖树中不应有任何循环,但可能会出现某些现有软件包已经安装并且处于当前安装的 newer/older 版本的情况已安装软件包的必需软件包。然后你可能会陷入循环依赖循环。
所以,apt
如何处理循环依赖在[3]中提到,我认为你可以将其视为手动解决依赖的通用算法,但不推荐这样做。循环依赖发生在存储库中,但是那些保留下来的依赖遵循一些特定的规则。通常,这些是紧密绑定的包。所以它们之间的 Depends
关系指定了确切的版本号。
帮助我在 Debian 和 Docker 上安装 libappindicator1
的是手动安装这个软件包。另外,它取决于另一个 libindicator7
.
RUN curl -p --insecure "http://ftp.de.debian.org/debian/pool/main/liba/libappindicator/libappindicator1_0.4.92-7_amd64.deb" --output libappindicator1_0.4.92-8_amd64.deb \
&& curl -p --insecure "http://ftp.de.debian.org/debian/pool/main/libi/libindicator/libindicator7_0.5.0-4_amd64.deb" --output libindicator7_0.5.0-4_amd64.deb \
&& dpkg -i libindicator7_0.5.0-4_amd64.deb \
&& dpkg -i libappindicator1_0.4.92-8_amd64.deb \
&& rm libindicator7_0.5.0-4_amd64.deb \
&& rm libappindicator1_0.4.92-8_amd64.deb