Well, last post I’ve discussed the problems I’ve encountered while trying to boot the ArchLinux installation CD in UEFI mode. As mentioned, it booted fine in legacy (BIOS) mode. Anyhow, let’s have a look at the installation procedure on an UEFI/GPT system.

IMG_1324Since the hard disk was previously partitioned using the MBR partition scheme and booting in legacy (BIOS) mode, we need to start from scratch. This includes creating the UEFI system partition.

When we start the GPT version of fdisk, gdisk, it will give a message about the fact the hard disk is currently using  the MBR partitioning scheme, and converting could possibly be destructive. We are going to repartition the whole disk, so it’s a destructive operation anyways.

So, we create an empty parition table, with the o command, just the way we would do in fdisk, we create a new partition with the n command. Here we notice a little difference, we can enter a number between 1 and 128 here. We’ll proceed with creating a 512 MB partition, and enter HEX code EF00 for EFI BOOT PARTITION.

Since the new laptop got 8 GB of RAM, the size of the Swap partition will be 16 GB. This is the next partition I’m going to create. I will enter 8200 for Linux Swap Parition.

The next two partitions will be the root file system and the home partition, 50 and 200 GB. I have kept left an amount of unpartitioned disk space for potential use with other operating systems. gdisk defaults to code 8300, which is ext2/3/4, so I don’t need to change this. All the same as with fdisk.

Next, will be formatting the partitions. However, attempting to format the partitions immediately after closing gdisk will result in an in-use error message. Re-reading the partition table doesn’t make a difference, a REBOOT is required to proceed. After rebooting, formatting works like a charm. The UEFI BOOT partition MUST be formatted FAT32. The other partitions will be formatted ext4, and the swap partition will have to be initialised with mkswap.

# mkfs.vfat -F32 /dev/sda1
# mkfs.ext4 /dev/sda3
# mkfs.ext4 /dev/sda4
# mkswap /dev/sda2

After formatting the partitions, we can mount them and start the ArchLinux installation process.

# swapon /dev/sda2
# mount /dev/sda3 /mnt
# mkdir /mnt/home
# mount /dev/sda4 /mnt/home
# mkdir -p /mnt/boot/efi
# mount /dev/sda1 /mnt/boot/efi
# pacstrap base /mnt
# genfstab -U -p /mnt >> /mnt/etc/fstab
# arch-chroot /mnt
# ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
# mkinitcpio -p linux

So far, the installation procedure itself, has been pretty standard. The next step, setting up the boot loader, has caused me some problems. And this is the step that differentiates UEFI from BIOS booting, the boot process.

First of all, the EFI variables must be mounted. Please note the grub-install is executed inside the arch-chroot.

# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
# pacman -S grub efibootmgr
# grub-install –target=x86_64-efi –efi-directory=/boot/efi –bootloader-id=grub

However, this resulted in an error message show_boot_order() "no such file or directory". The result is the system doesn’t boot automatically, but when I choose to browse the file system, I can load GRUB2 and boot correctly.

Next, I’ve tried to install Gummiboot, and “chainload” GRUB2. This works fine. However, gummiboot assumes the EFI boot partition to be mounted at /boot.

# pacman -S gummiboot
# gummiboot –path=/boot/efi

Now, setting it up to chainload GRUB, in /boot/efi/loader/entries/grub.conf:

title GRUB
efi /EFI/grub/grubx64.efi

And in /boot/efi/loader/loader.conf

default grub

makes the system bootable.