Pre-installation

Since this guide is about my personal install, and since I don’t keep sensitive and private data in my personal hard drive, I won’t be encrypting my whole partitions with LUKS, and I’ll use be using other solutions instead (EncFS or gocryptfs or maybe GnuPG), to encrypt the files and folders I feel they should not be seen by someone else πŸ˜….

For my disk I use LVM with ext4 Btrfs. Btrfs offers online resize/shrink out of the box, also it supports snapshoting and volume management as well.

Archiso setup

  • Disable annoying beep
rmmod pcspkr
  • Check UEFI support, and create a EFI system partition with fdisk or any other partitionning tool (it should be of type EFI System and formated to FAT32)
ls /sys/firmware/efi/efivars
efivar --list
  • Connect to the internet
iwctl station wlan0 scan
iwctl station wlan0 get-networks
iwctl station wlan0 connect <>
  • Make sure the system clock is accurate
timedatectl set-ntp true

Disk preparation and installation

  • Partition the disk and format it: I create 3 partitions: one for swap, one for linux fs and one for EFI.
cfdisk /dev/nvme0n1 # create 3 partitions: Swap, ESP and one for Btrfs.
mkfs.vfat -F32 -n EFI /dev/nvme0n1p1
mkfs.btrfs -L arch_os /dev/nvme0n1p3
mkswap /dev/nvme0n1p2
  • Mount the btrfs root volume, and create subvolumes, then unmount it.
mount /dev/nvme0n1p3 /mnt
btrfs sub create /mnt/@
btrfs sub create /mnt/@home
btrfs sub create /mnt/@snapshots
unmount /mnt

link 1 | link 2

  • Mount the btrfs subvolumes, and boot partition and start the fun.
mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@ /dev/nvme0n1p3 /mnt
mkdir /mnt/{home,.snapshots,boot}
mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@home /dev/nvme0n1p3 /mnt/home
mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@snapshots /dev/nvme0n1p3 /mnt/.snapshots
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/nvme0n1p2
  • Install Arch using the pacstrap script
pacstrap /mnt base base-devel linux linux-firmware neovim zsh btrfs-progs iwd
  • Generate the fstab
genfstab -U / >> /mnt/etc/fstab # -U for UUIDs

Chroot and beyond

Now our OS is installed, so we need to setup it and configure basic things.

arch-chroot /mnt
  • Disable the annoying beep
echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf

System configuration (Host and Locale)

  • Configure a locale

    • Uncomment the locales in /etc/locale.gen and execute locale-gen
    • Set LANG=en_US.UTF-8 in /etc/locale.conf
  • Set Timezone

ln /usr/share/zoneinfo/[timezone] /etc/localtime
hwclock --systohc
  • Set the hostname
echo [Hostname] > /etc/hostname

User configuration

  • Add root pass and add users
passwd
useradd -m -G [additional_groups] -s [Shell] [username]
passwd [username]
export EDITOR=nvim visudo
  • Configure some sudo
%wheel ALL=(ALL) ALL
guru ALL=(ALL) NOPASSWD: ALL # security_level=-999 :p

Bootloader configuration

  • Install a bootloader and configure it, I use bootctl.
bootctl --path=/boot install
  • Add an entry for our kernel in loader/entries/arch.conf
title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img # /amd-ucode.img
initrd  /initramfs-linux.img
options root=LABEL=arch_os rootflags=subvol=@ rw
  • Update bootctl on system upgrades.
systemctl enable systemd-boot-update.service
#/etc/pacman.d/hooks/100-systemd-boot.hook
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd

[Action]
Description = Gracefully upgrading systemd-boot...
When = PostTransaction
Exec = /usr/bin/systemctl restart systemd-boot-update.service
  • Add btrfs to /etc/mkinitcpio.conf
# /etc/mkinitcpio.conf
HOOKS="...btrfs filesystems..."
mkinitcpio -p linux

Network Configurations

  • First we enable network services.
systemctl enable --now systemd-networkd.service
systemctl enable --now systemd-resolved.service
systemctl enable --now iwd.service
  • Create network configurations for wired and wireless connections. For wired /etc/systemd/network/20-wired.network
[Match]
Name=enp1s0

[Network]
DHCP=yes

For wireless /etc/systemd/network/25-wireless.network

[Match]
Name=wlan0

[Network]
DHCP=yes

link

Appendix

My old LVM setup

  • Create lvm physical volumes, volume groups and logical volumes. In my case I have one disk with only one partition.
pvcreate /dev/sda1
vgcreate vg1 /dev/sda1
lvcreate -L 200M -n boot vg1
lvcreate -L 20G -n root vg1
lvcreate -L 4G -n swap vg1
lvcreate -l 100%FREE -n home vg1
  • Format the volumes and activate swap. In my case I use ext4 because it works fine for me, and it is stable af.
mkfs.ext4 /dev/vg1/root
mkfs.ext4 /dev/vg1/home
mkswap /dev/vg1/swap
swapon /dev/vg1/swap

GRUB setup

  • Install grub in boot partition and generate a config.
grub-install --target=i386-pc /dev/sdX
grub-mkconfig -o /boot/grub/grub.cfg

Old configuration

After rebooting the computer, and installing packages, we start configuring stuff.

  • Unmute alsa channels
amixer sset Master unmute | alsamixer
  • Start netctl auto and ifplug for automatic connections
systemctl start netctl-ifplugd@[interface].service
systemctl start netctl-auto@[interface].service
  • Enable vbox kernel modules
systemd-modules-load.service & modprobe vboxdrv