4

If you install a program which depends on a number of other packages which are not installed, then apt-get automatically installs those dependencies. In allmost all cases this is the desired behaviour.

But now and then I have a case where I don't want to install a package which is marked as required but which is not really needed to use the program I actually want to install.

Example:

  • I want to install the program logwatch
  • the logwatch package depends on the installation of a mail transfer agent (MTA)
  • logwatch can be used without a MTA
  • I don't want to install a MTA

I know I could install the program from source. But I want to know if apt-get provides a method to prevent the installation of a dependency (without breaking the whole package management system).

Nimmermehr
  • 1,704

2 Answers2

4

It is not possible without hacking in some way into the package management system, I think.

The reason is that logwatch declare postfix, or alternatively mail-transport-agent, as a dependency, and not as a recommend. If the package can work also without an MTA, this strong dependency could be a bug.

Also installing through dpkg do not solve, because the ignored dependencies will continue to pop-up at next apt-get operation.

A possible way to follow could be to download and modify the package to remove the offending dependency. It is not that hard to realize, but I will give details if you're iterested.

enzotib
  • 96,093
3

I have not tried this on logwatch itself, but generally ignoring dependencies is done like this:

sudo dpkg -i --ignore-depends=postfix the_package.deb

There is no way of doing this via apt that I know of.

EDIT: enzotib is right, apt will complain at a later stage of a missing dependency. Apt-pinning or changing the dependencies in the deb package might be a better way.

arrange
  • 15,219