postfix-mysql package upgrade results in server configuration error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
postfix (Debian) |
Fix Released
|
Unknown
|
|||
postfix (Ubuntu) |
Fix Released
|
Medium
|
Karl Stenerud | ||
Bionic |
Fix Released
|
Undecided
|
Andreas Hasenack |
Bug Description
[Impact]
If a user's /etc/postfix/
[Test Case]
Install the previous postfix and postfix-mysql:
# apt install -y postfix=3.3.0-1 postfix-
* Install type: Local Only
* System mail name: anything
Clear the alias settings in /etc/postfix/
# sed -i 's/\(alias_.* =\).*/\1/g' /etc/postfix/
# service postfix reload
# apt upgrade -y
You'll get the following error:
Adding mysql map entry to /etc/postfix/
/var/
[Regression Potential]
The fix only affects the package installation scripts.
[Original Description]
I wanted to upgrade my bionic system. Some postfix related packages has been upgraded:
# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
base-files postfix postfix-ldap postfix-mysql postfix-pcre
python3-
7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
# ls /var/cache/
/var/cache/
/var/cache/
After the installation, I saw this error message:
Setting up postfix-mysql (3.3.0-1ubuntu0.1) ...
Adding mysql map entry to /etc/postfix/
/var/lib/
But anyway, installation seemed to be succeeded. However, I noticed, that according to my mail logs, all mysql based postfix tables does not work at all with "unsupported map type". Just noticed, that even with ldap tables, not only mysql tables ...
restarting postfix seems to cured the problem, but I think, it shouldn't work this way ...
What I found: in /var/lib/
configure)
addmap mysql
if [ $(postconf |grep alias_database | awk '{print $3}'|awk -F \: \
'{print $1}') = 'mysql' ]; then
fi
;;
I guess, the problem is the following: I have the main.cf with empty alias_database directive, since I don't use aliases at all, so in main.cf, I have:
# grep ^alias /etc/postfix/
alias_maps =
alias_database =
# postconf |grep alias_database
alias_database =
# postconf |grep alias_database | awk '{print $3}'|awk -F \: '{print $1}'
#
So you see, because of my config, I get empty string ... And it seems the postinst script is not prepared to have this, as the empty string is represented in the script this way then:
if [ = 'mysql' ]; then
So it is understandable now, that I get this error:
/var/lib/
Because of the postinst script runs with "set -e", this error is "fatal". Surely, I guess the same issue happens with postfix-ldap package as well, I guess, maybe with others, I am not sure (postfix-pcre, etc?).
I think, this should be fixed, since it can break things for everyone using empty value for alias_database directive in main.cf
Though I am still not sure, why postfix thought these are unsupported map types after the upgrade, and postfix restart cured the problem, shouldn't the upgrade restart postfix anyway?
As a workaround, I put an empty hash map file into main.cf for with option, now there is no error message in postinst script, but still, it's a strange situation ...
Also, the logic in the script to "extract" table type is a bit complicated I guess, I would use something like this:
if [ "$(postconf -h alias_database | cut -f1 -d:)" = "mysql" ]; then
....
Maybe there are better solutions than mine above, still, it's just a quick idea (rather than multiple awk's and a grep) ....
Thanks for your attention.
Related branches
- Canonical Server: Pending requested
-
Diff: 225 lines (+86/-16)12 files modifieddebian/changelog (+29/-0)
debian/control (+2/-1)
debian/patches/fix-postconf-segfault.diff (+26/-0)
debian/patches/fix_tls_deploy-server-cert.patch (+19/-0)
debian/patches/series (+2/-0)
debian/postfix-cdb.postinst (+1/-2)
debian/postfix-ldap.postinst (+1/-2)
debian/postfix-lmdb.postinst (+1/-2)
debian/postfix-mysql.postinst (+1/-2)
debian/postfix-pcre.postinst (+1/-2)
debian/postfix-pgsql.postinst (+1/-2)
debian/postfix.postinst (+2/-3)
- Christian Ehrhardt (community): Approve
- Canonical Server: Pending requested
-
Diff: 114 lines (+15/-14)8 files modifieddebian/changelog (+8/-0)
debian/postfix-cdb.postinst (+1/-2)
debian/postfix-ldap.postinst (+1/-2)
debian/postfix-lmdb.postinst (+1/-2)
debian/postfix-mysql.postinst (+1/-2)
debian/postfix-pcre.postinst (+1/-2)
debian/postfix-pgsql.postinst (+1/-2)
debian/postfix.postinst (+1/-2)
- Andreas Hasenack: Approve
- Canonical Server: Pending requested
- Canonical Server Core Reviewers: Pending requested
-
Diff: 113 lines (+14/-14)8 files modifieddebian/changelog (+7/-0)
debian/postfix-cdb.postinst (+1/-2)
debian/postfix-ldap.postinst (+1/-2)
debian/postfix-lmdb.postinst (+1/-2)
debian/postfix-mysql.postinst (+1/-2)
debian/postfix-pcre.postinst (+1/-2)
debian/postfix-pgsql.postinst (+1/-2)
debian/postfix.postinst (+1/-2)
description: | updated |
Changed in postfix (Ubuntu): | |
assignee: | nobody → Karl Stenerud (kstenerud) |
status: | Triaged → In Progress |
Changed in postfix (Debian): | |
status: | Unknown → New |
Changed in postfix (Ubuntu Bionic): | |
assignee: | Karl Stenerud (kstenerud) → Andreas Hasenack (ahasenack) |
status: | New → In Progress |
Changed in postfix (Debian): | |
status: | New → Fix Released |
Btw, maybe an even better solution for that "if":
if postconf -h alias_database | grep -q '^mysql:' ; then