How to See If Linux Is Legacy or Eufi

How to See If Linux Is Legacy or Eufi

Wondering whether your Linux system boots in Legacy (BIOS) or UEFI mode? This guide walks you through easy, reliable methods to check your firmware type using built-in Linux commands and tools. You’ll learn how to verify your boot mode in minutes—no reboot required.

Key Takeaways

  • Check /sys/firmware/efi: If this directory exists, your system is running in UEFI mode; if not, it’s likely Legacy BIOS.
  • Use the efibootmgr command: Running this tool confirms UEFI support and shows boot entries—only works on UEFI systems.
  • Inspect dmesg logs: Search boot messages for “EFI” or “BIOS” to determine firmware type during startup.
  • Look at /dev/sda partitions: GPT partitioning often indicates UEFI, while MBR suggests Legacy BIOS (but not always).
  • Verify with systemd-detect-virt or dmidecode: These tools provide hardware and firmware details, including UEFI/BIOS detection.
  • No reboot needed: All checks can be done live from your terminal without restarting your machine.
  • Knowing your mode matters: It affects bootloader installation, disk partitioning, and OS compatibility—especially during dual-boot setups.

How to See If Linux Is Legacy or UEFI

If you’re managing a Linux system—whether for personal use, development, or server administration—you may need to know whether your machine is booting in Legacy BIOS mode or UEFI mode. This distinction isn’t just technical jargon; it affects how your operating system loads, how disks are partitioned, and even how you install or repair bootloaders like GRUB.

Many modern systems come with UEFI firmware, which offers faster boot times, support for larger hard drives, and enhanced security features like Secure Boot. Older machines, however, still rely on the traditional BIOS (often called “Legacy” mode). Knowing which one your Linux system uses is essential—especially if you’re troubleshooting boot issues, setting up dual-boot with Windows, or installing Linux on a new machine.

The good news? You don’t need to reboot or enter your firmware settings to find out. Linux provides several built-in tools and file system clues that let you check your boot mode instantly from the terminal.

In this guide, we’ll walk you through multiple reliable methods to determine whether your Linux system is running in Legacy BIOS or UEFI mode. Each method is simple, safe, and requires only basic command-line knowledge. By the end, you’ll be able to confidently identify your firmware type and understand why it matters.

Method 1: Check for the /sys/firmware/efi Directory

How to See If Linux Is Legacy or Eufi

Visual guide about How to See If Linux Is Legacy or Eufi

Image source: airoserver.com

The easiest and most reliable way to check if your Linux system is using UEFI is to look for the presence of the /sys/firmware/efi directory.

This virtual directory is created by the Linux kernel only when the system boots in UEFI mode. If it exists, your system is using UEFI. If it doesn’t, you’re likely running in Legacy BIOS mode.

Step-by-Step Instructions

  1. Open your terminal. You can usually do this by pressing Ctrl + Alt + T or searching for “Terminal” in your application menu.
  2. Type the following command and press Enter:
    ls /sys/firmware/efi
  3. If the directory exists, you’ll see a list of files and subdirectories related to UEFI, such as efivars, fw_platform_size, and runtime.
  4. If the directory does not exist, you’ll get an error like:
    ls: cannot access '/sys/firmware/efi': No such file or directory

    This means your system is not using UEFI—it’s likely booting in Legacy BIOS mode.

Example Output

On a UEFI system:

$ ls /sys/firmware/efi
config_table  efivars  fw_platform_size  runtime  systab  vendor

On a Legacy BIOS system:

$ ls /sys/firmware/efi
ls: cannot access '/sys/firmware/efi': No such file or directory

Why This Works

The /sys filesystem is a virtual interface that exposes kernel and hardware information. When the kernel detects UEFI firmware during boot, it populates /sys/firmware/efi with relevant data. This makes it a direct and trustworthy indicator of UEFI mode.

Pro Tip

You can also use a simple conditional check in a script or one-liner:

if [ -d /sys/firmware/efi ]; then echo "UEFI"; else echo "Legacy BIOS"; fi

This is especially useful if you’re writing automation scripts or need to check multiple systems.

Method 2: Use the efibootmgr Command

Another powerful tool for detecting UEFI is the efibootmgr command. This utility manages UEFI boot entries and only works on systems that support UEFI.

If efibootmgr runs successfully and shows boot entries, your system is definitely using UEFI. If it returns an error saying the EFI variables are not supported, you’re on a Legacy BIOS system.

Step-by-Step Instructions

  1. Open your terminal.
  2. Type the following command:
    efibootmgr
  3. Press Enter.

Interpreting the Output

On a UEFI system, you’ll see output like this:

$ efibootmgr
BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0001,0000,0002
Boot0000* ubuntu
Boot0001* Windows Boot Manager
Boot0002* UEFI: USB Drive

This shows active boot entries managed by UEFI firmware.

On a Legacy BIOS system, you’ll get an error:

$ efibootmgr
EFI variables are not supported on this system.

Installing efibootmgr (If Not Available)

On some minimal Linux installations, efibootmgr might not be installed by default. You can install it using your package manager:

On Debian/Ubuntu:

sudo apt install efibootmgr

On Fedora/RHEL/CentOS:

sudo dnf install efibootmgr

On Arch Linux:

sudo pacman -S efibootmgr

Pro Tip

Even if efibootmgr is installed, it will fail on non-UEFI systems. So the error message itself is a confirmation that you’re not using UEFI.

Method 3: Check dmesg Boot Logs

The dmesg command displays kernel ring buffer messages, including those from early boot. These logs often contain clear indicators of whether the system started in UEFI or Legacy mode.

Step-by-Step Instructions

  1. Open your terminal.
  2. Run the following command to search for UEFI-related messages:
    dmesg | grep -i efi
  3. Look for lines containing “EFI” or “UEFI.”

Example Output on UEFI System

[    0.000000] EFI: EFI v2.70 by American Megatrends
[    0.000000] EFI: ACPI 2.0=0x8af00000  SMBIOS=0x8b0f0000  SMBIOS 3.0=0x8b0f0018 
[    0.000000] EFI: Boot Services terminated
[    0.000000] EFI: Runtime Services active

These messages confirm UEFI firmware is present and active.

Checking for BIOS Indicators

To check for Legacy BIOS, search for BIOS-related messages:

dmesg | grep -i bios

On a Legacy system, you might see:

[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved

These “BIOS-e820” entries are classic signs of a Legacy BIOS system.

Pro Tip

Use dmesg | grep -i "efi\|bios" to search for both terms at once and compare results.

Method 4: Examine Disk Partition Table

While not 100% definitive, the type of partition table on your main disk can give you a strong clue about your boot mode.

– UEFI systems typically use **GPT** (GUID Partition Table).
– Legacy BIOS systems usually use **MBR** (Master Boot Record).

However, note that GPT can also be used with Legacy BIOS (though rarely), and MBR can technically support UEFI in rare cases. So this method is best used in combination with others.

Step-by-Step Instructions

  1. Open your terminal.
  2. Run the following command to list your disk partitions:
    sudo fdisk -l /dev/sda

    Replace /dev/sda with your actual boot disk (e.g., /dev/nvme0n1 for NVMe drives).

  3. Look at the “Disk label type” line in the output.

Example Output

On a UEFI system with GPT:

Disk label type: gpt
Disk identifier: 12345678-1234-1234-1234-1234567890AB

On a Legacy BIOS system with MBR:

Disk label type: dos
Disk identifier: 0x12345678

Note: “dos” here refers to the MBR partition scheme.

Alternative: Use lsblk

You can also use lsblk to get a quick overview:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,PARTTYPE

Look for partitions with PARTTYPE starting with c12a7328-f81f-11d2-ba4b-00a0c93ec93b—this is the EFI System Partition (ESP), a strong sign of UEFI.

Pro Tip

If you see a small (100–500 MB) FAT32 partition mounted at /boot/efi, that’s the EFI System Partition—another clear indicator of UEFI.

Method 5: Use dmidecode to Check Firmware Type

The dmidecode command reads hardware information from the system’s DMI (Desktop Management Interface) table, including firmware details.

Step-by-Step Instructions

  1. Open your terminal.
  2. Run:
    sudo dmidecode -t bios
  3. Look for the “BIOS Information” section.

Example Output

On a UEFI system:

BIOS Information
    Vendor: American Megatrends Inc.
    Version: 2.15.1236
    Release Date: 06/15/2022
    Address: 0xF0000
    Runtime Size: 64 kB
    ROM Size: 16 MB
    Characteristics:
        PCI is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        Boot from CD is supported
        Selectable boot is supported
        BIOS ROM is socketed
        EDD is supported
        5.25"/1.2 MB floppy services are supported (int 13h)
        3.5"/720 kB floppy services are supported (int 13h)
        Print screen service is supported (int 5h)
        8042 keyboard services are supported (int 9h)
        Serial services are supported (int 14h)
        Printer services are supported (int 17h)
        CGA/mono video services are supported (int 10h)
        ACPI is supported
        USB legacy is supported
        BIOS boot specification is supported
        Function key-initiated network boot is supported
        Targeted content distribution is supported
        UEFI is supported

The key line here is: UEFI is supported.

On a Legacy BIOS system, this line will be absent.

Pro Tip

Even if UEFI is supported, it doesn’t guarantee the system is *currently* booted in UEFI mode. Always cross-check with /sys/firmware/efi or efibootmgr.

Method 6: Use systemd-detect-virt (For Virtual Machines)

If you’re running Linux in a virtual machine, the firmware type might be emulated. The systemd-detect-virt tool can help identify the virtualization environment, which often correlates with firmware type.

Step-by-Step Instructions

  1. Open your terminal.
  2. Run:
    systemd-detect-virt
  3. Check the output.

Example Output

On a KVM VM with UEFI:

kvm

On VMware or VirtualBox, it may show:

vmware

or

oracle

Most modern hypervisors support UEFI, but some default to Legacy BIOS. Combine this with other checks for accuracy.

Pro Tip

Use systemd-detect-virt --vm to specifically detect virtualization.

Troubleshooting Common Issues

Issue: Multiple Methods Give Conflicting Results

Sometimes, you might see mixed signals—for example, /sys/firmware/efi exists, but efibootmgr fails. This can happen if:

– The system was installed in UEFI mode but is now booted in Legacy mode (or vice versa).
– Secure Boot or firmware settings were changed after installation.
– The EFI variables are not accessible due to permissions or kernel issues.

Solution: Reboot and enter your firmware settings (usually by pressing F2, F12, DEL, or ESC during startup). Check the boot mode setting and ensure consistency.

Issue: No /boot/efi Mount Point

Even on UEFI systems, the EFI System Partition (ESP) might not be mounted at /boot/efi by default.

Solution: Check if the partition exists using lsblk or fdisk, then mount it manually:

sudo mount /dev/sda1 /boot/efi

(Replace /dev/sda1 with your actual ESP.)

Issue: efibootmgr Not Found

If efibootmgr is not installed, install it using your package manager as shown earlier.

Issue: Dual-Boot Confusion

If you dual-boot Linux and Windows, Windows might have been installed in UEFI mode while Linux was installed in Legacy mode (or vice versa). This can cause boot issues.

Solution: Use a boot repair tool like boot-repair (available in Ubuntu-based systems) or reinstall the bootloader in the correct mode.

Why Knowing Your Boot Mode Matters

Understanding whether your Linux system uses Legacy BIOS or UEFI isn’t just a technical curiosity—it has real-world implications:

Bootloader Installation: GRUB must be installed differently for UEFI vs. Legacy. UEFI requires an EFI System Partition and specific installation commands.
Disk Partitioning: GPT is recommended for UEFI; MBR for Legacy. Mixing them can cause boot failures.
Secure Boot: Only available in UEFI mode. Some Linux distributions support it; others require disabling it.
Dual-Boot Compatibility: Windows typically requires UEFI for modern versions. Installing Linux in Legacy mode alongside UEFI Windows can cause conflicts.
System Recovery: Knowing your mode helps when using live USBs or recovery tools, which must match your firmware type.

Conclusion

Determining whether your Linux system is running in Legacy BIOS or UEFI mode is simple—and essential. With the methods outlined in this guide, you can quickly and accurately identify your firmware type using built-in Linux tools.

Start with checking /sys/firmware/efi—it’s the fastest and most reliable method. Then, use efibootmgr, dmesg, or dmidecode to confirm. Combine these with disk partition analysis for a complete picture.

Remember: no reboot is needed. All checks can be done live from your terminal. And knowing your boot mode empowers you to install, troubleshoot, and manage your Linux system with confidence.

Whether you’re setting up a new machine, fixing a boot issue, or preparing for a dual-boot setup, this knowledge puts you in control. So open your terminal, run a few commands, and discover how your Linux system really boots.

Similar Posts