Arch Install

Objective

This file contains my notes for installing Arch Linux.

Prep

Backup

Most of my configs are in IaC so I just need to backup my user data. Big things for me is backing up my Minecraft worlds, ssh keys and 3D printer configs.

Ansible

Go over my ansible roles to make sure I have everything I think I need. I test them to make sure that they are working.

Boot USB

I downloaded the Arch iso and put it on a USB stick I had kicking around. dd is how I flashed the USB drive.

Install

Connect to Wifi

Use iwctl to connect to your wireless access point

1# config network with iwctl
2iwctl
3station $DEVICE scan
4station $DEVICE get-networks
5station $DEVICE connect $SSID

Disk Setup / File System

I opted for a btrfs setup on this new install. I keep this table as a cheat sheet as to what I actually need.

Partition Mount Point Size
required boot /mnt/boot 1GB
required root /mnt 8GB+
optional home /mnt/home 1G+

For my actual disk setup, here is another table laying that out.

Partition Mount Point Size SubVol
boot /boot 1GB
root / 967GB+ @
/var/log @log
/var/cache/pacman/pkg @pkg
home /home/brandonia 3.6TB+ @home

I use cfdisk to partition the disk and create the filesystems

1# format partitions
2cfdisk $DEVICE
3
4# create vfat partition
5mkfs.vfat -F32 $DEVICE
6
7# create btrfs filesystem
8mkfs.btrfs -L archlinux $DEVICE

We then will mount and create the subvolumes

 1# mount main btrfs
 2mount $DEVICE /mnt
 3
 4# create subvolumes
 5btrfs subvol create /mnt/@
 6btrfs subvol create /mnt/@log
 7btrfs subvol create /mnt/@pkg
 8
 9# unmount main btrfs
10umount /mnt
NOTE
I found it to work best if you mount the main btrfs at the device level, create the subvolumes, then dismount and remount them where they need to go.
 1# make mount directories
 2mkdir -p /mnt/{boot,var/log,var/cache/pacman/pkg}
 3
 4# mount boot partition
 5mount $DEVICE /mnt/boot
 6
 7# mount subvolumes
 8mount -o compress=zstd,subvol=@ $DEVICE /
 9mount -o compress=zstd,subvol=@log $DEVICE /var/log
10mount -o compress=zstd,subvol=@pkg $DEVICE /var/cache/pacman/pkg
11mount -o compress=zstd,subvol=@home $DEVICE /home/brandonia

Pacstrap

1pacstrap /mnt base base-devel linux linux-headers linux-firmware vim \
2              networkmanager amd-ucode btrfs-progs

Generate fstab

  • Sanity check
1# generate fstab
2genfstab -U -p /mnt >> /mnt/etc/fstab

Chroot

1arch-chroot /mnt

mkinitcpio

edit HOOKS section in /etc/mkinitcpio and add btrfs

1HOOKS=(. . . block filesystems btrfs . . .)

run mkinitcpio

1mkinitcpio -p linux

Set locale

1# edit config file
2vim /etc/locale.gen
3
4# generate local
5locale-gen

Set timezone

1# link your localtime
2ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
3
4# sync system to hardware clock
5hwclock --systohc --utc

Networking

  • Enable NetworkManager.service
  • Start service
  • nmtui to set up wifi or manage connections

Create users and groups and set passwords

  • Set root password
  • Add your User
1useradd -m -g users -G wheel $USER
  • change password
  • visudo and edit the sudoer file to let users in the group wheel be able to execute with root priveleges

systemd bootloader

systemd boot just felt like it makes more sense to my brain so I set that up

1# install bootloader
2bootctl install

Configure the /boot/loader/loader.conf

1default arch.conf
2timeout 3
3console-mode max
4editor no

Configure /boot/loader/entries/arch.conf

1title   Arch Linux
2linux   /vmlinuz-linux
3initrd  /amd-ucode.img
4initrd  /initramfs-linux.img
5options root=UUID=YOUR_PARTITION_UUID rootflags=subvol=@ rw quiet zswap.enabled=0
NOTE
Create /etc/pacman.d/hooks if it doesnt exist.

zram

Install zram-generator and configure /etc/systemd/zram-generator.conf

1[zram0]
2zram-size = ram / 2
3compression-algorithm = zstd

Verify after reboot with swapon --summary