Ignore all dependencies for a specific package with apt-get

16

8

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.

android

Posted 2014-04-08T19:47:09.393

Reputation: 261

Have you tried --nodeps (apt-get) or --ignore-depends with dpkg? – Mike Koch – 2014-04-08T20:24:55.873

Answers

28

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.

andrew lorien

Posted 2014-04-08T19:47:09.393

Reputation: 431

2This is perfect, just what I needed to temporarily workaround an incorrect PPA dependency! – Cas – 2017-01-24T14:20:08.850

2

What you try to do is against the purpose of a package manager, which tries to keep a sane environment, i. o. w. you are using the wrong tool for the job. Don't try to break apt-get.

The right way to solve your issue is to build your own package with dependencies that suit you. There is the official way (quite involved: http://www.debian.org/doc/manuals/maint-guide/index.en.html) and the quick and dirty way using apt-build, or for packages not in the distribution source, checkinstall. All produce packages apt-get will happily install.

On a final note, you may question the wisdom of the maintainer of esl-erlang to include certain dependencies, but you cannot fault the package manager for intended behavior. If you think these dependencies are wrong, you should file a bug with the package.

bjanssen

Posted 2014-04-08T19:47:09.393

Reputation: 2 289

What you've said about the "purpose of a package manager" is basically true, but you shouldn't generalise either. I'd like to give an example: one application needed libmng1. But I had libmng2 installed AND a symlink set to libmng1.so. Worked a threat, never had any problems. But apt-get always complained about "unmet dependencies". So there is definitely a good reason trying to find a way to silence aptitude in this respect. Since things do work, it just keeps complaining for things that simply are no problem. It just sees problems where they aren't any. And that's annoying. – syntaxerror – 2014-12-15T02:25:48.300

This is a curious situation. I guess you installed a package from a non-distribution repository? In such a case take a look at equivs for "silencing" apt-get without breaking it. – bjanssen – 2015-04-18T11:31:36.657

Well, it could have been like that. But in fact it wasn't ... I simply installed the older package from the very same distro, so in Ubuntu terms I was on 15.x, but I installed the libmng1 from 12.04 LTS. – syntaxerror – 2015-04-18T12:43:14.777

0

Check, if the "proxy used" in the apt.conf is proper (i.e. in accordance to your network). This causes such issues as well, since urls would be unreachable.

Typically, if you using proxy, then your /etc/apt/apt.conf would look like:

Acquire::ftp::proxy "ftp://<user>:<password>@<ip>:<port>/";
Acquire::http::proxy "http://<user>:<password>@<ip>:<port>/";
Acquire::https::proxy "https://<user>:<password>@<ip>:<port>/";

parasrish

Posted 2014-04-08T19:47:09.393

Reputation: 101