I wanted to install arch linux on a UEFI/GPT system and had questions about the process

11,213

Solution 1

Did you know that the Arch wiki has a beginner's guide which is easier to follow for users unfamiliar with the Arch installation process ?

The installation is pretty straightforward so I won't document it here completely, I'll just highlight the UEFI-related parts :

  • first you need to use a GPT partition table. I prefer to use gdisk (the GPT equivalent of fdisk) instead of parted, so you need to create an EFI system partition. It has a minimum size which is 260MB for 4K sector drives and of 100MB for conventional 512B sector drives. You can play it safe and always use 260MB or more. When creating the partition in gdisk, set the type to ef00.

  • once the partition is created, put a FAT32 file system on it - mkfs.fat -F32 /dev/sdX1.

  • create and format your other partitions as you want and mount them according to the wiki - don't create a /boot partition, we can use the EFI system partition for that.

  • mount that EFI partition on /mnt/boot - mount /dev/sdX1 /mnt/boot.

  • follow the installation guide, but don't install a bootloader - there's no need as the Linux kernel can directly be booted as an UEFI application, and it's even documented in the wiki, so we only need to install efibootmgr (a package to manage UEFI boot entries) and run the following command to declare our Arch system in the UEFI NVRAM : efibootmgr -d /dev/sdX -p 1 -c -L "Arch Linux" -l /vmlinuz-linux -u "root=/dev/<root partition, UUIDs or LABELs can be used> initrd=/initramfs-linux.img"

Exit the chroot and admire the magic.

Solution 2

First, the commands:

parted /dev/sda
mklabel gpt
mkpart ESP fat32 1MiB 513MiB
set 1 boot on
mkpart primary ext4 513MiB 100%
quit
mkfs.vfat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mount /dev/sda2 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
pacstrap -i /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
check fstab with 'nano /mnt/etc/fstab'
arch-chroot /mnt /bin/bash
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
hwclock --systohc --utc
echo SomeHostname > /etc/hostname
echo SomeHostname > /etc/hosts
systemctl enable [email protected]
passwd
pacman -S grub os-prober efibootmgr
mkdir -p /boot/efi
mount -t vfat /dev/sda1 /boot/efi
modprobe dm-mod
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-    id=arch_grub --recheck --debug
mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg
pacman -S wget zip unzip
cd ~
wget http://dl.dropbox.com/u/17629062/Shell2.zip
unzip Shell2.zip
cp ~/Shell2/UefiShellX64.efi /boot/efi/shellx64.efi
reboot
F2 to get into ASUS's pre-boot GUI
Shell> bcfg boot add 3 fs1:\EFI\Arch_Grub\grubx64.efi "Arch_Grub"
Shell> bcfg boot dump -v
reboot
pacman -Syyu

The key things to note in this process are the creation of an ESP partition, which is required by the UEFI standard, and some other partition to hold the rest of your data.

Share:
11,213

Related videos on Youtube

Volumetricsteve
Author by

Volumetricsteve

Updated on September 18, 2022

Comments

  • Volumetricsteve
    Volumetricsteve almost 2 years

    My original formal question was "How do I install Arch linux on a GPT/UEFI system"

    This is meant to be addressed with the documentation provided by the arch linux community, located here:

    https://wiki.archlinux.org/index.php/Installation_guide

    I tried to follow the documentation but I couldn't get the process to work. More precisely, I ran into issues with setting up the mounts and then installing the base system. Arch linux is documented in a highly modular, non-linear fashion so while following the guide you'll have to jump from one section to the other fairly often. I must have gotten lost in this as I was not able to figure out the order of things from their guide(s). I ended up cobbling together my own process (with some help by folks in the Arch Linux Forum here : https://bbs.archlinux.org/viewtopic.php?id=196339 ) and I wanted to post it here in case it could help someone else out.

    I've noticed since I've posted my findings on the Arch linux forum that my thread has over 1,000 views so I'm hoping it's helping some folks out. I thought it would also be good to post it here to increase its availability.

    Here's everything I have, from start to finish, all in one place.

    Please note this was for the Asus M5A97 R2.0, different systems may implement UEFI differently.

    • Daniel B
      Daniel B about 9 years
      If you want to answer your own question, you’re free to do so. However, please ask a proper question and post a proper answer. If you have enough rep later, you can even do so in one single action. Your guide, as is, is not suitable for noobs. Please add some explanations and also describe how you “couldn’t get the process to work”.
  • Volumetricsteve
    Volumetricsteve about 9 years
    I didn't realize the part about not needing the bootloader, i'll have to give that a try, but as for the Beginner's guide...parts of it worked for me, some parts just confused me, so I ended up trying different things until it booted. I'm sure parts of my process are wrong or unnecessary (like the bootloader thing you just pointed out) so it's not perfect by any means, but if anyone was as confused as I was - even by the beginner docs, I hope something I've done provides a way ahead for people out there trying similar things. Thank you for the additional information!