Arch Linux Installation

Quick Reference

# Essential installation steps
1. Boot from USB
2. Connect to network (iwctl for WiFi)
3. Partition disk (fdisk/gdisk/cfdisk)
4. Format partitions
5. Mount and pacstrap
6. Generate fstab
7. arch-chroot
8. Configure system
9. Install bootloader
10. Reboot

Pre-Installation

Create Bootable USB

# Download ISO from archlinux.org
# Verify signature
gpg --keyserver-options auto-key-retrieve --verify archlinux-*.iso.sig

# Write to USB (Linux)
sudo dd bs=4M if=archlinux-*.iso of=/dev/sdX status=progress oflag=sync

# Or use ventoy
ventoy -i /dev/sdX
cp archlinux-*.iso /mnt/ventoy/

Boot and Initial Setup

# Set keyboard layout (if not US)
loadkeys de-latin1

# Verify UEFI mode (directory should exist)
ls /sys/firmware/efi/efivars

# Set larger console font (optional, for HiDPI)
setfont ter-132b

Network Configuration

Wired Connection

# Usually automatic via DHCP
ip link    # Check interface
ping archlinux.org

WiFi with iwctl

# Enter iwctl shell
iwctl

# List devices
device list

# Scan for networks
station wlan0 scan
station wlan0 get-networks

# Connect
station wlan0 connect "NetworkName"
# Enter password when prompted

# Exit
exit

# Verify
ping archlinux.org

WiFi with wpa_supplicant

# Alternative method
ip link set wlan0 up
wpa_passphrase "NetworkName" "password" > /etc/wpa_supplicant.conf
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
dhcpcd wlan0

Update System Clock

timedatectl set-ntp true
timedatectl status

Disk Partitioning

Check Disks

# List all disks
lsblk

# Detailed disk info
fdisk -l

# NVMe drives typically: /dev/nvme0n1
# SATA drives typically: /dev/sda

Partition Schemes

Simple UEFI Layout

Partition Size Type Mount Point

/dev/nvme0n1p1

512M-1G

EFI System

/boot

/dev/nvme0n1p2

Remaining

Linux filesystem

/

With Swap Partition

Partition Size Type Mount Point

/dev/nvme0n1p1

512M-1G

EFI System

/boot

/dev/nvme0n1p2

RAM size

Linux swap

[SWAP]

/dev/nvme0n1p3

Remaining

Linux filesystem

/

Separate Home

Partition Size Type Mount Point

/dev/nvme0n1p1

1G

EFI System

/boot

/dev/nvme0n1p2

50-100G

Linux filesystem

/

/dev/nvme0n1p3

Remaining

Linux filesystem

/home

Create Partitions with fdisk

fdisk /dev/nvme0n1

# Commands:
# g - Create new GPT table
# n - New partition
# t - Change partition type
# w - Write and exit

# Create GPT table
Command: g

# Create EFI partition (1GB)
Command: n
Partition number: 1
First sector: (default)
Last sector: +1G
Command: t
Partition type: 1 (EFI System)

# Create root partition (remaining space)
Command: n
Partition number: 2
First sector: (default)
Last sector: (default, uses remaining)

# Write changes
Command: w

Create Partitions with cfdisk (TUI)

cfdisk /dev/nvme0n1

# Select GPT label type
# Create partitions using arrow keys
# Set types: EFI System, Linux filesystem
# Write and quit

Format Partitions

Standard ext4 Setup

# Format EFI partition
mkfs.fat -F32 /dev/nvme0n1p1

# Format root partition
mkfs.ext4 /dev/nvme0n1p2

# If swap partition exists
mkswap /dev/nvme0n1p3
# Format EFI
mkfs.fat -F32 /dev/nvme0n1p1

# Format root with Btrfs
mkfs.btrfs /dev/nvme0n1p2

# Create subvolumes
mount /dev/nvme0n1p2 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@var
btrfs subvolume create /mnt/@snapshots
umount /mnt

# Mount with subvolumes
mount -o noatime,compress=zstd,subvol=@ /dev/nvme0n1p2 /mnt
mkdir -p /mnt/{boot,home,var,.snapshots}
mount -o noatime,compress=zstd,subvol=@home /dev/nvme0n1p2 /mnt/home
mount -o noatime,compress=zstd,subvol=@var /dev/nvme0n1p2 /mnt/var
mount -o noatime,compress=zstd,subvol=@snapshots /dev/nvme0n1p2 /mnt/.snapshots
mount /dev/nvme0n1p1 /mnt/boot

Mount Partitions

Standard Mount

# Mount root
mount /dev/nvme0n1p2 /mnt

# Create and mount boot
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

# Enable swap (if exists)
swapon /dev/nvme0n1p3

# Verify
lsblk

Install Base System

Update Mirror List

# Use reflector for fastest mirrors
reflector --country US --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

# Or manually edit
vim /etc/pacman.d/mirrorlist

Pacstrap Base System

# Minimal installation
pacstrap -K /mnt base linux linux-firmware

# Recommended installation
pacstrap -K /mnt \
    base \
    linux \
    linux-firmware \
    base-devel \
    git \
    neovim \
    sudo \
    networkmanager \
    intel-ucode      # Or amd-ucode for AMD

# For Btrfs
pacstrap -K /mnt btrfs-progs

# For WiFi (laptop)
pacstrap -K /mnt iwd wireless_tools wpa_supplicant

Generate fstab

# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab

# Verify
cat /mnt/etc/fstab

# Edit if needed (especially for Btrfs options)
vim /mnt/etc/fstab

System Configuration

Chroot into System

arch-chroot /mnt

Time Zone

# Set timezone
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

# Generate /etc/adjtime
hwclock --systohc

Localization

# Edit locale.gen
vim /etc/locale.gen
# Uncomment: en_US.UTF-8 UTF-8

# Generate locales
locale-gen

# Set system locale
echo "LANG=en_US.UTF-8" > /etc/locale.conf

# Set keyboard layout (if not US)
echo "KEYMAP=de-latin1" > /etc/vconsole.conf

Network Configuration

# Set hostname
echo "archbox" > /etc/hostname

# Edit hosts file
cat > /etc/hosts << 'EOF'
127.0.0.1   localhost
::1         localhost
127.0.1.1   archbox.localdomain archbox
EOF

# Enable NetworkManager
systemctl enable NetworkManager

Set Root Password

passwd

Create User

# Create user with home directory
useradd -m -G wheel -s /bin/bash username

# Set password
passwd username

# Enable sudo for wheel group
EDITOR=nvim visudo
# Uncomment: %wheel ALL=(ALL:ALL) ALL

Bootloader Installation

# Install bootloader
bootctl install

# Create loader config
cat > /boot/loader/loader.conf << 'EOF'
default arch.conf
timeout 3
console-mode max
editor no
EOF

# Create Arch entry
# Get root partition UUID
blkid -s UUID -o value /dev/nvme0n1p2

cat > /boot/loader/entries/arch.conf << 'EOF'
title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root=UUID=YOUR-UUID-HERE rw quiet
EOF

# For AMD CPU, use amd-ucode.img instead

systemd-boot with Btrfs

cat > /boot/loader/entries/arch.conf << 'EOF'
title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root=UUID=YOUR-UUID-HERE rootflags=subvol=@ rw quiet
EOF

GRUB (Alternative)

# Install GRUB packages
pacman -S grub efibootmgr

# Install GRUB to EFI
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

# Generate config
grub-mkconfig -o /boot/grub/grub.cfg

mkinitcpio Configuration

Basic Configuration

# Edit /etc/mkinitcpio.conf for hooks
vim /etc/mkinitcpio.conf

# Default HOOKS
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)

# Regenerate initramfs
mkinitcpio -P

Btrfs Configuration

# Add btrfs to MODULES
MODULES=(btrfs)

# Regenerate
mkinitcpio -P

NVIDIA Configuration

# Add nvidia modules
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

# Remove kms from HOOKS (for proprietary driver)
HOOKS=(base udev autodetect microcode modconf keyboard keymap consolefont block filesystems fsck)

mkinitcpio -P

Finish Installation

Exit and Reboot

# Exit chroot
exit

# Unmount
umount -R /mnt

# Reboot
reboot

Post-Reboot Checklist

# Login as user

# Connect to network (WiFi)
nmcli device wifi connect "NetworkName" password "password"

# Update system
sudo pacman -Syu

# Install AUR helper
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

# Enable multilib (32-bit support)
sudo vim /etc/pacman.conf
# Uncomment [multilib] section
sudo pacman -Syu

LUKS Encryption (Optional)

Create Encrypted Partition

# Create LUKS container
cryptsetup luksFormat /dev/nvme0n1p2

# Open container
cryptsetup open /dev/nvme0n1p2 cryptroot

# Format the opened container
mkfs.ext4 /dev/mapper/cryptroot

# Mount
mount /dev/mapper/cryptroot /mnt

Configure for Encryption

# Add encrypt hook to mkinitcpio
# /etc/mkinitcpio.conf
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt filesystems fsck)

mkinitcpio -P

# Update bootloader
# /boot/loader/entries/arch.conf
options cryptdevice=UUID=YOUR-LUKS-UUID:cryptroot root=/dev/mapper/cryptroot rw quiet

Dual Boot with Windows

Preserve Windows EFI

# Don't format the existing EFI partition!
# Mount existing Windows EFI
mount /dev/nvme0n1p1 /mnt/boot

# systemd-boot will detect Windows automatically
bootctl install

# Or with GRUB
pacman -S os-prober
# Enable os-prober in /etc/default/grub
GRUB_DISABLE_OS_PROBER=false
grub-mkconfig -o /boot/grub/grub.cfg

Fix Time Sync Issues

# Make Windows use UTC (in Windows registry)
# Or make Linux use local time
timedatectl set-local-rtc 1 --adjust-system-clock

Troubleshooting

Boot Issues

# Boot from USB, mount system
mount /dev/nvme0n1p2 /mnt
mount /dev/nvme0n1p1 /mnt/boot
arch-chroot /mnt

# Rebuild initramfs
mkinitcpio -P

# Reinstall bootloader
bootctl install

No Network After Install

# Enable NetworkManager
systemctl enable --now NetworkManager

# Check interface
ip link

# Connect WiFi
nmcli device wifi list
nmcli device wifi connect "NetworkName" password "password"

Wrong Keyboard Layout

# Set console keymap
echo "KEYMAP=us" > /etc/vconsole.conf

# For X11/Wayland, configure in desktop environment

Quick Install Script

For experienced users, a basic script:

#!/bin/bash
# DANGER: This will erase your disk!
# Customize variables before running

DISK=/dev/nvme0n1
HOSTNAME=archbox
USERNAME=user
TIMEZONE=America/New_York

# Partition
sgdisk -Z $DISK
sgdisk -n 1:0:+1G -t 1:ef00 $DISK
sgdisk -n 2:0:0 -t 2:8300 $DISK

# Format
mkfs.fat -F32 ${DISK}p1
mkfs.ext4 ${DISK}p2

# Mount
mount ${DISK}p2 /mnt
mkdir /mnt/boot
mount ${DISK}p1 /mnt/boot

# Install
pacstrap -K /mnt base linux linux-firmware base-devel git neovim sudo networkmanager intel-ucode

# Configure
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt /bin/bash << CHROOT
ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
hwclock --systohc
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "$HOSTNAME" > /etc/hostname
systemctl enable NetworkManager
bootctl install
CHROOT

echo "Installation complete. Configure user and bootloader entries manually."