User Tools

Site Tools


uefi

Note: The installer includes semi-automated UEFI installation. This article concerns manual installation.

As Arch-wiki entries are some times too theoretical and offer little practical solution assistance, and since booting uefi systems has caused a headache to users in most linux installations, we dedicate this section as a supplement to the Arch entry. The article is a generous contribution by an Obarun community member marianarlt who has developed a high level of expertise in setting up the bootloader for various UEFI capable or non-Bios systems. In addition an important amendment and bug discovery, in relation to mounting efivarfs, was made by techore in this forum thread.

UEFI booting Obarun

Disclaimer

As with any other manual you should first read the whole text with attention and then apply the content. When installing Obarun to boot with UEFI make sure you boot your live medium accordingly.[1]

Requirements

  • The disk you want to install to should have a GPT table. (gdisk is recommended)
  • The disk will need a separate EFI system partition to boot from with the appropiate identifier bit set. (again, gdisk recommended)
  • A system root partition for your operating system to reside on.

Optional Installation Steps

  • A swap partition may be sometimes needed to fully support Standby/Sleep/Hibernation functions.[Arch Wiki]
  • A separate partition for your users directories is often recommended as it detaches system upgrades/migration and similar activites from your personal data.
  • Encryption (not covered by this manual)[Arch Wiki]

About Partitioning

Before running `sudo obarun‑install` you want to make sure the above requirements are satisfied and you made up your mind about any optional steps. Your installation disk is most probably going to be sda but you should make sure with `lsblk`.

The most minimal layout for Obarun on UEFI could be as follows:

Partition Type Size Mount File System
/dev/sda1 esp 550MB+[2] /efi[3] Fat32[4]
/dev/sda2 root Rest / Ext4

More realistically you may want to do something similar to the following though:

Partition Type Size Mount File System
/dev/sda1 esp 550MB+[2] /efi[3] Fat32[4]
/dev/sda2 swap 2GB±[5] Swap
/dev/sda3 root 30GB±[6] / Ext4
/dev/sda4 home Rest /home Ext4

Your actual needs may differ and layouts and formats may be changed to accomodate those needs as mentioned before. This example is a tried and safe, easy to configure and maintain, layout. The following instructions will therefore apply to this example. Please inform yourself well when choosing different file systems and layouts, including encryption.


Step by Step

  1. Log in to the live media shell with user `oblive` and password `toor`
  2. Set up your disk layout (preferably with gdisk). Make sure you choose the right disk! (`lsblk` when in doubt!) In this example:
    1. `sudo gdisk /dev/sda`
    2. Create a new GPT table by choosing `o`.
    3. Confirm with `y`.
    4. Create a new ESP partition by choosing `n`.
    5. Confirm the default starting sector by pressing ENTER then for the ending sector type `+550M` and confirm.
    6. You will automatically be prompted for the partition type identifier. This will be your EFI system partition so type `ef00` and confirm.
      Note: The identifier is not optional! The EFI system partition needs to be identified as such by the motherboard!
    7. Create a new swap partition by choosing `n`.
    8. Confirm the default starting sector by pressing ENTER then for the ending sector type `+2G` and confirm.
      This will be your swap partition so type `8200` and confirm when prompted for the identifier.
    9. Create a new root partition with `n` and by now you get the idea, make it the size you want for your root partition.
      Give it the identifier `8304` which stands for: Linux x86‑64 root (/).
    10. Create your home partition in the same way and give it the identifier `8302` which stands for: Linux /home.
    11. Write your changes out with `w`. You will exit out of gdisk.
  3. Format the partitions accordingly. You can use labels to make further reference easier (highly recommended; useful for fstab/EFISTUB etc.) In this example:
    1. `sudo mkfs.vfat -n ESP /dev/sda1`
    2. `sudo mkswap -L SWAP /dev/sda2`
    3. `sudo mkfs.ext4 -L ROOT /dev/sda3`
    4. `sudo mkfs.ext4 -L HOME /dev/sda4`
  4. Mount the partitions to prepare for the installation:
    1. `sudo mount /dev/sda3 /mnt`
    2. (a) If you want to boot with EFISTUB:(see below)
      `sudo mkdir /mnt/boot && mount /dev/sda1 /mnt/boot`
      (b) If you want to boot with GRUB:(see below)
      `sudo mkdir /mnt/efi && mount /dev/sda1 /mnt/efi`[3]
    3. `sudo mount /dev/sda4 /mnt/home`
    4. `sudo swapon /dev/sda2`
  5. efivarfs and sysfs-efivars
    1. Consult this section of this document for details: Inconsistency_between_efivarfs_and_sysfs-efivars if installation is not done from a non-efi system and when manually installing without the obarun-install software, or arch-chroot is not used.
    2. Check if efivarfs is mounted in /sys/firmware/efi
    3. If efivarfs is not automatically mounted at /sys/firmware/efi/efivars during boot, then you need to manually mount it to expose UEFI variables to userspace tools like efibootmgr:
      # mount -t efivarfs efivarfs /sys/firmware/efi/efivars
      Note: The above command should be run both outside (before) and inside the chroot, if arch-chroot is not used.
      Also consult your local documentation on efivar: man efivar
  6. Make sure you have a network connection established.[Arch Wiki]
  7. Run `sudo obarun-install`
    1. Update the installer and its themes by choosing `yes` when prompted.
    2. Customize the installer to your needs as described in the "Installation" section of this Wiki.
    3. When prompted for a bootloader choose `No`
    4. Finish the installation
    5. Optional: If you want to install microcode this is a good moment to do so. Choose `Launch a shell on /mnt (7)`. This will chroot you into your install and let you install additional packages.
    6. Exit out of the script
    7. Do not reboot yet!
      (Your motherboard doesn't know what EFI application to boot yet!)[7]
  8. Choose your bootloader

A Word About Bootloaders

For the sake of simplicity it is, for now, discouraged to use syslinux for booting layouts other than BIOS/MBR.[8]

This manual provides two easy to set up options for booting a UEFI/GPT scheme for you to choose from.

  • EFISTUB [Arch Wiki]
    This is just your motherboads integrated UEFI bootloader. That is right. Your UEFI motherboard already got a pretty sophisticated bootloader integrated. Why not just use it?
    It makes for a minimalistic and direct boot approach. You configure it to boot right off vmlinuz-linux which is the default Arch Linux EFI application.
    Some people find it difficult to set up and maintain but it actually requires less configuration than most bootloaders and just as much when changing your boot entry.
    Some EFI implementations, especially early ones, might behave weird when trying to control the UEFI boot menu.
  • GRUB [Arch Wiki]
    The well known major bootloader of a many Linux distributions. Now that you know that your UEFI already is a bootloader you should understand that installing a dedicated bootloader software to your operating system is actually superfluous.
    That is because UEFI will now boot off the GRUB EFI application which in return will chain towards the default Arch EFI application vmlinuz-linux.
    Some people find this easier to control though and to set up with multi boot configurations.

Now that you know about both it is up to you to decide. They are both easy to set up.

Note: Make sure to finish the installation as outlined in the Step by Step section and that you are not inside of the obarun-install script!

Configure UEFI Boot with EFISTUB

  1. `sudo efibootmgr -c -d /dev/sda -p 1 -L "Obarun" -l \vmlinuz-linux -u "root=LABEL=ROOT ro resume=LABEL=SWAP quiet initrd=\intel-ucode.img initrd=\initramfs-linux.img"`
    (Any custom kernel parameters go between the brackets of the -u option as demonstrated with the `quiet` parameter. Adjust the microcode to your architecture or delete it from the command.)
  2. Reboot & Enjoy!
  3. From here on whenever you want to change the boot entry you would want to delete the existing one with `sudo efibootmgr -b 0000 -B` where 0000 must match your Obarun entry and then recreate it with the above command. Refer to the provided links for more details.

Configure UEFI Boot with GRUB

  1. `sudo arch-chroot /mnt`
    Do not use any other command to chroot into the installation!
    Make sure you are chrooted with the root user active.
  2. `pacman -S grub`
  3. `grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=grub`
  4. `grub-mkconfig -o /boot/grub/grub.cfg`
  5. Reboot & Enjoy!
  6. From here on whenever you want to change the boot entry you would want to edit /etc/default/grub and/or the scripts in /etc/grub.d/ and rebuild with the command from step four. Refer to the provided links for more details.


Conclusion

As you see the complicated part with bootloaders in general is the system setup itself. Instructing the bootloader can be a one liner in an UEFI configuration. The Obarun team hopes that this was of help to you. Further information and discussion can be found in the Obarun Forums.



Foot Notes

[1] To boot your live media in UEFI mode go into your motherboards boot menu after pressing the power button on your PC. This is specific to your motherboard and often shows briefly on the first screen that appears after pressing the power button. Most times it is one of the function Keys F1‑F12. Inside your motherboards boot menu choose to run your live medium with UEFI. The entry will literally say "UEFI" and the device name (most probably a USB flash drive). If after booting your live medium you're still unsure you may issue `ls /sys/firmware/efi/efivars`. If booted in UEFI mode this command will print a lot of names with long numbers else it will print nothing.

[2] Don't go smaller on the size for your EFI system partition. It is unnecessary with todays disk sizes and may cause confusion and bugs in older EFI implementations. To learn more about EFI/UEFI in general refer to the very in depth and excellent articles written by Rod Smith, the creator of rEFInd: https://www.rodsbooks.com/efi-bootloaders/principles.html

[3] Arch is deprecating the mount point /boot/efi for the ESP in favor of /efi. See https://wiki.archlinux.org/index.php/EFI_system_partition#Mount_the_partition.
It is important to realize that the actual mount point of the ESP does not matter in terms of how the UEFI functions. The ESP will always be searched by the UEFI no matter the mount point, for the EFI application to boot from. The only importance of the mount point is when configuring the bootloader. The mount point of the GRUB EFI application is passed to the NVRAM entry. That then gets booted by the UEFI which then in return chain loads itself into the vmlinuz-linux EFI application. EFISTUB uses /boot for convenience as the EFI bootloader will get configured to directly boot the vmlinuz-linux EFI application from that default location.

[4] The UEFI specification mandates support for the FAT12, FAT16, and FAT32 file systems (see UEFI specification version 2.8, section 13.3.1.1). Still any conformant vendor can optionally add support for additional file systems as is for example, the firmware in Apple Macs which supports the HFS+ file system.

[5] Try to compensate your memory for RAM intensive tasks. If you know you do a lot of memory intensive tasks which require more RAM than you have installed then raise this. You may also lower this or not use any swap at all if you have a lot of RAM. Remember that Arch based Linux distros like Obarun need a swap for hibernation though.

[6] When sizing the root partition with a separate home partition think about future system upgrades, huge applications and other things you might install on the road. Don't be too shabby here.

[7] Technically that is not correct. By specification the UEFI will search anywhere inside of the EFI system partition for an EFI application called BOOTX64.EFI for 64-bit systems and BOOTIA32.EFI for 32-bit systems. GRUB can even be instructed to install this way which would make NVRAM entries unnecessary.

[8] That does not mean you can not boot UEFI/GPT with syslinux. However it still has some limitations as of 2019 and requires some expertise which would imply more overall instructions to this manual. Refer to the Arch Wiki for details. https://wiki.archlinux.org/index.php/syslinux#UEFI_Systems

uefi.txt · Last modified: 2021/12/31 05:24 by obarun