package: postfix-cdb
version: 3.11.0-4
severity: serious

justification: i think this imust be some kind of policy violation,
and it makes other mta break

Hi,

postfix-cdb's postrm can fail if postfix has been removed first. This
is because postfix-cdb's prerm tries to run
/usr/share/postfix/postinst.functions from postfix, but postfix can
already have been removed in some circumtances: For example, when
postfix is to be replaced by another mta, apt can decide to remove
postfix before postfix-cdb

A minimal reproducer is:

# in a container - will break your system!
apt install -y logcheck postfix # choose no configuration
apt install -y dma # or any other mta



(logcheck can be, i think, any package that depends on
mail-transport-agent: i dont know exactly why, but when such a package
is installed, apt(?) will choose to do the postfix removal before the
postfix-cdb removal  - this happens quite reliably in my tests. i ran
into this testing all mtas for logcheck:
https://salsa.debian.org/rpil2/logcheck/-/jobs/9480217  &
https://salsa.debian.org/rpil2/logcheck/-/tree/test-systemd-mail ---
but I imagine anyone changing mta might hit this).

The errors follow - you can see that postfix is removed before
postfix-cdb is removed, despite the dependencies
I tihnk you could fix this by making postfix-cdb's prerm check for the
postfix.functions file before trying to use it: seems sensible anyway


Removing postfix-lmdb (3.11.0-4) ...
Removing lmdb map entry from /etc/postfix/dynamicmaps.cf
dpkg: postfix: dependency problems, but removing anyway as you requested:
 postfix-cdb depends on postfix (= 3.11.0-4).
 mime-construct depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is to be removed.
 logcheck depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is to be removed.

Removing postfix (3.11.0-4) ...
Selecting previously unselected package dma.
(Reading database ... 17354 files and directories currently installed.)
Preparing to unpack .../archives/dma_0.14-1_amd64.deb ...
Unpacking dma (0.14-1) ...
(Reading database ... 17376 files and directories currently installed.)
Removing postfix-cdb (3.11.0-4) ...
/var/lib/dpkg/info/postfix-cdb.prerm: 3: .: cannot open
/usr/share/postfix/postinst.functions: No such file
dpkg: error processing package postfix-cdb (--remove):
 old postfix-cdb package prerm maintainer script subprocess failed
with exit status 2
dpkg: too many errors, stopping
/var/lib/dpkg/info/postfix-cdb.postinst: 3: .: cannot open
/usr/share/postfix/postinst.functions: No such file
dpkg: error while cleaning up:
 old postfix-cdb package postinst maintainer script subprocess failed
with exit status 2
Errors were encountered while processing:
 postfix-cdb
Processing was halted because there were too many errors.

Reply via email to