From b5b2358bdf6f83f2c5690050f7b50ba454e0ceba Mon Sep 17 00:00:00 2001 From: Bilal Ismail <110652537+bilal-ismail@users.noreply.github.com> Date: Wed, 24 Apr 2024 16:06:54 +0000 Subject: [PATCH] network interface state to UP on system boot for kdump --- build_debian.sh | 4 ++++ .../initramfs-tools/network-interface-preboot-init | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 files/initramfs-tools/network-interface-preboot-init diff --git a/build_debian.sh b/build_debian.sh index 8e6d799e8157..d1aada0aa911 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -210,6 +210,10 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net +# Hook into initramfs: Initialize network interfaces on boot, useful for kdump kernel image +sudo cp files/initramfs-tools/network-interface-preboot-init $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/network-interface-preboot-init +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/network-interface-preboot-init + # Hook into initramfs: resize root partition after migration from another NOS to SONiC on Dell switches sudo cp files/initramfs-tools/resize-rootfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/resize-rootfs sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/resize-rootfs diff --git a/files/initramfs-tools/network-interface-preboot-init b/files/initramfs-tools/network-interface-preboot-init new file mode 100644 index 000000000000..15f9718aa1d4 --- /dev/null +++ b/files/initramfs-tools/network-interface-preboot-init @@ -0,0 +1,13 @@ +#!/bin/sh + +# Iterate over all detected network interfaces and configure them to use DHCP +interfaces=$(ip -o link show | awk -F': ' '{print $2}' | grep -E '^e') + +# Bring up each Ethernet interface +for interface in $interfaces; do + ip link set dev $interface up + dhclient $interface +done + +echo("Maigc for kdump: All interfaces have been intialized and DHCP is enabled. Can be verified by command, \"ip addr\"") +ip addr