How do I check if my Amazon Elastic Compute Cloud (Amazon EC2) instance running Linux booted using UEFI or legacy BIOS?
Short description
Unified Extensible Firmware Interface (UEFI) is a firmware specification developed to replace the legacy BIOS firmware. The UEFI firmware runs special EFI binary files that have the .efi extension to load the boot loader or operating system. EC2 instances traditionally boot using the legacy BIOS mode. However, ARM-based EC2 instances (a1, c6g, m6g, and r6g) boot using the newer UEFI firmware.
For more information on UEFI, see Unified Extensible Firmware Interface Forum on the uefi.org website.
Resolution
1. Connect to your EC2 Linux instance using SSH.
2. Run the following command to verify the existence of the /sys/firmware/efi directory. This directory exists only if the instance boots using UEFI. The command returns Legacy BIOS Boot Detected if this directory doesn't exist.
# [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"
Example output from an m6g instance:
# [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"
UEFI Boot Detected
Example output from a non-ARM instance, for example, t2/t3/m4/m5 instances:
# [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"
Legacy BIOS Boot Detected
3. Run the following command to verify that EFI appears in the dmesg output:
# dmesg | grep -i "EFI"
Example output:
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: EFI v2.70 by EDK II