From d539011b8d8051c07fec7133564b4e3f2a4cacb3 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 2 Mar 2017 17:02:01 +0100 Subject: [PATCH] TT#12206 Set custom boot option "net.ifnames=0" in GRUB in Vagrant boxes We need to disable consistent network device naming to get our "eth0" back, otherwise we have "random" interface names (which are stable across reboots in the same environment, but aren't really predictable by their names). See https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ for more information. Until we've full support for the new interface names let's disable this feature in our Vagrant environments. Change-Id: I0f141e585456d64ee7eba7b7e78af938be26bfc2 --- deployment.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/deployment.sh b/deployment.sh index b25b17e..553ddad 100755 --- a/deployment.sh +++ b/deployment.sh @@ -262,6 +262,19 @@ install_vbox_iso() { echo "${vbox_checksum} ${vbox_isofile}" | sha256sum --check || die "Error: failed to compute checksum for Virtualbox ISO. Exiting." } +set_custom_grub_boot_options() { + echo "Adjusting default GRUB boot options (enabling net.ifnames=0)" + sed -ie 's/^GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 net.ifnames=0"/' "${TARGET}/etc/default/grub" + + echo "Invoking update-grub" + grml-chroot $TARGET update-grub + + if [ -d "${TARGET}/etc/.git" ]; then + echo "Commit /etc/default/grub changes using etckeeper" + chroot "$TARGET" etckeeper commit "/etc/default/grub changes" + fi +} + ensure_augtool_present() { if [ -x /usr/bin/augtool ] ; then echo "/usr/bin/augtool is present, nothing to do" @@ -1774,6 +1787,12 @@ EOT fi +case "$DEBIAN_RELEASE" in + stretch) + set_custom_grub_boot_options + ;; +esac + if "$CARRIER_EDITION" ; then echo "Nothing to do on Carrier, /etc/network/interfaces was already set up." elif ! "$NGCP_INSTALLER" ; then