Skip to content
Advertisement

How to solve cyclic dependencies while installing software on linux?

I am new to the computing world. My intention is to figure out a generic approach to solve cyclic dependencies while installing new software on Linux, if it exists. Here I am using the case of Google chrome to better illustrate my question. While installing Google chrome (both using package manager and apt-get) I encounter the following problem:

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.

To solve the above error, I tried installing libappindicator1 but that returns another dependency error:

The following packages have unmet dependencies:
libappindicator1 : Depends: libindicator7 (>= 0.4.90) but it is not going to be installed

Now here we encounter the cyclic dependency. When trying to install libindicator7 the following error is received:

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

As you can see that I cannot install the package because of the dependencies. Now one way is to use apt-get -f install and let Linux magically do it’s work. But that won’t teach me much. Using this example (or suggest a better example), can we figure out a better approach to solve the problem of cyclic dependency? If this is a stand-alone case of cyclic dependency while installing a new software or I made a mistake in interpreting the errors then I can remove the question.

Some helpful links-

[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?

Advertisement

Answer

DPKG is the software at the base of the package management system in the free operating system Debian and its numerous derivatives. dpkg is used to install, remove, and provide information about .deb packages. dpkg (Debian Package) itself is a low-level tool. [1]

APT (for Advanced Package Tool) is a set of tools for managing Debian packages, and therefore the applications installed on your Debian system. APT makes it possible to Install applications, Remove applications, Keep your applications up to date and much more.[2]

So if you move step by step on your installation

  1. Once you download a .deb package you can unzip it. Unzip the contained control.tar.gz file. You would find a set of all the required packages.

  2. Find all the dependencies for that specific Debian package. For google-chrome you would have something like

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.
  1. You would need to install all the dependencies for that specific package. Each dependency might depend on a set of other dependencies. You would have a tree of these dependencies. Either you can manually install all these dependencies or use something like apt or yum or aptitude

  2. What either of these package managers would do for you is they would construct a dependency tree for you and install all the relevant packages before installing your Debian package.

So, Ideally there should not be any loops in the dependency tree, but it might be the case that some of the existing packages are already installed and are in newer/older version of what is currently installed and is a required package for an already existing installed package. Then you can end up in cyclic dependency loop.

So, how apt handles cyclic dependencies is mentioned in [3], I think you can consider it as a generic algorithm for solving a dependency manually but it’s not recommended. Circular dependencies happen in the repositories, but the ones left standing to obey some specific rules. Usually, these are tightly bound packages. So the Depends relationship between them specifies the exact version number.

  1. https://en.wikipedia.org/wiki/Dpkg
  2. https://wiki.debian.org/Apt
  3. https://web.archive.org/web/20150905091555/http://algebraicthunk.net/~dburrows/blog/entry/from-blogspot/2005-05-09–21:30:00/
Advertisement