I changed my Amazon Elastic Compute Cloud (Amazon EC2) Linux instance to a Nitro-based instance, and now it doesn't boot.
Short description
A Linux instance might not boot after you change it to a Nitro-based instance because of the following reasons:
- You didn't activate the enhanced networking enaSupport attribute on the instance.
- You didn't install the Elastic Network Adapter (ENA) driver on the instance.
- You didn't install the NVMe driver on the instance. Or, you didn't load the NVMe module in the initramfs image of the instance.
- You used a device name to mount the file systems in the /etc/fstab file at boot instead of a unique universal identifier (UUID) or label.
Note: Amazon Elastic Block Store (Amazon EBS) volumes appear as NVMe devices to Nitro-based instances. This changes the device names.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
Automatically check prerequisites before you migrate
To automatically check your prerequisites when you migrate a Xen instance to Nitro, run the AWSSupport-MigrateXenToNitroLinux AWS Systems Manager Automation runbook.
Or, run the nitro_check_script.sh script to check prerequisites before you change the instance type to Nitro. To access the script, see nitro_check_script.sh on the GitHub website. For information about what the script checks, see NitroInstanceChecks on the GitHub website.
To download the nitro_check_script.sh script, run the following command:
sudo wget https://raw.githubusercontent.com/awslabs/aws-support-tools/refs/heads/master/EC2/NitroInstanceChecks/nitro_check_script.sh -O /tmp/nitro_check_script.sh
To give your environment permission to run the script, run the following command:
sudo chmod +x /tmp/nitro_check_script.sh
To run the script with root permissions, run the following command:
sudo bash /tmp/nitro_check_script.sh
Note: You must run the script as a root user or with sudo. Otherwise, you receive the "This script must be run as root" error message.
To manually check prerequisites, take the following actions.
Verify that you activated enhanced networking and installed the ENA driver
Test whether you activated enhanced networking on your instance. If your instance doesn't have the enaSupport attribute, then activate enhanced networking.
To check whether you installed the ENA driver, run the following command:
sudo modinfo ena |grep -i '^version:' || echo "ENA module not available, try modprobe ena"
If you didn't install the ENA driver, then install the ENA driver for your EC2 Windows instance. To install the ENA driver for a Linux instance, see Linux kernel driver for Elastic Network Adapter (ENA) family on the GitHub website.
Install the NVMe driver
To access NVMe volumes, you must install the NVMe drivers.
Check whether you used a device name for mount points in the /etc/fstab file
To check whether you used a UUID, run the following command:
cat /etc/fstab |grep -iP 'uuid|dev/'
Example output:
UUID=90e29211-2de8-4967-b0fb-16f51a6e464c / xfs defaults,noatime 1 1
If you didn't use a UUID, then run the following command to retrieve the UUID for the device name:
lsblk -f device_name |tail -n 1 |awk '{print $4}'
Note: Replace device_name with your device name.
Example output:
90e29211-2de8-4967-b0fb-16f51a6e464c
Before you edit the /etc/fstab file, it's a best practice to run the following command to make a copy of the file:
sudo cp /etc/fstab /etc/fstab-`date +%d%m%Y`
Run the following command to open the /etc/fstab file:
cat /etc/fstab
Then, replace the device name with the UUID:
/dev/nvme0n1p1 / xfs defaults,noatime 1 1
Note: Replace /dev/nvme0n1p1 with the UUID.
To verify that you correctly updated the file, rerun the cat /etc/fstab command. Example output:
UUID=90e29211-2de8-4967-b0fb-16f51a6e464c / xfs defaults,noatime 1 1
Make sure to replace all the device names with UUIDs. Then, stop your instance. Change the instance to a Nitro-based instance, and then start the instance.