Ignore all dependencies for a specific package with apt-get

56,544

Solution 1

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.

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

Share:
56,544

Related videos on Youtube

fruit
Author by

fruit

Updated on September 18, 2022

Comments

  • fruit
    fruit over 1 year

    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.

    • Mike Koch
      Mike Koch about 10 years
      Have you tried --nodeps (apt-get) or --ignore-depends with dpkg?
  • syntaxerror
    syntaxerror over 9 years
    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.
  • bjanssen
    bjanssen about 9 years
    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.
  • syntaxerror
    syntaxerror about 9 years
    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.
  • Cas
    Cas over 7 years
    This is perfect, just what I needed to temporarily workaround an incorrect PPA dependency!
  • mvorisek
    mvorisek about 4 years
    Can this be done from a script?
  • andrew lorien
    andrew lorien about 4 years
    Scripting the edit to the status file would be easy. You could do something like run a global update, grep for every package with "Unmet dependencies", edit the status file, re-run the global update. But that seems dangerous, and too long for a comment. If you can explain your reason, ask for it in another question!
  • philant
    philant over 2 years
    I had to remove the Breaks: line for the faulty packages.