Edit: For anyone else having this problem, this question was actually very badly asked/understood and a better description of the problem (and the correct solution) can be found here.I'm trying to set up mail on my Raspberry Pi. I've set up and configured Postfix and everything generally works, except at boot it seems that the script /etc/init.d/postfix copies the file /etc/resolv.conf to its chroot before it's actually been updated. This reslults in email sending failing with DNS issues.There's a better write-up of this in this blog post along with a workaround (injecting a sleep 5 in the startup script).I'm curious about how/why this happens (and why it's presumably affecting only the Pi, or few enough people that it hasn't been noticed/fixed) and where the bug actually lies (so I can raise it - is it a postfix issue, or something on the Pi not behaving as expected?).The /etc/init.d/postfix file has this at the top (says it relies on network; not sure if that means it shouldn't start prior to resolveconf being done?)# Provides:          postfix mail-transport-agent# Required-Start:    $local_fs $remote_fs $syslog $named $network $time# Required-Stop:     $local_fs $remote_fs $syslog $named $network# Should-Start:      postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot# Should-Stop:       postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: Postfix Mail Transport Agent# Description:       postfix is a Mail Transport agentWhat is the intended mechanism for ensuring this doesn't happen?
Why does postfix copy /etc/resolv.conf to its chroot too early, causing DNS failures?
dns;raspberry pi;postfix;init.d
The problem is happening because of precedences. postfix startup seems to be finishing the job earlier than dhcpcd5.One possible solution to fix the /etc/resolv.conf in the postfix jail after the DHCP client does the work. I suggest using dhclient and placing a script to fix the /etc/resolv.conf in the directory /etc/dhcp/dhclient-exit-hooks.d.The scripts placed in this directory are executed after an IP is obtained by dhcp and those scripts are very useful to take measures needed after getting and/or changing an IP address.I actually have a question talking about the theme here: Better method for acting on IP address change from the ISP?The relevant package in Debian system is isc-dhcp-client, and if not installed, it can be installed doing:sudo apt-get install isc-dhcp-clientNow  /etc/network/interfaces has to be modified to use it:auto eth0iface eth0and finally:sudo dpkg --purge dhcpcd5Actually, after uninstalling dhcpcd5 (and configuring /etc/network/interfaces together with @Danny), the precedences were enforced,and the postfix problem was solved. Nevertheless, with machines directly connected to ISPes and permanently on, the script in dhclient-exit-hooks.d is also advised as the ISP can cause a change in your IP address.