How can I trick apt-get to believe that a dependency of an about to be installed package is already installed, so that the referencing package can be installed without installing the dependency ?
Do I have to edit /var/lib/dpkg/status ?

In my real-world case I want to install nagios without having to install mailx and postfix.
I made a shell script /usr/local/bin/mailx that uses msmtp to send mail remotely and linked that to /usr/bin/mailx using update-alternatives. So I don't need and don't want a local mail infrastructure installed, but nagios3-common depends on bsd-mailx | mailx.

apt-get --force-yes install nagios3-common does not help, neither does defining a negative priority for *mail* packages in /etc/apt/preferences.

  • 1
    Easiest is to unpack the .deb, modify the control file, i.e. remove the dependency in question. Then repack & install the redone .deb. I've a script that makes the task quite simple if you'd like.
    – doug
    Mar 2, 2017 at 1:58

1 Answer 1


Solution for my real-world case:

apt-get install --no-install-recommends equivs
echo -e 'Package: mailx-dummy\nProvides: mail, mailx\nDescription: fake mail/mailx' > mailx-dummy.ctl
equivs-build mailx-dummy.ctl && dpkg -i mailx-dummy*.deb
apt-get install --no-install-recommends nagios3

Yes, this is a duplicate of How to fake a package version installed.
Did not mark this question as a duplicate because this is a specific four-line-solution for installing nagios without mailx and postfix and might be helpful besides the original question.

Not the answer you're looking for? Browse other questions tagged or ask your own question.