diff mbox series

[OSSTEST,27/36] ts-debian-fixup: Fix nic names for bookworm

Message ID 20240318165545.3898-28-anthony.perard@citrix.com (mailing list archive)
State New
Headers show
Series Switch to Debian Bookworm | expand

Commit Message

Anthony PERARD March 18, 2024, 4:55 p.m. UTC
`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 <anthony.perard@citrix.com>
---
 ts-debian-fixup | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/ts-debian-fixup b/ts-debian-fixup
index 810b3aba..4cf5f980 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();