Linux – Ignore all dependencies for a specific package with apt-get

aptdependencieslinuxUbuntu

This is a very specific question which google didn't help answering.

I'm running Ubuntu 13.04 with apt 0.9.7.7ubuntu4 for amd64 compiled on Oct 3 2013 15:25:56.

I want to install Erlang from a .deb package, but I don't want to pull all of its dependencies. The package itself specifies that it depends on Java and wx libraries, but in reality those are not needed unless you want to interface with Java or wxWidgets.

I can install Erlang like this

sudo dpkg -i --force-depends erlang.deb

However, installing anything else with apt-get afterwards fails because of unmet dependencies. So if I want to install git after Erlang, I get the following

$ sudo apt-get install -y git
Reading package lists...
Building dependency tree...
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 esl-erlang : Depends: default-jre-headless but it is not going to be installed or
                       java2-runtime-headless or
                       java1-runtime-headless or
                       java2-runtime or
                       java1-runtime
              Depends: libwxbase2.8-0 but it is not going to be installed
              Depends: libwxgtk2.8-0 but it is not going to be installed
              Recommends: erlang-mode but it is not going to be installed
 git : Depends: libcurl3-gnutls (>= 7.16.2-1) but it is not going to be installed
       Depends: perl-modules but it is not going to be installed
       Depends: liberror-perl but it is not going to be installed
       Depends: git-man (> 1:1.7.9.5) but it is not going to be installed
       Depends: git-man (< 1:1.7.9.5-.) but it is not going to be installed
       Recommends: patch
       Recommends: rsync
       Recommends: ssh-client
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Is there a way to make esl-erlang package shut up without running apt-get install -f?

I want something like this:

sudo apt-get install --ignore-deps-for-package=esl-erlang git

or like this:

sudo apt-cache shut-package-up esl-erlang

or this:

sudo apt-get download git
sudo dpkg -i --with-deps git.deb

I've found a similar question: https://serverfault.com/questions/250224/how-do-i-get-apt-get-to-ignore-some-dependencies. A couple of answers provide handy manual steps to modify dependencies of certain packages.

I'm still looking for a robust automated method.

Best Answer

I understand bjanssen's point, but it seems ridiculous for a package manager to allow --force-depends for a single package install, but not allow force-depends-forever-and-stop-warning-me-about-this-dependency.

I had a similar problem with a package which depended on a libcairo version slightly higher than the one currently available in Debian. For my purposes it still works fine. I'm happy to keep using it until the libcairo update appears in apt. I don't want to compile from source or build my own package.

The solution I found:

  • edit /var/lib/dpkg/status,
  • find the package with the broken dependencies
  • edit the Depends: line to stop the package complaining.

I assume that will be overwritten the next time the package is updated, but that's exactly what i want.

Related Question