[SRU] dpkg hook hostname error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
postfix (Debian) |
Fix Released
|
Unknown
|
|||
postfix (Ubuntu) |
Fix Released
|
Undecided
|
Paride Legovini | ||
Bionic |
Fix Released
|
Undecided
|
Paride Legovini | ||
Focal |
Fix Released
|
Undecided
|
Paride Legovini | ||
Hirsute |
Fix Released
|
Undecided
|
Paride Legovini | ||
sbuild (Ubuntu) |
Fix Released
|
Undecided
|
Paride Legovini |
Bug Description
[Impact]
/etc/resolv.conf search domain with a leading dot cause postfix.postinst to fail because it constructs a 'myhostname' with a duplicate dot.
The glibc resolver tolerates such domains and strips the leading dot from the search domain [1]. This change makes postfix.postinst do the same.
This same fix has been proposed for inclusion in Debian [2].
[1] https:/
[2] https:/
[Test Plan]
1. Start an LXD container
2. Edit /etc/resolv.conf and add search line like one of these:
search .
search .foo.bar
domain .foo.bar
3. Install postfix from the archive, accept all the debconf defaults,
and verify that postinst fails with a broken domain name.
4. Purge postfix and install the version to test (e.g. from -proposed).
5. Verify that the installation succeeds.
6. Verify that `myhostname` in /etc/postfix/
Test PPA: https:/
[Where problems could occur]
There is no reasonable case where a user could rely on a "broken" setup, as its result is a postinst failure (= install failure) and an invalid "myhostname" in main.cf.
The regression potential is in my opinion very low and, given the scope and nature of the change, mostly due to the newer Build-Deps the package will be built with.
The postfix service is restarted on upgrades of the postfix package, so problems may also occur on systems with issues (misconfiguration, filled partitions, ...) but where Postfix has not been restarted and it's still working, but won't resume its operations on upgrade. While this is technically a "not a bug in Ubuntu" case it is also something we don't want to expose users to for no good reason.
[Development Fix]
This is fixed already in the current devel release (Impish). This SRU backports the very same fix to the stable releases.
Once [2] or equivalent gets accepted in Debian we'll be able to drop the delta and make postfix.
[Original Description]
I tried to install postfix (3.4.13-0ubuntu1) within a Dockerfile (Ubuntu 20.04.01 LTS) and it failed because there is an error in the dpkg info file.
I'm attaching the log of the 2nd time "apt install -y postfix" is executed, as it is way shorter and still shows the error message.
```
root@cc1a572af0
Reading package lists... Done
Building dependency tree
Reading state information... Done
postfix is already the newest version (3.4.13-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postfix (3.4.13-0ubuntu1) ...
Postfix (main.cf) configuration was untouched. If you need to make changes,
edit /etc/postfix/
configuration values, see postconf(1).
After modifying main.cf, be sure to run 'systemctl reload postfix'.
Running newaliases
newaliases: warning: valid_hostname: misplaced delimiter: cc1a572af0dc..
newaliases: fatal: file /etc/postfix/
dpkg: error processing package postfix (--configure):
installed postfix package post-installation script subprocess returned error exit status 75
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Errors were encountered while processing:
postfix
E: Sub-process /usr/bin/dpkg returned an error code (1)
```
I then looked into the /etc/postfix/
After that I was able to track the issue into the script "/var/lib/
I'd propose to remove this resolve.conf lookup entirely so that the package installation doesn't fail within docker containers...
It is a bad practice in my opinion to overwrite existing config files upon package installation.
Also I'd suggest not executing postfix after the configuration is written, so that in case of unforeseen circumstances (like this one) a user can just simply run a sed against the config file after installing the package.
And the Dockerfile for reference:
```
FROM ubuntu:latest
ENV DEBIAN_
#ENV DEBIAN_PRIORITY=low
RUN apt update \
&& echo "postfix postfix/
&& echo "postfix postfix/mailname string mysubdomain.
&& apt install -y postfix
```
Related branches
- Christian Ehrhardt (community): Approve
- Canonical Server: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 127 lines (+64/-2)6 files modifieddebian/changelog (+36/-0)
debian/control (+2/-1)
debian/patches/postfix-3.6.2-glibc-234-build-fix.patch (+23/-0)
debian/patches/series (+1/-0)
debian/postfix.postinst (+1/-1)
debian/rules (+1/-0)
- Sergio Durigan Junior (community): Approve
- Canonical Server Core Reviewers: Pending requested
-
Diff: 42 lines (+10/-2)3 files modifieddebian/changelog (+7/-0)
debian/control (+2/-1)
debian/postfix.postinst (+1/-1)
- 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)
- Sergio Durigan Junior (community): Approve
- Canonical Server Core Reviewers: Pending requested
-
Diff: 42 lines (+10/-2)3 files modifieddebian/changelog (+7/-0)
debian/control (+2/-1)
debian/postfix.postinst (+1/-1)
- Sergio Durigan Junior (community): Approve
- Canonical Server Core Reviewers: Pending requested
-
Diff: 28 lines (+8/-1)2 files modifieddebian/changelog (+7/-0)
debian/postfix.postinst (+1/-1)
- Canonical Server: Pending requested
-
Diff: 795 lines (+249/-88)32 files modifiedHISTORY (+81/-0)
Makefile.in (+1/-1)
README_FILES/MAILLOG_README (+1/-1)
RELEASE_NOTES (+8/-0)
conf/postfix-tls-script (+1/-1)
debian/changelog (+19/-0)
debian/patches/series (+0/-1)
debian/postfix.postinst (+1/-1)
dev/null (+0/-51)
html/MAILLOG_README.html (+1/-1)
html/postconf.5.html (+1/-1)
html/postfix.1.html (+1/-1)
makedefs (+14/-1)
man/man1/postfix.1 (+1/-1)
man/man5/postconf.5 (+1/-1)
proto/MAILLOG_README.html (+1/-1)
proto/postconf.proto (+1/-1)
src/dns/dns.h (+4/-0)
src/dns/dns_lookup.c (+5/-2)
src/dns/dns_str_resflags.c (+6/-0)
src/global/mail_params.c (+2/-0)
src/global/mail_params.h (+1/-1)
src/global/mail_version.h (+2/-2)
src/milter/milter.c (+5/-5)
src/postfix/postfix.c (+1/-1)
src/smtpd/smtpd_check.c (+8/-8)
src/tls/tls_bio_ops.c (+7/-0)
src/tls/tls_misc.c (+21/-0)
src/tls/tls_session.c (+1/-1)
src/tlsproxy/tlsproxy.c (+26/-4)
src/util/midna_domain.c (+26/-0)
src/util/midna_domain.h (+1/-0)
- Sergio Durigan Junior (community): Approve
- git-ubuntu developers: Pending requested
-
Diff: 42 lines (+10/-2)3 files modifieddebian/changelog (+7/-0)
debian/control (+2/-1)
debian/postfix.postinst (+1/-1)
description: | updated |
description: | updated |
Changed in postfix (Ubuntu): | |
assignee: | nobody → Paride Legovini (paride) |
Changed in postfix (Ubuntu): | |
status: | Confirmed → In Progress |
summary: |
- dpkg hook hostname error + [SRU] dpkg hook hostname error |
description: | updated |
description: | updated |
description: | updated |
Changed in postfix (Ubuntu Bionic): | |
status: | New → In Progress |
assignee: | nobody → Paride Legovini (paride) |
no longer affects: | sbuild (Ubuntu Bionic) |
description: | updated |
description: | updated |
description: | updated |
Changed in postfix (Debian): | |
status: | Unknown → New |
Changed in postfix (Debian): | |
status: | New → Fix Committed |
Changed in postfix (Debian): | |
status: | Fix Committed → Fix Released |
Hi Klaus,
From your log:
newaliases: warning: valid_hostname: misplaced delimiter: cc1a572af0dc..
That comes down to the initial install& configuration requiring a fully qualified domain name.
And your systems seems to have an invalid one for that use case.
There are two paths out of this.
a) fix the hostname to be a correct fully qualified domain name. Then the postinst config will use that and work.
b) when installing postfix you can select interactively to have it set up with "no config" that allows to manually configure it the way you want it and will not trigger the auto-config code that currently is breaking for you
Which way you choose depends on your preference and your control of the environment.
Fqdn's are a defined standard, and if your name would be like one it should work. dpkg/info/ postfix. postinst - check the function myfqdn for that.
Never the less we try to catch and handle some common issues.
It might be worth for your to look at your hostname in general (report your full name here please) and the code that the install runs you can find in /var/lib/
If therein is an issue that could be improved to support your kind of hostname better that might be worth a talk.