UEFI – Linux Hint https://linuxhint.com Exploring and Master Linux Ecosystem Fri, 29 Jan 2021 04:01:58 +0000 en-US hourly 1 https://wordpress.org/?v=5.6.2 What is the Difference Between UEFI and Legacy? https://linuxhint.com/difference-between-uefi-and-legacy/ Tue, 26 Jan 2021 01:44:30 +0000 https://linuxhint.com/?p=87670

If you have ever experimented with Operating Systems, hardware, and overclocking, you’ve probably heard of UEFI and Legacy. Knowing the meaning of the acronyms and what they stand for is not enough; you also have to know what they do and how they work.

This tutorial will discuss how your computer boots, what UEFI and Legacy are, and help you understand why one is better than the other at specific instances.

Let us get started!

How a Computer Boots?

Before diving deep into what UEFI and Legacy Boot modes are, let us discuss how a computer boots. Understanding this will help clear up some concepts.

When you turn on your computer, it powers on the CPU, the key computer component that processes commands or instructions.

However, at this stage of the boot-up process, there are no instructions loaded into the memory. As such, the CPU switches to the system firmware, which contains instructions for the boot process.

The firmware code performs a Power On Self Test (POST) initialization and sets up all the connected peripherals. Once the POST check is successful, the firmware loads the storage devices and checks for a boot loader. The firmware then switches the instructions to the bootloader to handle the boot process.

At this stage, the bootloader, such as LILO and GRUB, takes over, loads the system kernel in the memory, and initializes required processes.

As mentioned, the firmware helps handle hardware initialization during the boot-up process. This firmware is commonly known as BIOS or Basic Input Output System.

What is Legacy Boot?

Legacy Boot refers to the boot process used by the BIOS firmware to initialize hardware devices. The Legacy boot contains a selection of installed devices that get initialized as the computer performs the POST test during the boot process. The legacy boot will check for all connected devices for the Master Boot Record (MBR), usually in the first sector of a disk.

When it can’t find a bootloader in the devices, Legacy switches to the next device in the list and keeps repeating this process until it finds a bootloader, or if not, returns an error.

What is UEFI?

UEFI or Unified Extensible Firmware Interface is a modern way of handling the boot process. UEFI is similar to Legacy, however, it stores the boot data in a .efi file rather than the firmware.

You will often find UEFI boot mode in modern motherboards with very intuitive and user-friendly Interfaces. UEFI boot mode contains a special EFI partition that is used to store the .efi file and is used in the boot process and the bootloader.

Difference between UEFI and Legacy

At a base level, UEFI and Legacy are very similar. However, on a deeper level, they’re also different.

Since UEFI is a BIOS successor, it has better functionalities and features. The following are the differences between UEFI and Legacy:

UEFI BOOT MODE LEGACY BOOT MODE
UEFI provides a better User interface. Legacy Boot mode is traditional and very basic.
It uses the GPT partitioning scheme. Legacy uses the MBR partition scheme.
UEFI provides faster boot time. It is slower compared to UEFI.
Since UEFI uses the GPT partitioning scheme, it can support up to 9 zettabytes of storage devices. The MBR portioning scheme used by Legacy only supports up to 2 TB storage devices.
UEFI runs in 32-bit and 64-bit, allowing support for mouse and touch navigation. Legacy runs in 16-bit mode that only supports keyboard navigation.
It allows a secure boot that prevents the loading of unauthorized applications. It may also hinder dual boot because it treats operating systems (OS) as applications. It does not provide a secure boot method, which allows for the loading of unauthorized applications, making dual-booting possible.
It has an easier update process. It is more complex compared to UEFI.

Although UEFI may sound better than Legacy (and it is), it’s not always the best choice to use, and you may not need it.

In some cases, you may have to use Legacy, depending on the features you want. For example, if you want dual booting, UEFI can hinder this process.

Here are other scenarios where you might not need UEFI:

  1. Dual Booting process
  2. When you have less than 2 TB of storage device (stick to MBR)
  3. When your OS does not need to write code to interact with the hardware
  4. If you need a quick and simpler GUI that you can control with a keyboard.

Conclusion

We’ve discussed the main differences between UEFI and Legacy boot modes. Using the information provided in this guide, you can now be able to troubleshoot problems. For example, if a dual boot is not working, you can disable secure boot.

]]>
How Do I Change UEFI Settings? https://linuxhint.com/change-uefi-settings/ Tue, 19 Jan 2021 20:00:24 +0000 https://linuxhint.com/?p=86490

When you are using Linux, of any distribution, you sometimes need to look at settings for the UEFI. The reasons vary; you may have a dual-boot system and cannot find the other boot option, maybe you want to have it boot securely, or, in some cases, you want to turn secure boot off so you can boot anything.

For secure boot, you need to use the mokutil command. This manages the keys that are available on the system.

Tools

efibootmgr

The most obvious and simple to grasp tool is the efibootmgr. Using this, you can work with the different points where you want the boot to continue. Using UEFI, it is much more flexible to create options for how you boot. With the small nifty tool, efibootmgr, you can change, add, and remove boot entries. The boot entries point the process to where it needs to go.

The efibootmgr is available for most distributions as a binary. So, install the ordinary one with your distribution. Once it is installed, you need to run it as root. As you should understand, you may render your system impossible to boot, so be careful. If you run the command without parameters, you get a simple list of current entries.

$ sudo efibootmgr

The list in the picture is very short; the dual boot systems will has many more entries. Since your system probably have many more entries, you may want to choose another start. This is done easily enough.

$ sudo efibootmgr -n 000C

This is intended for experiments, the ‘-n’ means set bootnext. This will set what will boot the next time you reboot; it does not change what will continue booting first. If you have added something new, you should do this to try it out. If the boot goes through the way you wished it would set it to permanent.

$ sudo efibootmgr -o 000C,000B

The above command changes the permanent boot order. You do not have to type all zeros, only ‘C, B’ would also have worked. In creating a boot entry:

$ sudo efibootmgr -c

Running the command without more switches assumes that you have your ESP on dev/sda1 and that it is mounted at /boot/efi. You can also set up the boot to be on another disk. Below is an example.

$ sudo efibootmgr -c -l \\EFI\\refind\\refindx64.efi -L rEFInd -d /dev/sdc

The command adds ‘-c’ and activates as the first boot entry. The parameter ‘-L’ sets where the file is. This is relative to the ESP partition, usually mounted at ‘/boot/efi’. The ‘-d’ parameter points to the drive you want to use, the default is /dev/sda. Did it go well? If not, you can activate and deactivate the boot entry using ‘-a’ and ‘-A’, respectively.

$ sudo efibootmgr -A -b C $ sudo efibootmgr -a -b C

The parameter points to Boot000C, as you can see, you can also use only the first non-zero value in the point number. If you have many disks, the output looks a little more complex. Use the verbose option to see if they are on many disks.

$ efibootmgr -v
root@mats-Ubuntu:/media/matstage/UEFI# efibootmgr -v

BootNext: 000C

BootCurrent: 000B

Timeout: 0 seconds

BootOrder: 0001,0000,000B,000C

Boot0000* rEFInd Boot Manager   HD(2,GPT,439e77ad-82ea-464d-801d-3d5a3d4b7cd4,0xfa000,0x96000)/File(\EFI\refind\refind_x64.efi)

Boot0001* rEFInd        HD(1,GPT,c85dcbd6-880b-f74d-8dac-0504f1dd291e,0x800,0xaf000)/File(\EFI\refind\refind_x64.efi)

Boot000B* ubuntu        HD(2,GPT,439e77ad-82ea-464d-801d-3d5a3d4b7cd4,0xfa000,0x96000)/File(\EFI\UBUNTU\GRUBX64.EFI)

Boot000C* UEFI OS       HD(2,GPT,439e77ad-82ea-464d-801d-3d5a3d4b7cd4,0xfa000,0x96000)/File(\EFI\BOOT\BOOTX64.EFI)

The funny part here is that you have the partition first, and then the UUID, and finally the path on that disk. It is a bit tricky to remember the values, but it makes for a more robust solution for the system. Any removable disk may not get the same letter after ‘sd’ next time you boot.

EFI Tools

The EFI tools are a collection of tools that you can use to figure out what is defined already. The efi-readvar tool can show you everything you have access to. The printout is academic since all you see are the keys. To manipulate the list, you use efi-updatevar. This requires many hoops to do, and when done incorrectly, you can brick your system. With that said, if you have a specific need, you can use the efivars file system. It is mounted read-only by default because of the risk of bricking the system. The steps to get access to the variables are detailed in the link below.

https://realmacmods.com/macbook-2011-radeon-gpu-disable/

This is about the Macbook Pro that cannot boot without using the GPU, which makes graphical boot impossible when you want to install Linux. Making more changes to the UEFI variables are dangerous not just to your disk contents, it can also set things to not even try a boot.

If you know what guide you are looking for, you use the efibootdump command. This requires a more in-depth knowledge of your system though.

Conclusion

Changing your UEFI variables is possible, however, you should make sure you know exactly what you are doing if you change anything else than the boot order. The boot order will make you reboot a few times until you understand any mistakes you may have made. If you are interested in speeding up your boot and make it more dynamic, consider rEFInd!

]]>
Coreboot Versus UEFI https://linuxhint.com/coreboot-vs-uefi/ Sat, 18 Nov 2017 21:35:25 +0000 https://linuxhint-com.zk153f8d-liquidwebsites.com/?p=20104 BIOS (an acronym for Basic Input/Output System), which traditionally performed hardware initialization during the booting process has been with us since the 70s, and the time to replace it has come years ago.

Today, the de facto successor to BIOS is Unified Extensible Firmware Interface (UEFI), which addresses several technical shortcomings while typically providing legacy support for BIOS services. But contrary to popular belief, UEFI isn’t the only BIOS replacement available. There’s also coreboot, which is an open source software project that aims to replace BIOS with a lightweight firmware that does only the bare minimum to load and run a modern 32-bit or 64-bit operating system.

In this article, we explain the reasons why BIOS is obsolete and compare coreboot with UEFI to see how these two BIOS replacements came into being, what they want to accomplish, and what are their advantages and disadvantages.

The End of BIOS

Computers have evolved significantly since Gary Kildall, an American computer scientist and microcomputer entrepreneur, invented the term BIOS. Nowadays, it’s common to boot from not just hard drives and optical media but also from USB flash drives and remote network devices. It’s also common to boot from hard drives larger than 2.2 TB, which is a hard limit imposed by the Master Boot Record (MBR), the standard type of boot sector of IBM PC-compatible systems with BIOS.

Besides very limited hardware support, BIOS also doesn’t meet current security requirements of computer manufacturers, who need a way to ensure that the user always boots into an operating system that hasn’t been tampered with between boots.

Finally, BIOS is also outdated in terms of its usability. Its text-only user interface is clunky and often hard to navigate. Many BIOS implementations register input only when it comes from a PS/2 keyboard, and mouse input is virtually unheard of.

Successors to BIOS

There are currently three main successors to BIOS: coreboot, libreboot, and UEFI. Out of these, libreboot is the youngest, and it is actually a distribution of coreboot without proprietary binary code. It was launched in 2013 by Leah Rowe, and it currently works with any Linux distribution that uses kernel mode setting (KMS) for the graphics. Because of libreboot’s close ties to coreboot and its limited support, we won’t discuss it further in this article.

coreboot

On its official website, coreboot is described as “an extended firmware platform that delivers a lightning fast and secure boot experience on modern computers and embedded systems.” Coreboot was initially released in 1999, with the goal to create a BIOS alternative that would start fast and handle errors intelligently.

Some of the main contributors to the project include AMD, MSI, Gigabyte, Coresystems, and also Google, who partly sponsors the coreboot project and have accepted it in seven consecutive years for the Google Summer of Code.

In 2009, coreboot founder Ron Minnich said, “There are more than 10 million computers running coreboot out there these days. Many of them are appliances and set-top boxes. Stuff that is supposed to be instant-on. But some companies also sell servers running coreboot now. The use cases are very wide-spread. Some coreboot machines were hunting mines in Afghanistan, others were making sure the data integrity and performance in large hospitals is guaranteed. Coreboot has been used in systems testing and improving the security of cars, and of course in quite a couple of super computer clusters with thousands and thousands of nodes.”

Among the more readily available devices that support coreboot are some x86-based Chromebooks, the OLPC XO, and the Libreboot X200 and T400.

Compared to BIOS, coreboot only does hardware initialization, whereas traditional BIOS also starts the operating system. After the hardware initialization, coreboot starts a separate program called payload. The payload can be any program. Besides the standard bootloaders that can start the operating system, it can actually be the operating system kernel itself, which means that it’s possible to put coreboot and the Linux kernel into the boot flash to have an always-available Linux system.

UEFI

UEFI is based on the original Extensible Firmware Interface (EFI) specification developed by Intel in 2005, after the formation of The Unified EFI Forum.

“The Unified EFI (UEFI) Specification (previously known as the EFI Specification) defines an interface between an operating system and platform firmware,” describes the specification Intel. “The interface consists of data tables that contain platform-related information, boot service calls, and runtime service calls that are available to the operating system and its loader. These provide a standard environment for booting an operating system and running pre-boot applications.”

In most new machines, UEFI has replaced BIOS as a more complex alternative, with each computer manufacturer implementing the standard in a particular way to create a front-end specific to the manufacturer’s needs.

UEFI provides a pre-boot environment with its own shell, drivers, applications, the ability to browse the Internet, create system backups, and perform remote diagnostics without an operating system, among many other things. UEFI supports booting from hard drives as large as 9.4 ZB (1 ZB = 1trilliongigabytes), which should be enough for a while considering that the entire Internet is expected to be around 8 ZB.

But despite all the advantages UEFI has over BIOS, many digital rights activists have criticized it, claiming that UEFI removes the ability of the user to truly control the computer because of a feature called Secure Boot, which makes sure that a device boots using only software that is trusted by the Original Equipment Manufacturer (OEM).

Some machines with the Secure Boot feature make it impossible to turn the feature off, so anyone who owns such machine is stuck with whatever operating system came with the machine. Considering how few laptops come with Linux preinstalled, all Linux users who purchase a laptop or a desktop computer that isn’t specifically advertised as Linux-friendly should ensure that the machine makes it possible to turn off Secure Boot.

Conclusion

Even though coreboot is much older than UEFI, most computer users barely know about its existence because it can be found mostly in highly specialized devices, not laptops and desktop computers. That said, machines with coreboot do exist; they are just much harder to find.

]]>