🚮 Truncate /etc/resolv.conf from kickstart

During the kickstart of the cloud image, NetworkManager writes an
/etc/resolv.conf that contains `nameserver 192.168.122.1`. This causes
boot delays with cloud-init since it does some early boot DNS
redirection tests before talking to the cloud's metadata service. On
some clouds/architectures, this delay is 15 seconds or more.

Truncate the /etc/resolv.conf so it can be replaced properly by
NetworkManager and cloud-init on the first boot.

Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
Major Hayden 2021-10-14 13:12:43 -05:00
parent 4282a656dd
commit ed9fb2fc19
No known key found for this signature in database
GPG Key ID: 737051E0C1011FB1
1 changed files with 5 additions and 0 deletions

View File

@ -139,6 +139,11 @@ btrfs filesystem sync /
echo "Cleanup leftover networking configuration"
rm -f /etc/NetworkManager/system-connections/*.nmconnection
# Truncate the /etc/resolv.conf left over from NetworkManager during the
# kickstart. This causes delays in boot with cloud-init because the
# 192.168.122.1 DNS server cannot be reached.
truncate -s 0 /etc/resolv.conf
# Clear machine-id on pre generated images
truncate -s 0 /etc/machine-id