Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer
    
Apt pinning with preference -1? –  Steve-o Aug 29 '11 at 9:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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