how to override debian/ubuntu package dependencies

I’d like to install package foo, and it depends on package bar-.8. However, package baz is already installed and it depends on package bar-.9, so the installation fails. Or, in various other permutations of this problem, the next system update fails, or… well, you get the picture; some lame breakage occurs.

Fortunately, package baz is not one I care about, and the dependency is a case of dain-bramage, so I need to override it. Easily done- create a dummy package with a version number high enough to override both of the other dependencies.

# equivs package provides equivs-control and equivs-build
apt-get install equivs
# just to be tidy, create a working directory:
mkdir $HOME/src/bogusbar
cd $HOME/src/bogobar
# one can copy a control file template with this
#equivs-control control
# we just need a minimal control file, tho
cat > bar.control <<EOM
Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: bar
Version: 9:9
Description: dummy package to block bar dependency
# build the package
equivs-build bar.control
# install our new package
sudo dpkg -i bar_9.9_all.deb

if you don’t like the result, or wish to modify the control file again, just do sudo dpkg -r bar

and, if you wish to do something more complex, the man page has lots of useful information: man equivs-build