Skip to content

Instantly share code, notes, and snippets.

@JoelLisenby
Last active October 31, 2022 06:51
Show Gist options
  • Save JoelLisenby/8ad1b28b14b8ce6395be175b6dcb45d5 to your computer and use it in GitHub Desktop.
Save JoelLisenby/8ad1b28b14b8ce6395be175b6dcb45d5 to your computer and use it in GitHub Desktop.
Arch Linux Install

Minimal Install Arch Linux with UEFI / EFISTUB

Download Arch Linux ISO https://www.archlinux.org/download/

Create USB stick

From Windows use rufus https://rufus.akeo.ie/

From Linux use dd where sdx is your USB drive. Run fdisk -l to find your usb stick.

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync

Boot to USB drive

ls /sys/firmware/efi/efivars to ensure you are booted in UEFI mode, if the dir does not exist, refer to your motherboards manual for how to boot in UEFI mode.

Create Partitions

  1. fdisk -l to list disks on your system.
  2. fdisk /dev/sdx where sdx is your chosen install drive.

Warning: the below commands will delete all data on your install drive

  1. Create a new GPT partition table with g
  2. Create EFI partition with n 512MiB
  3. Create root partition with n the rest of the drive or whatever size you want for the root (/) partition.
  4. Write to disk with w

Format Partitions

Where sdxa = your EFI partition, sdxb = your root (/) partition

  1. Format EFI partition mkfs.fat -F32 /dev/sdxa
  2. Format root partition mkfs.ext4 /dev/sdxb

Connect to the Internet

Run ip link to list network interfaces. Wired should work out of the box.

For Wireless

  1. cp /etc/netctl/examples/wireless-wpa /etc/netctl/wireless
  2. nano /etc/netctl/wireless edit lines Interface=wlan0 (replace with your interface name), ESSID=YOURSSID and Key=YOURWIRELESSKEY.
  3. netctl enable wireless
  4. netctl start wireless
  5. Test with ping archlinux.org

Install Arch Linux

  1. mount /dev/sdxb /mnt where /dev/sdxb is your root (/) partition.
  2. genfstab -U /mnt >> /mnt/etc/fstab to generate fstab.
  3. pacstrap /mnt base to install base packages.

chroot into the new install with arch-chroot /mnt

Configure settings

  1. timedatectl set-ntp true automatic date/time.
  2. ln -sf /usr/share/zoneinfo/Region/City /etc/localtime use your region/city for localization.
  3. hwclock --systohc
  4. locale-gen
  5. nano /etc/locale.conf and add LANG=en_US.UTF-8 for en_US, UTF-8
  6. nano /etc/hostname and set to your desired hostname

Install Software with pacman

  1. nano /etc/pacman.d/mirrorlist and remove # from the mirror of your choice.
  2. Install any of your desired packages with pacman -S package-name

Create SWAP file

  1. fallocate -l 512M /swap
  2. chmod 600 /swap
  3. mkswap /swap
  4. swapon /swap

Configure EFISTUB / no boot loader method

  1. Create /boot directory mdkir /boot
  2. Mount EFI partition to /boot mount /dev/sdxa /boot
  3. Create /esp/EFI/arch mkdir -p /esp/EFI/arch
  4. Bind mount /esp/EFI/arch to /boot so pacman can install kernel updates automatically.

Run mount --bind /esp/EFI/arch/ /boot

So they take effect at boot, add partitions and swap to fstab nano /etc/fstab

# /dev/sdxb (root /)
UUID=ROOTPARTUUID / ext4 rw,relatime,data=ordered 0 1
# /dev/sdxa (EFI)
UUID=EFIPARTUUID /esp vfat defaults 0 0
# bind mount /esp/EFI/arch to /boot
/esp/EFI/arch /boot none defaults,bind 0 0
# mount swap file
/swap none swap defaults 0 0

If using an intel CPU, install intel-ucode with pacman -S intel-ucode

/boot and bind mounted /esp/EFI/arch/ will be the location for intel-ucode.img.

Configure UEFI boot entries

Boot to the USB stick in UEFI mode (important), then enter UEFI Shell v2.

-b paginates output so you can view one page at a time.

List boot entries with bcfg boot dump -v -b

List drive mappings with map -b

Add your entry with bcfg boot add 3 fs1:\EFI\arch\vmlinuz-linux "Arch Linux" where fs1 is the EFI partition and 3 is next available entry number.


If Intel CPU, add options for intel-ucode

  1. Create options.txt text file with edit fs1:\EFI\arch\options.txt
  2. Enter the following content into options.txt where sdxb is your linux root (/) partition
initrd=\EFI\arch\intel-ucode.img initrd=\EFI\arch\initramfs-linux.img root=/dev/sdxb
  1. Add to the UEFI entry you created above with bcfg boot add -opt 3 fs1:\EFI\arch\options.txt where 3 is the entry and fs1 is the EFI partition.

Move entry to first position with bcfg boot mv 3 0 where 3 is the current position and 0 is the new position.


If you need to start over, you can remove entries with bcfg boot rm 3 where 3 is the entry to delete.

@JoelLisenby
Copy link
Author

You're welcome! Glad it helped you out. I put this together to make it faster for myself in the future because it took me a while going through each of the arch linux wiki pages in order to get UEFI working on my laptop. It's nice not requiring a separate bootloader like grub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment