exim4 cannot be removed, if stopped

Bug #220819 reported by Daniel Hahler
50
This bug affects 3 people
Affects Status Importance Assigned to Milestone
exim4 (Debian)
New
Undecided
Unassigned
exim4 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: exim4

I wanted to replace an installed exim4 on Hardy with Postfix.

After having stopped exim4 already, the postfix installation (or rather removal of exim4) failed as pasted below.

It all boils down to that if killproc returns "3" in stop_exim() this means "process is not running" and the init script should (or rather _must_) not fail.

A patch could be to replace
  killproc -p "$QRPIDFILE" "$DAEMON"
with
  killproc -p "$QRPIDFILE" "$DAEMON" || RVAR=$? && [ $RVAR = 3 ] && true || return $RVAR
, which will return 0/true in case of return value "3", too.

The same applies at least to
  killproc -p "$PIDFILE" "$DAEMON"
in the same file, too.

# apt-get install postfix
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  openssl ssl-cert
Suggested packages:
  ca-certificates openssl-doc postfix-cdb postfix-ldap postfix-mysql postfix-pcre postfix-pgsql
  procmail resolvconf sasl2-bin
The following packages will be REMOVED:
  exim4-base exim4-config exim4-daemon-light
The following NEW packages will be installed:
  openssl postfix ssl-cert
0 upgraded, 3 newly installed, 3 to remove and 2 not upgraded.
Need to get 1557kB of archives.
After this operation, 4096B disk space will be freed.
Do you want to continue [Y/n]?
Get:1 http://archive.ubuntu.com hardy/main openssl 0.9.8g-4ubuntu3 [385kB]
Get:2 http://archive.ubuntu.com hardy/main ssl-cert 1.0.14-0ubuntu2 [11.5kB]
Get:3 http://archive.ubuntu.com hardy/main postfix 2.5.1-2ubuntu1 [1160kB]
Fetched 1557kB in 0s (4614kB/s)
Preconfiguring packages ...
dpkg: exim4-config: dependency problems, but removing anyway as you request:
 exim4-base depends on exim4-config (>= 4.30) | exim4-config-2; however:
  Package exim4-config is to be removed.
  Package exim4-config-2 is not installed.
  Package exim4-config which provides exim4-config-2 is to be removed.
 exim4-base depends on exim4-config (>= 4.30) | exim4-config-2; however:
  Package exim4-config is to be removed.
  Package exim4-config-2 is not installed.
  Package exim4-config which provides exim4-config-2 is to be removed.
(Reading database ... 11746 files and directories currently installed.)
Removing exim4-config ...
dpkg: exim4-daemon-light: dependency problems, but removing anyway as you request:
 mailx depends on exim4 | mail-transport-agent; however:
  Package exim4 is not installed.
  Package mail-transport-agent is not installed.
  Package exim4-daemon-light which provides mail-transport-agent is to be removed.
Removing exim4-daemon-light ...
 * Stopping MTA
/sbin/start-stop-daemon: warning: failed to kill 2806: No such process
invoke-rc.d: initscript exim4, action "stop" failed.
dpkg: error processing exim4-daemon-light (--remove):
 subprocess pre-removal script returned error exit status 3
dpkg: exim4-base: dependency problems, but removing anyway as you request:
 exim4-daemon-light depends on exim4-base (>= 4.69).
Removing exim4-base ...
 * Stopping MTA
/sbin/start-stop-daemon: warning: failed to kill 2806: No such process
invoke-rc.d: initscript exim4, action "stop" failed.
dpkg: error processing exim4-base (--remove):
 subprocess post-removal script returned error exit status 3
Errors were encountered while processing:
 exim4-daemon-light
 exim4-base
E: Sub-process /usr/bin/dpkg returned an error code (1)

Changed in exim4:
status: New → Confirmed
Revision history for this message
Mike Mol (mikemol) wrote :

I've seen this bug as well, though in my case exim4 was refusing to start because it was misconfigured. Since exim4 wasn't started, I couldn't install an mta that I knew how to configure until I fixed exim4's configuration. A vexing situation...

Revision history for this message
Gerv (gerv) wrote :

I just got hit by this. Thank you to Daniel for providing a fix.

I know how annoying this sort of thing is in the Mozilla bug system, but: does Ubuntu have an exim maintainer at all? Six months for a two-line fix with a patch provided? Not too impressive...

Gerv

Revision history for this message
Daniel Hahler (blueyed) wrote :

Triaged.
Milestoning for beta.

I'm not providing a debdiff, since I'm unsure about the method being used: - adding "|| RVAR=$? && [ $RVAR = 3 ] && true || return $RVAR" seems to verbose.
There is probably a better fix for this.

Changed in exim4:
importance: Undecided → Medium
milestone: none → ubuntu-8.10-beta
status: Confirmed → Triaged
Revision history for this message
Daniel Hahler (blueyed) wrote :

This should get forwarded to Debian, but I'm not sure it still exists in the current version (4.69-11 / 4.69-11ubuntu4).

If somebody could verify that the bug still exists in Karmic..

Revision history for this message
Pavel Petrovic (pavel-petrovic) wrote :

I do not know if it is in karmic, but it is still in hardy (for the exim4-heavy-daemon) :(

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Cleaning up old bugs while merging new exim4 into Ubuntu.
While I can't define which version fixed it I can confirm that it is fixed.

The critical line is still in the code - but the handling of the pidfile has changed.
So unless one crashes exim4 in a totally unclean way there is neither /var/run/exim4/eximqr.pid nor /var/run/exim4/exim.pid around which means that the init script skips the critical sections.

Changed in exim4 (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.