How to fix cannot boot when change EC2 instance type from Xen to Nitro for SUSE Linux Enterprise for SAP 15

How to fix cannot boot when change EC2 instance type from Xen to Nitro for SUSE Linux Enterprise for SAP 15

1.Run the NitroInstanceChecks script https://repost.aws/knowledge-center/boot-error-linux-nitro-instance

2. After the NitroInstanceScript runs and you make necessary updates, verify that the DRIVERS entry in /etc/udev/rules.d/70-persistent-net.rules is set to ? or ENA. Use a text editor to access the file. The following example uses the vim editor.

sudo vim /etc/udev/rules.d/70-persistent-net.rules

The correct entry appears as follows:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:23:45:67:89:ab", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0

3.  Changing from Xen to Nitro instance types required to have the "nvme" and "ena" devices installed in order for the system to boot correctly. It's not enough the kernel has the module but also they be present in the initramfs file too, so it's needed to added the missing drivers if they are not included. Steps to fix this issue:

(a) Confirm that both "nvme" and "ena" modules are included in the initramfs:

sudo lsinitrd | grep -iE "ena|nvme"

(b) If they are missing rebuild the initramfs file with below steps: + Create the file "/etc/dracut.conf.d/aws.conf" if it missing

sudo touch /etc/dracut.conf.d/aws.conf

Add the "hostonly=no" config option in the file to force create a generic initramfs including all the required drivers and don't see any issues regarding missing drivers.

sudo echo 'hostonly="no"' > /etc/dracut.conf.d/aws.conf

Rebuild the file using the dracut tool

sudo dracut -f

(c) Confirm one more time that drivers/modules are included this time

sudo lsinitrd | grep -iE "ena|nvme"

4. In the /etc/udev/rules.d directory, there is a udev rule file ending with "-persistent-net.rules". Usually this file will be prepended with a number (such as 70) which defines the order in which udev rules are processed. Delete the file, and when the instance is started again, the file will be generated from scratch and the network interface will not be renamed to eth1 [1].

sudo rm -vf /etc/udev/rules.d/70-persistent-net.rules
sudo reboot

If you also see the following message in the console log and the ENI is attached as eth0, then you'll need to check the /etc/sysconfig/network-scripts (or the OS equivalent) to make sure that your network configuration scripts are named correctly ie. ifcfg-eth0 rather than ifcfg-eth1, and the DEVICE and NAME parameters match the device name (eth0). Bringing up interface eth1: Determining IP information for eth1... done. An example is shown below of what it's supposed to look like

sudo cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0

output:

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet

4. Change the instance type