Guide to install Arch Linux on an EFI system. Uses the following features:
- Btrfs with
@,@home,@cache,@log, and@swapsubvolumes - Swapfile
- Snapshots using Timeshift
- GRUB bootloader with bootable snapshots
- GNOME desktop environment
- GDM display manager
NOTE: This guide is mainly for educational purposes. For a practical Arch Linux installation, use EndeavourOS as it performs most of these steps automatically.
Enable network time sync.
timedatectl set-ntp trueSync with the Arch servers and install reflector.
pacman -Sy reflector rsyncBackup the previous mirror list. Then use reflector to save the fastest pacman mirrors. Use your county name. This is mostly likely US. This will take some time.
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
reflector -c US -l 200 -f 6 --sort rate --connection-timeout 1 --download-timeout 1 --verbose --save /etc/pacman.d/mirrorlistEdit the pacman configuration to enable parallel downloads and color.
vim /etc/pacman.conf- #ParallelDownloads
- #Color
+ ParallelDownloads
+ ColorList your current disks.
lsblk -pChoose the disk you want to erase, format, and install Arch Linux on. This is typically /dev/sda, /dev/nvme0n1, or /dev/vda. Run sgdisk to wipe the disk and then gdisk to start partitioning.
sgdisk -Z /dev/vda
gdisk /dev/vdaCreating each partition in gdisk is 3 steps. Choose the partition start, choose the partition size, and choose the partition type.
Type n and hit enter to create a new partition. Hit enter to leave the defaults for the partition start. Type +512M and hit enter to create a 512MB size partition (this can be smaller but 512MB is recommended for Windows dual booting). Type ef00 and hit enter to choose EFI partition type.
Type n and hit enter to create a new partition. Hit enter to leave the defaults for the partition start. Hit enter to use the remainder of the disk. Hit enter to choose the default partition type.
Type w and hit enter to write and save the partitioning.
List your current disks partitions.
lsblk -pRemember the device names for the EFI and root partitions. This is typically as follows.
| Type | EFI Partition | Root Partition |
|---|---|---|
| SATA Disks | /dev/sda1 |
/dev/sda2 |
| NVMe Disks | /dev/nvme0n1p1 |
/dev/nvme0n1p2 |
| Virtual Machines | /dev/vda1 |
/dev/vda2 |
The instructions will use /dev/vda, but use what is specific to your machine.
Format the EFI partition as FAT32.
mkfs.vfat -F32 /dev/vda1Format the root partition as btrfs.
mkfs.btrfs /dev/vda2Verify everything mounted correctly using lsblk.
Mount the root partition onto /mnt.
mount /dev/vda2 /mntCreate btrfs subvolumes for @, @home, @cache, @log, and @swap.
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@cache
btrfs subvolume create /mnt/@log
btrfs subvolume create /mnt/@swapUmount the root partition
umount /mntChoose the Btrfs optimization options you want. The following are recommended: noatime,compress=zstd:1,space_cache=v2. If running on an SSD, also use ssd. If running on an HDD, also use autodefrag. Mount the root partition using these optimization options.
mount -o noatime,compress=zstd:1,space_cache=v2,ssd,subvol=@ /dev/vda2 /mntCreate directories for the EFI partition, recovery partition, and each of the subvolumes.
mkdir -p /mnt/{boot/efi,recovery,home,var,swap}Mount each of the subvolumes except swap using the same options to the corresponding directories.
mount -o noatime,compress=zstd:1,space_cache=v2,ssd,subvol=@home /dev/vda2 /mnt/home
mount -o noatime,compress=zstd:1,space_cache=v2,ssd,subvol=@cache /dev/vda2 /mnt/var/cache
mount -o noatime,compress=zstd:1,space_cache=v2,ssd,subvol=@log /dev/vda2 /mnt/var/logMount the EFI partition onto the /boot/efi directory.
mount /dev/vda1 /mnt/boot/efiVerify everything is mounted correctly using lsblk.
Mount the swap subvolume to the /swap directory with only the noatime and ssd optimization options.
mount -o noatime,ssd,subvol=@swap /dev/vda2 /mnt/swapDisable copy-on-write for the @swap subvolume.
sudo chattr -R +C /mnt/swapCreate the swapfile, disable copy-on-write, disable compression, and allocate it to 4GB.
touch /mnt/swap/swapfile
chattr +C /mnt/swap/swapfile
btrfs property set /mnt/swap/swapfile compression none
dd if=/dev/zero of=/mnt/swap/swapfile bs=1M count=4096 status=progressSet permissions, format the swapfile, and activate it.
chmod 600 /mnt/swap/swapfile
mkswap /mnt/swap/swapfile
swapon /mnt/swap/swapfileVerify everything is mounted correctly using lsblk.
Use pacstrap to install the base packages. If you have an Intel CPU, use intel-ucode. If you have an AMD CPU, use amd-ucode. This will take some time.
pacstrap /mnt base linux linux-firmware sudo vim nano git intel-ucode btrfs-progsCreate the file system table.
genfstab -U /mnt >> /mnt/etc/fstabEnter the installed system.
arch-chroot /mntEdit the file system table for the swap subvolume. Remove all Btrfs flags except rw, noatime, subvolid, and subvol flags.
vim /etc/fstab- rw,noatime,compress=zstd:1,ssd,space_cache=v2,subvolid=261,subvol=/@swap
+ rw,noatime,subvolid=261,subvol=/@swapEnable network time sync.
timedatectl set-ntp trueSet your timezone. If you are in the United States East Coast, it is America/New_York.
timedatectl set-timezone America/New_YorkSync the hardware clock.
hwclock --systohcEdit the locale gen to enable United States English UTF-8.
vim /etc/locale.gen- #en_US.UTF-8 UTF-8
+ en_US.UTF-8 UTF-8Regenerate the locale file.
locale-genSet the locale language, time, and keyboard.
localectl set-locale LANG="en_US.UTF-8"
localectl set-locale LC_TIME="en_US.UTF-8"
localectl set-keymap usSet the hostname.
vim /etc/hostname+ archSet the host.
vim /etc/hosts+ 127.0.0.1 localhost
+ ::1 localhost
+ 127.0.1.1 arch.localdomain archEdit the pacman configuration to enable parallel downloads and color.
vim /etc/pacman.conf- #ParallelDownloads
- #Color
+ ParallelDownloads
+ ColorSync to the Arch servers and update packages.
pacman -SyuInstall the necessary Arch packages. This will take some time.
# basic packages
pacman -S base-devel linux-headers reflector rsync bash-completion
# bootloader
pacman -S grub grub-customizer efibootmgr os-prober
# network
pacman -S networkmanager network-manager-applet dialog wpa_supplicant
# network utilities
pacman -S inetutils avahi bind openssh firewalld
# audio
pacman -S pipewire pipewire-alsa pipewire-pulse pipewire-jack alsa-utils
# file systems
pacman -S dosfstools exfatprogs e2fsprogs ntfs-3g nfs-utils gvfs gvfs-smb mtools
# desktop utilities
pacman -S xdg-user-dirs xdg-utils
# bluetooth
pacman -S bluez bluez-utils
# power management
pacman -S acpi acpi_call acpid tlp
# fonts
pacman -S awesome-terminal-fonts noto-fonts-emoji powerline-fonts terminus-font
# printer
pacman -S cupsEnable the services on system startup.
systemctl enable NetworkManager
systemctl enable sshd
systemctl enable avahi-daemon
systemctl enable reflector.timer
systemctl enable firewalld
systemctl enable acpid
systemctl enable fstrim.timer # only on SSD
systemctl enable bluetooth # optional bluetooth
systemctl enable tlp # only on laptops
systemctl enable cups # optional printerEdit the mkinit config to enable Btrfs.
vim /etc/mkinitcpio.conf- MODULES=()
+ MODULES=(btrfs)Regenerate the ramdisk init environment.
mkinitcpio -p linuxInstall the GRUB bootloader.
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUBEdit the GRUB configs to fix the resolution and enable OS prober.
vim /etc/default/grub- #GRUB_GFXMODE=auto
- #GRUB_DISABLE_OS_PROBER=false
+ GRUB_GFXMODE=1920x1080,auto
+ GRUB_DISABLE_OS_PROBER=falseGenerate the GRUB config.
grub-mkconfig -o /boot/grub/grub.cfgCreate the user account and update the password. Replace user with the username.
useradd -mG wheel user
passwd userEdit the sudoers to enable sudo access for the user.
EDITOR=vim visudo- #%wheel ALL=(ALL) ALL
+ %wheel ALL=(ALL) ALLDisable root.
passwd -l rootThe system is now installed. Exit out of the chroot environment, umount all disks, remove the live ISO, and reboot.
exit
umount -a
reboot nowBoot through GRUB and log in to the command line interface.
Install the necessary display drivers.
# Intel
sudo pacman -S xf86-video-intel mesa vulkan-intel
# AMD
sudo pacman -S xf86-video-amdgpu mesa vulkan-radeon
# Nvidia
sudo pacman -S nvidia nvidia-utilsInstall all Xorg packages.
sudo pacman -S xorgInstall the GDM display manager and GNOME desktop environment. This will take some time.
sudo pacman -S gdm gnome gnome-extraEnable GDM for the login manager.
sudo systemctl enable gdmReboot the system and login.
sudo reboot nowDownload and install an AUR helper. The recommended ones are yay and paru.
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -siInstall Timeshift from the AUR.
yay -S timeshiftLaunch Timeshift and select the backup frequency. It is recommended to enable daily, weekly, and monthly snapshots.
(Optional) Install the timeshift-autosnap package to automatically create snapshots when using the package manager.
yay -S timeshift-autosnapInstall grub-btrfs.
sudo pacman -S grub-btrfsEdit the grub-brtfs config to use Timeshift instead of Snapper.
sudo EDITOR=vim systemctl edit --full grub-btrfsd- ExecStart=/usr/bin/grub-btrfsd --syslog /.snapshots
+ ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-autoEnable the grub-btrfs daemon.
sudo systemctl enable --now grub-btrfsdCreate a new snapshot in Timeshift and reboot. This should now automatically appear in the GRUB menu as a bootable snapshot.