4

if I run

# apt-get install sendmail
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sendmail : Depends: sendmail-bin but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

it works if I add sendmail-bin to the apt-get install command, but on Squeeze it was not necessary
why I have to specify some dependencies on Wheezy?

EDIT

If I remove exim4 packages, then apt-get install sendmail works, seems something related to package dependencies

EDIT

now I tested on squeeze and it's the same!
my trouble is puppet squeeze manifests are not working on wheezy, thought apt changed something but seems not, sorry about that

Lluís
  • 425
  • 1
  • 4
  • 22

3 Answers3

8

Looking more closely at the error message, it looks like you have "held" packages ("E: Unable to correct problems, you have held broken packages").

You can hold packages in Debian, preventing them from being upgraded (e.g. if you're aware of a bug that would cause you problems in a newer version).

You should be able to find which packages are on hold using:

dpkg --get-selections | awk '{if ($2 == "hold") print $0;}'

My guess is that your current sendmail-bin is held back, which apt-get install sendmail wouldn't address, but apt-get install sendmail sendmail-bin would install, upgrade and remove the hold status if necessary.

Bruno
  • 4,099
  • 1
  • 21
  • 37
  • 2
    It is a fresh Wheezy install and there aren't held packages, also I tested on many computers with same behavior – Lluís Jul 09 '13 at 20:36
1

I ran this on a fresh debian wheezy install and it worked fine. Something in your setup is wrong. Did you try to do this first?

apt-get update
apt-get upgrade

When I hit upon such issues doing an upgrade will tell you something is wrong and suggest a fix, such as:

apt-get -f install

Now off to install exim and remove sendmail ;-\

aseq
  • 4,610
  • 1
  • 24
  • 48
  • I tried it again with `vagrant` with a wheezy 64 bits box downloaded from https://github.com/downloads/leapcode/minimal-debian-vagrant/wheezy.box, just after first `vagrant up` I have this problem, same after `apt-get update && apt-get upgrade`, have you tried with 32 or 64 bits? – Lluís Jul 10 '13 at 06:46
  • 1
    I tried again with a fresh Wheezy installation, without `exim4` it doesn't happen – Lluís Jul 10 '13 at 16:37
0

When apt is trying to find a soloution to what you tell it to do it allocates scores to different possibilities. Some actions (like removing packages) are considered "bad" and given negative scores. If the score gets too bad it will bail out.

Unfortunately sometimes it bails out a bit too easily and doesn't end up doing what you want (remove whatever MTA was there before and install sendmail) until you give it more explicit instructions.

Things will go more smoothly if you don't select the "standard system utilities" task during install and you install your MTA of choice before installing stuff that needs a MTA.

Peter Green
  • 4,211
  • 12
  • 30