Skip to content

Instantly share code, notes, and snippets.

@Apsu
Last active July 8, 2021 03:54
Show Gist options
  • Save Apsu/4108795 to your computer and use it in GitHub Desktop.
Save Apsu/4108795 to your computer and use it in GitHub Desktop.
Arch Linux UEFI Setup
#!/bin/bash
# These steps assume you've booted in UEFI mode by preparing your USB stick per these instructions:
# https://wiki.archlinux.org/index.php/UEFI#Archiso
# Assuming /dev/sda is the target disk
cgdisk /dev/sda
# Make a partition of type EF00 (EFI System Partition)
# Minimum size I can get without complaints from mkfs.vfat is 64M
# Might want to name it something useful like "efi"
# Make your other partition(s) as you see fit
# Create EFI System Partition (EF00) filesystem
mkfs.vfat -F32 -n efi /dev/sda1
# Assuming a single btrfs root
mkfs.btrfs -KL root /dev/sda2
# Mount the needful
mount -o ssd,discard,noatime,compress=lzo /dev/sda2 /mnt
mkdir -p /mnt/boot/efi
mount -o noatime /dev/sda1 /mnt/boot/efi
# Networking stuff
# ...
# Install as per usual, but snag grub-efi
pacstrap /mnt base base-devel grub-efi-x86_64
# Super important, before chroot!
modprobe efivars
# Facestab needfuls
genfstab -pU /mnt >> /mnt/etc/fstab
# Chroot, and gimme some bash plox
arch-chroot /mnt /bin/bash
# Do other installation needfuls
# ...
# Bootloader install
grub-install
# Can check/modify UEFI firmware entries
efibootmgr # -t 0 for timeout, -b xxxx -B xxxx to delete, etc
# Generate grub.cfg
grub-mkconfig -o /boot/grub/grub.cfg
# Exit chroot
exit
# Rebooten Sie!
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment