Sunday July 25 2021
Direct booting Linux on a EFI / UEFI system
I’ve never liked GRUB, I only begrudgingly configured it when needed. For awhile
I used extlinux
/syslinux
because I personally found GRUB was such a pain to
configure.
These days on modern system it’s trivial to configure the kernel to be booted directly.
For instance, on my Void Linux system:
# efibootmgr -c -p 4 -d /dev/nvme0n1 -L void -l /EFI/void/vmlinuz.efi \
-u 'root=/dev/mapper/vg-root initrd=/EFI/void/initrd.img rootfstype=xfs ro rd.luks.uuid=<UUID> rd.luks.allow-discards rd.luks.crypttab=0'
Is the command I use to setup the boot entry for my Void Linux install on encrypted LVM.
Going over the arguments:
-c
Create a new entry-p 4
, target partition 4. ( I have two EFI partitions on my current drive, which is totally fine! )-d /dev/nvme0n1
Specifies the disk to target-L void
set the label to bevoid
-l /EFI/void/vmlinuz.efi
The path on the EFI file system where the kernel / loader is located. Note that some systems require the.efi
suffix-u '...'
The arguments to be passed to the kernel, including the location for the inital ramdisk.
This is possible for most distributions that compile in the efistub
option.
This includes Ubuntu, Void, Arch, and probably others as well.
This also allows you to easily keep multiple Linux distributions on the same encrypted volume group and have separate boot entires from them and not have them step on each other’s toes with GRUB auto configuration.