UEFI systems install Arch Linux note

After boot up with install media using GPT fdisk (aka gdisk) to create a EFI partition with partition type ef00:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   EF00  EFI System
   2         1050624        34605055   16.0 GiB    8200  Linux swap
   3        34605056      1953525134   915.0 GiB   8300  Linux filesystem


Make file system and mount:
mkfs.vfat -F32 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 /dev/sda3
mount /dev/sda3 /mnt
mkdir -p /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
swapon /dev/sda2

Install the base system:

pacstrap /mnt base base-devel

Generate an fstab with the following command:

genfstab -pU /mnt >> /mnt/etc/fstab

Chroot into our newly installed system:

arch-chroot /mnt

Write your hostname to /etc/hostname:

vi /etc/hostname

Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone:

ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime

Uncomment the selected locale in /etc/locale.gen and generate it with locale-gen:(For Taiwan user uncomment en_US.* and zh_TW.*)

vi /etc/locale.gen
locale-gen

Configure /etc/mkinitcpio.conf as needed (Ex: resume) and create an initial RAM disk with:

vi /etc/mkinitcpio.conf
mkinitcpio -p linux

Install bootloader:

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug

If you get error message here because some device efibootmgr can’t run on chroot. We will do this after fist time boot up new system. But now we need copy grubx64.efi to /boot/efi: (If you not get any error skip this step)

cp /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/shellx64.efi

Configure bootloader:

grub-mkconfig -o /boot/grub/grub.cfg

Set root password:

passwd

Reboot system:
exit
umount /mnt/boot/efi
umount /mnt
reboot

If you not have any error on “grub-install” step. You can see BIOS boot option have new one and can set boot from new device.

If you get error on “grub-install” step need use below way to fix it.
Boot in BIOS use “Launch EFI shell from filesystem device” and select your hard disk.
After boot in new system use below command to set up efi boot:

efibootmgr -c -g -d /dev/sda -p 1 -w -L "Arch Linux (GRUB)" -l /EFI/arch_grub/grubx64.efi

Now you can reboot boot system and get grub boot up without in BIOS use “Launch EFI shell from filesystem device”.

Reference:
https://wiki.archlinux.org/index.php/GRUB
https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface#EFI_System_Partition
https://wiki.archlinux.org/index.php/GRUB_EFI_Examples

4 Comments

  1. But when I reboot, I got “error: no such partition. Entering rescue mode … grub rescue>” …… sigh …

  2. Thank you so much for your perfect guide! I spent more than 6 hours to re-encounter errors until I found your article. Great job!!!

  3. Thanks your info. I test again with full UEFI support device just like you say not need run the final command because grub-install success exec “efibootmgr” no error.

  4. Awesome thanks – the wiki was such a missmash of information for UEFI boot, but this worked perfectly for me.

    I didn’t need to run the final command, it booted straight into the grub menu for me.

Leave a Reply

Your email address will not be published. Required fields are marked *