How do I check if my EC2 instance running Linux booted using UEFI or legacy BIOS?

2 minute read

I want to check if my Amazon Elastic Compute Cloud (Amazon EC2) Linux instance booted from UEFI or legacy BIOS.

Short description

Unified Extensible Firmware Interface (UEFI) is a firmware specification. It's a newer replacement for 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 with the legacy BIOS mode. However, ARM-based EC2 instances (a1, c6g, m6g, and r6g) boot with the newer UEFI firmware.

For more information on UEFI, see Unified Extensible Firmware Interface Forum on the UEFI website.


  1. Use SSH to connect to your EC2 Linux instance.

  2. To verify the existence of the /sys/firmware/efi directory, run the following command. This directory exists only if the instance boots using UEFI. If this directory doesn't exist, then the command returns Legacy BIOS Boot Detected:

    # [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"

    Here's an example output from an m6g instance:

    # [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"
    UEFI Boot Detected

    Here's an example of the output from a non-ARM instance, such as t2, t3, m4, and m5 instances:

    # [ -d /sys/firmware/efi ] && echo "UEFI Boot Detected" || echo "Legacy BIOS Boot Detected"
    Legacy BIOS Boot Detected
  3. Verify that EFI appears in the dmesg output:

    # dmesg | grep -i "EFI"

    Here's an example of the output:

    [    0.000000] efi: Getting EFI parameters from FDT:
    [    0.000000] efi: EFI v2.70 by EDK II
AWS OFFICIALUpdated 6 months ago