From: Anthony PERARD Date: Tue, 3 Oct 2023 16:22:17 +0000 (+0100) Subject: ts-debian-fixup: Fix nic names for bookworm X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=be1e078549755a043a8513bf823ac8fc218754f5;p=osstest.git ts-debian-fixup: Fix nic names for bookworm `xen-create-image` doesn't create image for bookworm with a working network, we need to fix the interface name. For reference, there's a bug report upstream: "UnPredictableNetworkInterfaceNames 'fun' with Bookworm domU: eth0 -> enX0" https://github.com/xen-tools/xen-tools/issues/65 Signed-off-by: Anthony PERARD Acked-by: Roger Pau Monné --- diff --git a/ts-debian-fixup b/ts-debian-fixup index 810b3ab..4cf5f98 100755 --- a/ts-debian-fixup +++ b/ts-debian-fixup @@ -142,6 +142,20 @@ sub filesystems () { END } +sub fix_networking () { + return if debian_guest_suite($gho) !~ m/bookworm/; + + # `xen-create-image` doesn't setup network in a way that work with bookworm. + # The guest boots with "enX0" interface name, but it only try to setup "eth0". + # https://github.com/xen-tools/xen-tools/issues/65 + target_editfile_root($ho, $mountpoint."/etc/network/interfaces", sub { + while (<::EI>) { + s/\beth0\b/enX0/g; + print ::EO or die $!; + } + }); +} + sub unmount () { guest_umount_lv($ho, $gho); } @@ -243,6 +257,7 @@ target_cmd_root($ho, debian_dhcp_rofs_fix($ho, $mountpoint)); console(); randomseed(); filesystems(); +fix_networking(); otherfixupcfg(); writecfg(); unmount();