From 9a25016bacaf0e9a00fa72a3c93f19632646f1ba Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Mon, 19 Mar 2018 16:23:29 -0700 Subject: [PATCH] When building cloud images oz uses dracut to setup networking and it in turn makes a ifcfg-en file with this config. We don't want to use this, we want to always use ifcfg-eth0 so it's the same on all images. So, we remove ifcfg-en* (They are different on each arch we make cloud images for, but en* gets them all). Additionally we were using some old udev tricks to get eth0, but this is error prone and already incorrect as systemd-udev has moved files around, so instead we just switch to net.ifnames=0 on the boot line, which should continue working. --- fedora-cloud-base.ks | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fedora-cloud-base.ks b/fedora-cloud-base.ks index f54ac52..b7584cb 100644 --- a/fedora-cloud-base.ks +++ b/fedora-cloud-base.ks @@ -35,7 +35,8 @@ rootpw --lock --iscrypted locked firewall --disabled -bootloader --timeout=1 --append="no_timer_check console=tty1 console=ttyS0,115200n8" +# We pass net.ifnames=0 because we always want to use eth0 here on all the cloud images. +bootloader --timeout=1 --append="no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8" network --bootproto=dhcp --device=link --activate --onboot=on services --enabled=sshd,cloud-init,cloud-init-local,cloud-config,cloud-final @@ -170,11 +171,6 @@ NOZEROCONF=yes DEVTIMEOUT=10 EOF -# For cloud images, 'eth0' _is_ the predictable device name, since -# we don't want to be tied to specific virtual (!) hardware -rm -f /etc/udev/rules.d/70* -ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules - # simple eth0 config, again not hard-coded to the build hardware cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF DEVICE="eth0" @@ -245,8 +241,12 @@ dd bs=1M if=/dev/zero of=/var/tmp/zeros || : rm -f /var/tmp/zeros echo "(Don't worry -- that out-of-space error was expected.)" -# For trac ticket https://fedorahosted.org/cloud/ticket/128 -rm -f /etc/sysconfig/network-scripts/ifcfg-ens3 +# When we build the image with oz, dracut is used +# and sets up a ifcfg-en for the device. We don't +# want to use this, we use eth0 so it is always the same. +# So we remove all these ifcfg-en devices so +# The 'network' service can come up cleanly. +rm -f /etc/sysconfig/network-scripts/ifcfg-en* # Enable network service here, as doing it in the services line # fails due to RHBZ #1369794