Wednesday, October 5, 2022

Archlinux from scratch

This guide is a convenient combination of Offical Arch Linux Installation Guide and Ermanno's amazing guide.

Github repo:

Important: This is an installation with the latest & greatest tools available (2022). For more robust installation (Xorg, Swap partition, etc.), please refer to my robust Arch linux installation guide.

Base system components

Minimal desktop GUI with native Wayland support:


Step 1: boot from USB drive with Arch ISO

Step 2: prepare the disk (partitions) - using GPT device

# check the disks

# partition the disk - create GPT Labels
gdisk /dev/***

# choose new GPT Label command:

# First Partition for EFI
# choose new command:
# choose default partition number
# choose default First Sector memory
# choose Last Sector memory:
# enter the EFI partition code:

# Second Partition for main SSD storage
# choose new command
# choose default partition number
# choose default First Sector memory
# choose Last Sector memory:
(remaining SSD space - 2 GB)G
# choose default partition type (Linux Filesystem)

# Choose "write" command to overwrite exiting partitions:

Step 3: format partitions

# make fat32 filesystem for EFI
mkfs.vfat /dev/***1
# make butterFS filesystem for main storage
mkfs.btrfs  /dev/***2

Step 4: butterFS configuration

# mount main partition - root subvolume
mount  /dev/***2 /mnt

cd /mnt
# make btrFS subvolume for root subvolume
btrfs subvolume create @
# make btrFS subvolume for home subvolume
btrfs subvolume create @home
# make btrFS subvolume for var subvolume
btrfs subvolume create @var

# unmount main partition - root subvolume
umount /mnt

# mount root subvolume
mount -o noatime, compress=zstd, space_cache,discard=async,subvol=@ /dev/***2 /mnt

# directories var, home & var
mkdir -p /mnt/boot/efi
mkdir /mnt/{home,var}

# mount home & var subvolumes
mount -o noatime, compress=zstd, space_cache,discard=async,subvol=@home /dev/***2 /mnt/home

mount -o noatime, compress=zstd, space_cache,discard=async,subvol=@var /dev/***2 /mnt/var

Step 5: mount EFI partition

mount /dev/***1 /mnt/boot/efi

Step 6: install the base system

# for amd processor: amd-ucode instead of intel-ucode
pacstrap /mnt base linux linux-firmware git vim intel-ucode btrfs-progs

Step 7: generate filesystem table

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

Step 8: make new root directory with all mounts needed

# detach from main filesystem and process tree
arch-chroot /mnt

# check the fs & table
cat /etc/fstab

Step 9: run base archlinux system intall script

# give exec permissions to script
git clone
cd arc-arch-linux-installation-guide
# don't forget to change username & password to yours :)
chmod +x

# run from root filesystem
cd /

# choose xdr-desktop-portal-wlr (to use with Sway)

Step 10: check system init config

vim /etc/mkinitcpio.conf
# if butterFS used on 2 disks - put "btrfs" parameter in MODULES
# if amd or nvidia card is used - put "amdgpu" or "nvidia" parameters in MODULES accordingly

# if config was changed, recreate initramfs:
mkinitcpio -p linux

Step 11: finish base packages installation

umount -a

Step 12: install Desktop GUI & tools

# copy the guide from root filesystem to home repository
cp -r /arc-arch-linux-installation-guide .
cd /arc-arch-linux-installation-guide

# give exec permissions to script
chmod +x

# go back to home directory
cd ..

Step 13: configure ZRAM (used for SWAP)

paru -S zramd
sudo systemctl enable --now zramd.service

# check the block devices table

Creative Commons Licence