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.
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.
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
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:
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
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.
Cron is a command-line job scheduler available on Linux operating systems that allows users to…
In computing, there are two types of IP addresses, IPv4 and IPv6. By default, IPv6…
A tarball is commonly known as a TAR file, short for tape archive, which is…
A tar archive is a file that stores a collection of directories and files, also…
On Linux, you can quickly find out how LUNs are mapped to the underlying OS…
Keeping your Ubuntu system up-to-date is critical to ensuring a system's stability and security. This…
This website uses cookies.