Debian: How to use “apt-get install” without upgrading dependencies

aptdebiandependenciespackage-management

I already have a package B and want to install a new package A. The installation wants to modify B, but I don't want that to happen.

I need to install the package A.

It has the a dependency on package B and requires to be (>2.0).

I have already installed B in my system with the version 2.1, so my current setup already fulfills the dependency.

But there is a new version (2.2) of the B package in the Debian repository and I don't want it since it conflicts with other stuff.

So, when I install the A package apt also tries to upgrade B.

How can I disable the upgrading of the dependencies or indicate an explicit dependency version without having to edit the packages?

I have read How do I get apt-get to ignore some dependencies?, but it doesn't help me. In the question there, the dependency (B) should not be handled by the repository manager at all. In my case, the repository manager already takes care of the dependency and should continue to do so, just not in this particular action.

Reopen Reviewers: Please see the comment of victorgp which should have been the answer in the first place.

Best Answer

You can try the --nodeps flag with apt-get or you can try the debian package utility, dpkg, with the option --ignore-depends.