Postfix cannot resolve DNS if network was unavailable when it was started, such as on a laptop
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
postfix (Debian) |
Fix Released
|
Unknown
|
|||
postfix (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Yakkety |
Fix Released
|
High
|
Steve Langasek | ||
Zesty |
Fix Released
|
High
|
Steve Langasek |
Bug Description
[SRU Justification]
Race condition between resolvconf and postfix on startup leaves postfix with a different DNS server configuration in its chroot than is used on the host system, which may cause it to experience DNS resolution errors.
[Test case]
1. Install postfix on a machine or container (not chroot) in the default configuration.
2. Run 'sudo mkdir -p /etc/systemd/
3. Reboot
4. Confirm that /etc/resolv.conf and /var/spool/
5. Install postfix from -proposed
6. Reboot
7. Confirm that /etc/resolv.conf and /var/spool/
8 Run 'sudo rm -f /etc/systemd/
[Regression potential]
Because we are changing the order of service initialization at boot, if there are other packages which have undeclared dependencies on postfix (or generically, on a running SMTP server), these services may now fail a race with postfix startup where they succeeded before. This is highly unlikely, as a hard dependency on an SMTP service is unusual.
Because the postfix service will now depend on network-
[Original report]
Every now and then postfix installed on my laptop stops delivering mails. I detect this problem after wandering about no answers to my emails, or by checking the current mail queue, which should be empty when I am at the office.
I use postfix to deliver all sent mail to the company SMTP server. The local postfix does not receive outside mail.
The mail queue shows errors of the type:
(Host or domain name not found. Name service error for name=XXXXXXXX type=AAAA: Host not found, try again)
When I manually check host name resolution, it works fine. It seems, postfix either does not retry name resolution, or somehow name resolution fails for postfix, but not other programs. Network connectivity is fine when this problem occurs (I read my mail via IMAP w/o local message body cache from the same server used as smart host, use SSH to other hosts, and surf the web -- I never noticed network problems when the postfix mail delivery did not work).
To remedy the situation I can just restart postfix and flush the mail queue. But I need to detect the problem, and postfix should™ recover on its own.
I am using IPv6 privacy extensions (Ubuntu default) in a dual stack IPv4 and IPv6 network. Both local (company) and remote servers are accessible via IPv6, thus I am actively using IPv6 for many connections. I have no idea if this is related to the problem, but the error shows a failure to resolve a quad A record.
Mandatory information:
1)
$ lsb_release -rd
Description: Ubuntu 14.04.3 LTS
Release: 14.04
2)
$ apt-cache policy postfix
postfix:
Installed: 2.11.0-1ubuntu1
Candidate: 2.11.0-1ubuntu1
Version table:
*** 2.11.0-1ubuntu1 0
500 http://
100 /var/lib/
2.11.0-1 0
500 http://
3)
I expected postfix to deliver the queued mail. If there was a (temporary, perhaps very short) network problem, postfix should recover automatically after the problem was resolved.
4)
Postfix stopped delivering mails.
tags: | added: needs-upstream-report |
Changed in postfix (Debian): | |
status: | Unknown → Fix Released |
description: | updated |
Changed in postfix (Ubuntu Yakkety): | |
status: | Triaged → In Progress |
Changed in postfix (Ubuntu Zesty): | |
status: | Triaged → In Progress |
I might have found the reason for this behaviour:
1) Without network connectivity, the file /etc/resolv.conf does not contain any useful information (just two comment lines).
2) After establishing network connectivity, the file /etc/resolv.conf contains 127.0.1.1 and a correct search path as received via DHCP.
3) Postfix copies the file /etc/resolv.conf to /var/spool/ postfix/ etc/resolv. conf upon startup. If postfix is started before the network is up, this file will not allow name resolution. Every other application uses /etc/resolv.conf and works fine.
Perhaps Network-Manager could restart postfix upon connection-up events? Can this be configured?