Today's article is an easy one about determining if you're using UEFI or if you're not...

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
11,843
Reaction score
10,420
Credits
97,948
It's really basic, and was also written in a hurry 'cause I had a bit of a scheduling SNAFU. Still, it was finished yesterday, while taking care of a dozen other things. That meant it had to be short and easy.


Still, it's a handy tool to have in your Linux toolbox.

Feedback is awesome.
 


Another easy way, is just to look at the filesystem partitions.

Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 32G 54M 32G 1% /dev/shm
tmpfs 13G 1.9M 13G 1% /run
/dev/nvme0n1p4 30G 16G 15G 52% /
tmpfs 32G 172K 32G 1% /tmp
/dev/nvme0n1p8 1.8T 122G 1.7T 7% /home
/dev/nvme0n1p5 20G 13G 7.0G 66% /var
/dev/nvme0n1p2 2.5G 294M 2.3G 12% /boot
/dev/nvme0n1p1 195M 6.1M 189M 4% /boot/efi
/dev/nvme0n1p6 15G 1.5G 14G 10% /var/log
/dev/nvme0n1p3 40G 1.1G 39G 3% /opt
tmpfs 6.3G 3.3M 6.3G 1% /run/user/1000

If you are using legacy BIOS, you typically cannot see the /biosboot partition using the "df" command.
However fdisk will show you. ( WARNING: Be very careful in fdisk )

fdisk /dev/sda

Welcome to fdisk (util-linux 2.35.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sda: 260 GiB, 279172874240 bytes, 545259520 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 005392C2-8A3E-4BAB-8697-A09E12798F8E

Device Start End Sectors Size Type
/dev/sda1 2048 6143 4096 2M BIOS boot
/dev/sda2 6144 6297599 6291456 3G Linux filesystem
/dev/sda3 6297600 396236799 389939200 186G Linux filesystem
/dev/sda4 396236800 413014015 16777216 8G Linux swap
 
Nice. I didn't even think of that method. It's a bit longer and they've gotta use fdisk, but that's harmless so long as they follow directions.
 
Just a note to The Viewers that with @dos2unix 's output above, the first lot of output is from issuing the command

df -h

Cheers

Wizard
 
I need to get my 'how to ask a good support question' moved to the new site. I should do that soon as a 'new' article. I'll then 301 redirect the old article to the new article and keep the domain registered for another year. That'll give me ample time to ensure all the content gets moved over while still including new articles more often than not. My official year is coming to a close soon.

I am pretty sure I'm just gonna keep writing more articles, even after the year is over. It has been a fun project. The year would over if I counted the material at the original site.

I'm watching the biathlon.
 
@dos2unix @KGIII if you get given a PC where all the partitions including EFI have been wiped then how do you know then ?
if you boot from a usb live Linux os then : sudo dmidecode 3.0 | grep ‘UEFI’ i think would work, because my understanding is that dmidecode is a translation in human form of whats on the BIOS firmware.

Better brains than mine will maybe confirm that
 
dmidecode | grep -i uefi
UEFI is supported

I think the problem with this might be, yes my computer supports it, but am I using it?
I have used this particular computer in both UEFI and Legacy BIOS modes.
 
Code:
ls /sys/firmware/efi/efivars
 
If it was a computer with no OS, partitions wiped as you said, I'd probably just check before booting into anything. I'd boot and enter the setup menu where I can see everything for myself. Entering setup on a new computer is always the first thing I do anyhow.
 
If it was a computer with no OS, partitions wiped as you said, I'd probably just check before booting into anything.
If you live boot from cd and check if that directory exists(from my last reply) you can see if you are system is using efi boot or not.
 
If you live boot from cd and check if that directory exists(from my last reply) you can see if you are system is using efi boot or not.

Oh, I wasn't sure and was just saying what I'd do in those circumstances. Hmm... You could always leave that as a helpful comment on the article. ;-)
 
if the hard drive was wiped /sys/* would not exist
/sys/* shows as part of the running OS, even when running in memory only in a live Linux.

I wiped the hard drive on a UEFI-capable laptop and booted on a live Linux Mint 20.3 USB.

# ls /sys/firmware/efi/efivars only exists if the laptop was booted with UEFI enabled.

However, with UEFI disabled, # dmidecode | grep UEFI still reports that UEFI is supported.

So it depends on whether you want to know what you ARE using, or what you CAN use.
 
So it depends on whether you want to know what you ARE using, or what you CAN use.

For the scope of the article, it's just if you are (or are not) using UEFI.

Not that this isn't an interesting discussion, I'm just clarifying. By all means, keep going. I'm sensing another potential article. ;)
 

Members online


Latest posts

Top