👢Detect system boot mode

UEFI or BIOS

Here is how you can detect if you've booted your computer using a UEFI BIOS or a Legacy BIOS. First, install the dmidecode utility from your operating system repository. On Debian, you can:

apt-get install dmidecode

dmidecode reports information related to the BIOS under a type 0 entry. A quick way to detect the BIOS mode is:

sudo dmidecode -t 0 | grep UEFI > /dev/null && echo UEFI || echo BIOS

On a (Legacy) BIOS system you would see:

$ sudo dmidecode -t 0
# dmidecode 3.4
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
        Vendor: 3mdeb
        Version: Dasharo (coreboot+SeaBIOS) 
        Release Date: 08/23/2022
        ROM Size: 12 MB
        Characteristics:
                PCI is supported
                PC Card (PCMCIA) is supported
                BIOS is upgradeable
                Selectable boot is supported
                ACPI is supported
                Targeted content distribution is supported
        BIOS Revision: 0.0
        Firmware Revision: 0.0

On a UEFI system you would see:

$ sudo dmidecode -t 0
# dmidecode 3.4
Getting SMBIOS data from sysfs.
SMBIOS 3.1.1 present.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
        Vendor: American Megatrends Inc.
        Version: 2202
        Release Date: 07/14/2020
        Address: 0xF0000
        Runtime Size: 64 kB
        ROM Size: 16 MB
        Characteristics:
                PCI is supported
                APM 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
                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)
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported
        BIOS Revision: 5.13