Arch UEFI Installation

Jump to: navigation, search


A concise example of how to use a UEFI system with GPT disk partitioning with Arch; the intent is to demonstrate how the EFI partition works, how it's mounted, and how GRUB is configured.

This example was designed using a Virtualbox host with the guest VM in EFI mode VM -> Settings -> System -> Enable EFI, then booting the standard Arch ISO and using UEFI mode install.


First, partition your device in GPT format (I prefer gdisk or parted) like so:

Note that gdisk and parted display the UEFI (/dev/sda1 below) in different ways -- gdisk shows it as an ESP (EFI System Partition), parted likes to show it instead with flags "boot,esp" -- this is all the same, it's type ef00 under the hood on a GPT disk.

/dev/sda1  size:200M  type:ef00  "EFI System Partition" or "boot,esp"
/dev/sda2  size:500M  type:8300  "Linux Filesystem" or "Linux"
/dev/sda3  size:rest  type:8e00  "Linux LVM"

Now create /dev/sda3 as LVM - I prefer LVM, it's got what partitions crave:

pvcreate /dev/sda3
vgcreate vglocal00 /dev/sda3
lvcreate -L 1G -n swap00 vglocal00
lvcreate -l 100%FREE -n root00 vglocal00

Make your swap, ext4 and vfat for EFI:

mkswap /dev/vglocal00/swap00
mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/vglocal00/root00

Mount everything - notice how /dev/sda1 is a /boot/efi VFAT (aka FAT32) partition type:

swapon /dev/vglocal00/swap00
mount /dev/vglocal00/root00 /mnt
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi

Pacstrap the core packages and chroot into the mount:

pacstrap /mnt base
genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt

Prep the system with all the usual things - adjust to your locale as desired:

export LANG="en_US.UTF-8"
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen

cat << EOF > /etc/locale.conf

cat << EOF > /etc/vconsole.conf

ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc --utc
echo "toolbox" > /etc/hostname
hostname "toolbox"

Install grub, kernel headers, os-prober (so grub can see Windows, etc.) and the UEFI tools:

pacman -Sy --noconfirm
pacman -S --noconfirm grub linux-headers os-prober intel-ucode dosfstools efibootmgr

Since I like LVM, add the mkinitcpio hook:

sed -i.bak -r 's/^HOOKS=(.*)block(.*)/HOOKS=\1block lvm2\2/g' /etc/mkinitcpio.conf
mkinitcpio -p linux

Install grub2 in UEFI mode and add the hack for some BIOSes which expect the boot bits in a specific place:

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug
grub-mkconfig -o /boot/grub/grub.cfg
mkdir /boot/efi/EFI/boot
cp /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

Finally, set the password for root, back your way out and reboot:

passwd root
umount -R /mnt

The guest VM is now a UEFI + GPT based Linux system; from here the process can be expanded to work with real live devices and systems, custom partitions and so forth.