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. Amazon Elastic Block Store (Amazon EBS) volumes are exposed as NVMe devices to Nitro-based instances, and the device names are changed. Instead, use a UUID or label to mount the file systems.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.
To migrate an Amazon EC2 Linux Xen instance type, run the AWSSupport-MigrateXenToNitroLinux AWS Systems Manager Automation runbook.
Verify that you turned on enhanced networking and that the ENA driver is installed
- Test whether enhanced networking is activated on your instance.
- If your instance doesn't have the enaSupport attribute, then run the modify-instance-attribute AWS CLI command.
To check whether the ENA driver is installed, run the following command:
sudo modinfo ena |grep -i '^version:' || echo "ENA module not available, try modprobe ena"
If the ENA driver isn't installed then, see Activate enhanced networking on your instance and choose Amazon Linux. For more information about the latest ENA drivers, 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 the /etc/fstab file is using UUIDs or device names for mount points
Run the following command:
cat /etc/fstab |grep -iP 'uuid|dev/'
UUID=90e29211-2de8-4967-b0fb-16f51a6e464c / xfs defaults,noatime 1 1
If a UUID isn't used, 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.
To get the UUID, run the following command:
lsblk -f /dev/nvme0n1p1 |tail -n 1 |awk '{print $4}'
90e29211-2de8-4967-b0fb-16f51a6e464c
Before you edit the /etc/fstab file, it's a best practice to make a copy of the file:
sudo cp /etc/fstab /etc/fstab-`date +%d%m%Y`
Replace the device name in the /etc/fstab file with the UUID:
cat /etc/fstab
/dev/nvme0n1p1 / xfs defaults,noatime 1 1
cat /etc/fstab
UUID=90e29211-2de8-4967-b0fb-16f51a6e464c / xfs defaults,noatime 1 1
After you replaced all the device names with UUIDs, stop your instance, change the instance to one that's built on the AWS Nitro System, and then restart the instance.