From ab62171c49c46fae2b7150ebc9e9d2e0a36843e1 Mon Sep 17 00:00:00 2001 From: Manuel Montecelo Date: Sat, 12 Jun 2021 13:46:44 +0200 Subject: [PATCH] TT#105151 Revert "TT#105151 Stop adding "net.ifnames=0" to grub config" This reverts commit cd50e4934cf4ab80149420d66cbce5191f620d07. In principle this works fine when using /etc/udev/rules.d/70-persistent-net.rules, but it turns out that in the test infrastructure (including {ce,pro,carrier}-trunk.mgm machines and build-matrix) we remove the generated rules in many places: if $VAGRANT; then ... # MACs are different on buildbox and on local VirtualBox # see http://ablecoder.com/b/2012/04/09/vagrant-broken-networking-when-packaging-ubuntu-boxes/ echo "Removing '${TARGET_UDEV_PERSISTENT_NET_RULES}'" rm -f "${TARGET_UDEV_PERSISTENT_NET_RULES:?}" So in this way, the interfaces that we get are ens18 in our infra for {ce,pro,carrier}-trunk.mgm machines, and so the generated /etc/network/interfaces usint the fixed names "eth*" (in process to be renamed "neth*") cannot be found in those systems, and all build-install-vm jobs fail. In a local vagrant machine (ce-trunk from just before the change) we have names like these for the network devices: root@spce:~# dmesg | grep rename [ 2.051263] e1000 0000:00:09.0 enp0s9: renamed from eth1 [ 2.065876] e1000 0000:00:03.0 enp0s3: renamed from eth0 [ 3.950540] e1000 0000:00:03.0 eth0: renamed from enp0s3 [ 4.049842] e1000 0000:00:09.0 eth1: renamed from enp0s9 In this boot session from which the logs above are taken, was booted with grub without "net.ifnames=0", and udev "70-persistent-net.rules" generated in place with the right infromation, and then of course things work fine. So we need some solution this before moving on with the change now reverted. Change-Id: I25d3b9c175b92214670ebb63a7916b60e0e4e5f9 --- templates/scripts/includes/deployment.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index a1690ac..c8c17e4 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -195,6 +195,19 @@ ensure_recent_package_versions() { done } +set_custom_grub_boot_options() { + echo "Adjusting default GRUB boot options (enabling net.ifnames=0)" + sed -i '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" + grml-chroot "${TARGET}" etckeeper commit "/etc/default/grub changes" + fi +} + die() { echo "$@" >&2 set_deploy_status "error" @@ -2220,6 +2233,8 @@ EOT grml-chroot "${TARGET}" /bin/bash /tmp/retrieve_authorized_keys.sh fi +set_custom_grub_boot_options + if "$VAGRANT" ; then echo "Bootoption vagrant present, executing vagrant_configuration." vagrant_configuration