November 21, 2024

How to Check if Your Linux System Uses UEFI or BIOS

When you boot a Linux system, it boots into legacy BIOS (Basic Input/Output System) mode or modern UEFI (Unified Extensible Firmware Interface) mode, known as your computer’s “firmware”. It is important to know the firmware on which you are loading an operating system.

Firmware is the first piece of software that is executed when your computer boots, which initializes all the attached hardware and loads the actual operating system from the hard disk, and then starts the OS.

Why UEFI?

As UEFI was designed to overcome some limitations of BIOS. It offers several advantages such as faster boot times, support for larger hard drives (allow us to use larger than 2 TB disks), CPU independent architecture and drivers, and improved security features.

1) Check if you are using UEFI or BIOS on Linux

The easiest way is to check if '/sys/firmware/efi' directory exists. It does not appear if you have booted with traditional BIOS.

# ls -lh /sys/firmware/efi

total 0
-r--r--r--  1 root root 4.0k Jul 16 18:25 config_table
drwxr-xr-x  2 root root    0 Jul 16 18:23 efivars
drwxr-xr-x  3 root root    0 Jul 18 13:11 esrt
-r--r--r--  1 root root 4.0k Jul 18 13:11 fw_platform_size
-r--r--r--  1 root root 4.0k Jul 16 18:25 fw_vendor
drwxr-xr-x  2 root root    0 Jul 18 13:11 mok-variables
-r--r--r--  1 root root 4.0k Jul 16 18:25 runtime
drwxr-xr-x  9 root root    0 Jul 16 18:25 runtime-map
-r--------  1 root root 4.0k Jul 16 18:25 systab
drwxr-xr-x 87 root root    0 Jul 18 13:11 vars

For BIOS based system, you will get an output as follow:

# ls -lh /sys/firmware/efi

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

1.1) Determine if the Linux system is booted in BIOS or UEFI mode

Alternatively, you can check this with one liner script as shown below: It checks for the existence of the /sys/firmware/efi directory, and only if it exists then your computer boots with UEFI. Otherwise, it will return Legacy BIOS Boot Detected.

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

Legacy BIOS Boot Detected

For UEFI boot:

Determine if the Linux system is booted in BIOS or UEFI mode

2) Checking the boot mode of the operating system in Linux

You can also verify that EFI appears in the dmesg output. If it boots with EFI and you will be able to see the output as shown below from the dmesg log.

# dmesg | grep -i "EFI"

[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: EFI v2.70 by EDK II

Final Thoughts

In this article, we covered how to check whether a Linux system is booted through UEFI or Legacy BIOS on Linux using two easiest method.

Leave a Reply

%d bloggers like this: