After much debugging, I've discovered that there are 7 seconds between /etc/resolv.conf being cleared and re-written at boot. Postfix is starting up in between!
Here's what seems to be happening at boot:
- Contents of /etc/resolv.conf are correct from previous boot
- "/sbin/resolvconf -d eth0 -f" gets executed, clearing out /etc/resolv.conf
- Postfix starts, and copies /etc/resolv.conf into its chroot
- "/sbin/resolvconf2 -a eth0" gets executed, adding the nameserver to /etc/resolve.conf
Postfix's init.d script has $network and $named in its dependencies, I don't know whether this considers DHCP or not?
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
So; I have two questions really:
- What is not behaving correctly here? I can't imagine that this sort of race condition is normal, so I presume something isn't working correctly which is allowing the services to start up before they should; or the if-up.d scripts are running too early (before DHCP is finished)?
- What is the best way to fix it? I'm trying to make as few changes to the system as possible (and I'm scripting it all, so I can rebuild the Pi easily). I guess putting a fixed IP in would fix it, though I'd rather stick with the routers DHCP reservations if possible.