~

Install Arch Linux

Install Arch Linux is thing I always want to do for my laptop/PC since I had my laptop in ninth grade.

This is not a guide for everyone, this is just a save for myself in the future and for anyone who want to walk in my shoes.

Installation guide

Pre-installation

Check disks carefully:

lsblk

USB flash installation medium

Verify the boot mode

Check UEFI mode:

cat /sys/firmware/efi/fw_platform_size
# 64 or 32 is UEFI
# No such file or directory is BIOS

Unified Extensible Firmware Interface/Secure Boot/Disabling Secure Boot

Connect to the internet

For wifi, use iwd.

Partition the disks

GPT fdisk:

cgdisk /dev/sdx

UEFI/GPT layout:

Mount point Partition Partition type Suggested size gdisk code
/mnt/efi /dev/efi_system_partition EFI System Partition 512 MiB EF00
/mnt/boot /dev/extended_boot_loader_partition Extended Boot Loader Partition (XBOOTLDR) 1 GiB EA00
/mnt /dev/root_partition Root Partition 8300

Why not /boot/efi? See Lennart Poettering comment.

BIOS/GPT layout:

Mount point Partition Partition type Suggested size gdisk code
BIOS boot partition 1 MiB EF02
/mnt /dev/root_partition Root Partition 8300

Format:

# efi
mkfs.fat -F32 /dev/efi_system_partition

# boot
mkfs.fat -F32 /dev/extended_boot_loader_partition

# root
mkfs.ext4 -L ROOT /dev/root_partition

# root with btrfs (optional)
mkfs.btrfs -L ROOT /dev/root_partition

Mount:

# root
mount /dev/root_partition /mnt

# root with btrfs (optional)
mount -o compress=zstd /dev/root_partition /mnt

# efi
mount --mkdir /dev/efi_system_partition /mnt/efi

# boot
mount --mkdir /dev/extended_boot_loader_partition /mnt/boot

Installation

Please check Mirrors if you have slow Internet.

pacstrap -K /mnt base linux linux-firmware

# AMD (optional)
pacstrap -K /mnt amd-ucode

# Intel (optional)
pacstrap -K /mnt intel-ucode

# Btrfs (optional)
pacstrap -K /mnt btrfs-progs

# Text editor
pacstrap -K /mnt neovim

Configure

fstab

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

Chroot

arch-chroot /mnt

Time

# Change Region/City to your location
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

hwclock --systohc

Localization

Edit /etc/locale.gen then uncomment # en_US.UTF-8 UTF-8 by removing # at the beginning.

Generate locales:

locale-gen

Edit /etc/locale.conf:

LANG=en_US.UTF-8

Network configuration

Edit /etc/hostname:

myhostname

Initramfs

Edit /etc/mkinitcpio.conf:

# https://wiki.archlinux.org/title/mkinitcpio#Common_hooks
# Replace base udev with systemd
#
HOOKS=(systemd ... )
mkinitcpio -P

Root password

passwd

NetworkManager

pacman -Syu networkmanager iwd
systemctl enable NetworkManager.service
systemctl enable systemd-resolved.service

Edit /etc/NetworkManager/conf.d/wifi_backend.conf:

[device]
wifi.backend=iwd

Edit /etc/NetworkManager/conf.d/dns.conf:

[main]
dns=systemd-resolved

Bluetooth

pacman -Syu bluez
systemctl enable bluetooth.service

Clock

Use systemd-timesyncd

timedatectl set-ntp true

timedatectl status

Boot loader

Use systemd-boot

Install using XBOOTLDR:

bootctl --esp-path=/efi --boot-path=/boot install

systemctl enable systemd-boot-update.service

Label partition

Edit /efi/loader/loader.conf:

default	archlinux.conf
timeout 4
editor no
console-mode max

Edit /boot/loader/entries/archlinux.conf:

title Arch Linux
linux /vmlinuz-linux

# Intel (optional)
initrd /intel-ucode.img

# AMD (optional)
initrd /amd-ucode.img

initrd /initramfs-linux.img

# Kernel parameters (optional)
#
# Acer Nitro AN515-45
# https://wiki.archlinux.org/title/backlight#Kernel_command-line_options
# acpi_backlight=vendor
#
# NVIDIA
# https://wiki.archlinux.org/title/NVIDIA#DRM_kernel_mode_setting
# nvidia-drm.modeset=1
#
options root="LABEL=ROOT" rw quiet loglevel=3 nowatchdog module_blacklist=iTCO_wdt,sp5100_tco ipv6.disable=1 init_on_alloc=1 init_on_free=1 page_alloc.shuffle=1

General recommendations

Always remember to check dependencies when install packages.

System administration

Sudo:

pacman -Syu sudo zsh

EDITOR=nvim visudo
# Uncomment group wheel

# Add user if don't want to use systemd-homed
useradd -m -G wheel -s /usr/bin/zsh joker

# Set password
passwd joker
systemctl enable systemd-homed.service
homectl create joker --shell=/usr/bin/zsh --member-of=wheel

Note: Can not run homectl when install Arch Linux. Should run on the first boot.

Desktop Environment

KDE

See KDE Distributions/Packaging Recommendations

pacman -Syu plasma-desktop

# Login manager
pacman -Syu sddm

List of applications

pacman

Uncomment in /etc/pacman.conf:

# Misc options
Color
ParallelDownloads
systemctl enable paccache.timer

Pipewire

pacman -Syu pipewire wireplumber \
	pipewire-alsa pipewire-pulse

See Advanced Linux Sound Architecture/Firmware

Flatpak

pacman -Syu flatpak

Improving performance

See systemd/Journal/Journal size limit. Edit /etc/systemd/journald.conf.d/00-journal-size.conf then restart systemd-journald.service:

[Journal]
SystemMaxUse=50M

See Core dump/Disabling automatic core dumps. Edit /etc/systemd/coredump.conf.d/custom.conf then restart:

[Coredump]
Storage=none
ProcessSizeMax=0
tune2fs -O fast_commit /dev/partition

See Solid state drive/Periodic TRIM:

systemctl enable fstrim.timer

Edit /etc/sysctl.d/99-sysctl.conf:

# Enable TCP Fast Open
net.ipv4.tcp_fastopen = 3

kernel.split_lock_mitigate = 0

Hardware

Experiment

Do it at your own risk!!!

Feel free to ask me via email or Mastodon.
Source code is available on GitHub Codeberg sourcehut Treehouse GitLab