Tag Archive: boot


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.

UEFI boot

As I am about to install my new laptop, I am considering using UEFI. The laptop supports UEFI but came with legacy booting enabled as default option. Whether this is the university setting or the factory default I’m not sure, since my father’s HP laptop got UEFI enables as default option.

I haven’t been working with UEFI systems before. Well, I’ve installed Ubuntu on my father’s laptop, on an external (USB) hard disk, so he could dual boot Windows and Linux. And that’s one of the advantages of UEFI. No boot manager is required. This is built in into UEFI.

My new laptop, the HP EliteBook 8570w has three options, legacy boot, uefi hybrid (both legacy and uefi / with csm), and native uefi (without csm).

I have selected the compatible mode. Now, as I try to boot from the ArchLinux installation CD. I am still using my external (USB) optical drive, since the laptop was delivered without internal optical drive. Well… so I boot from the CD, a menu shows, where I can choose between booting Arch, an UEFI shell (version 1 and 2) and to return to the firmware.

So, I select to boot Arch. The screen goes black. The USB optical drive appears to be reading slowly, but nothing happens. When I reboot, the uefi firmware does not detect the USB optical drive. Something is not going right. ArchLinux boot media are a hybrid case. The ISO contains both SYSLINUX and UEFI booting, but can also be dd’d to an USB flash medium. I believe this is the reason why I have had experienced booting ArchLinux installation media on my EliteBook 8530w. I have made an UEFI bootable USB flash drive according to the instructions on the ArchWiki.Using this I can boot normally. This appears to confirm my hypothesis the hybrid boot medium confuses the HP firmware.

So, creating partitions. Since I am using GPT, I will use gdisk in stead of fdisk. Creating partitions will be similar to fdisk. Partitions have numbers from 1 to 128. There are no concepts like extended and logical partitions. They’re a dirty hack of the MBR partitioning scheme anyways. I am still overthinking how I need to partition this system. This is the first time I am working an UEFI based system and GPT style partitioning. I still haven’t decided what boot loader I will be using, either SYSLINUX or GRUB2.