Nasty mess installing sendmail

Avi Greenbury lists at
Wed Sep 28 08:52:24 UTC 2011

Harry Putnam wrote:

> Do to unbridled personal bungling, I've created a nasty mess while
> installing sendmail.

Well, you're using sendmail, of course you're going to end up with a
mess :)

> I inadvertantly deleted /etc/init.d/sendmail.  Well I thought I'd just
> reinstall sendmail to re-aquire that file.

The easier way to do this in future is to retrieve the package, unpack
it and extract that file from it. There's several howtos on extracting
deb packages on the net, which you'll find once you know that's what
you're looking for :)

> ,----
> | /etc/mail/aliases: 4 aliases, longest 10 bytes, 66 bytes total
> | invoke-rc.d: unknown initscript, /etc/init.d/sendmail not found.
> | dpkg: error processing sendmail-bin (--configure):
> | 
> |  subprocess installed post-installation script returned error exit
> |  status 100
> | 
> | Errors were encountered while processing:
> |  sendmail-bin
> | E: Sub-process /usr/bin/dpkg returned an error code (1)
> `----

This is telling you that the post-install script failed when called
with --configure. This needs to succeed (i.e. exit with a status of 0)
in order for dpkg to continue.

My guess is that the postinstall script is trying to

/etc/init.d/sendmail stop

to make sure it's stopped, or perhaps start it (i'm not sure precisely
what you've asked apt to do by now :) ). The quickest way to make dpkg
happy is to edit the postinst script such that thinks it's succeeded,
probably by commenting out that bit of it.

The postinstall script will be at:


And you need to poke through that to find where it's trying to
call /etc/init.d/sendmail and make it not do that. Obviously, you
should be sure that it doesn't need to do whatever it's trying to do
(start or stop sendmail) first. 

If it's trying to start, then that's generally mostly pointless, so you
should be fine to just comment out the line. If it's trying to stop it,
then you want to make sure it genuinely is stopped before telling dpkg
that it's installed.

That done, you've a configured-but-broken sendmail. You should then be
able to finish removing the package, and go on to install it. Before
reinstalling it, do 

apt-get clean

to get rid of your modified postinst file, so the new, proper one is
installed instead. It's worth remembering that editing postist (and
other package) scripts is also a rather efficient way to break things,
but most of repairs are. 


More information about the ubuntu-users mailing list