Kiss my Arch
Essentially, this is a short guide for a minimal Arch Linux installation with UEFI enabled and using the BTRFS filesystem.
For the most part, installation goes as described in the excellent Arch installation guide. Here, I will just point out the specifics or differences regarding that guide.
Partitioning⌗
As we are dealing with an UEFI system, we need a separate efi partition. So our first partition we create with fdisk will be a 512M sized partition of type 1.
Afterwards we are creating a swap partition. This could be left out in favor of a swapfile, which is more flexible, but personally I think a static swap partition is a create an forget type of thing, since todays RAM-sizes are huge an we essentially only need it for emergencies or certain sleep modes. Therefore we just go with a swap partition with the same G-size as our system memory and type 19 (Linux swap). Lastly, we need a root partition, that can use the remaining space.
Formatting⌗
The EFI partition needs to be a FAT32 partition.
mkfs.vfat -F 32 -n EFI /dev/sda1
The SWAP-partition needs a special format:
mkswap -L SWAP /dev/sda2
swapon /dev/sda2
For the root-partition, we will create a BTRFS-filesystem:
mkfs.btrfs -L ROOT /dev/sda3
For a raid data partition (i.e. in the server), we create a big BTRFS-filesystem over multiple devices.
mkfs.btrfs -L DATA -d raid1 -m raid1 /dev/sdb /dev/sdc /dev/sdd
Creating subvolumes⌗
We can devide our ROOT partition into several subvolumes which are handy for snapshotting different things later on.
mount /dev/sda3 /mnt
cd /mnt
btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @pkg
btrfs subvolume create @snapshots
btrfs subvolume create @docker # only if using docker
cd ..
umount /mnt
Mounting subvolumes⌗
Now we can mount our newly created subvolumes to the final mount points. First we mount our root subvolume (@) to mnt.
mount -o noatime,compress=zstd,subvol=@ /dev/sda3 /mnt
Afterwards we create the needed mountpoints in there for the other subvolumes and our EFI partition and mount them.
mkdir -p /mnt/boot
mkdir -p /mnt/home
mkdir -p /mnt/var/cache/pacman/pkg
mkdir -p /mnt/.snapshots
mkdir -p /mnt/var/lib/docker
mount /dev/sda1 /mnt/boot
mount -o noatime,compress=zstd,subvol=@home /dev/sda3 /mnt/home
mount -o noatime,compress=zstd,subvol=@pkg /dev/sda3 /mnt/var/cache/pacman/pkg
mount -o noatime,compress=zstd,subvol=@snapshots /dev/sda3 /mnt/.snapshots
mount -o noatime,compress=zstd,subvol=@docker /dev/sda3 /mnt/var/lib/docker
Installing base system⌗
First, we remove all unwanted mirrors from /etc/pacman.d/mirrorlist. This can be a huge performance boost, if you get the right mirror to the top!
Now we can bootstrap our system by using:
pacstrap /mnt base linux linux-firmware btrfs-progs neovim dhcpcd openssh fish sudo
Generating fstab⌗
An initial fstab can be generated by
genfstab -U /mnt >> /mnt/etc/fstab
Afterwards, we need to clean the generated fstab and remove duplicate subvol entries.
Chroot into the new system⌗
The next parts are executed directly in the new system. For this we chroot into it with
arch-chroot /mnt
This way, we can work in the new system like it would be booted already.
Adding neovim⌗
Since we installed neovim in the bootstrap already, we should link it to vi, after chrooting to our new system.
ln -s /usr/bin/nvim /usr/bin/vi
Bootmanager⌗
We will be using systemd-boot, since it is already included and is a pretty easy to use bootloader. To install it, we call
bootctl --path=/boot install
Change /boot/loader/loader.conf to
default arch.conf
timeout 4
console-mode max
editor no
Create loader entry /boot/loader/entries/arch.conf with following content
title Arch Linux (live)
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root="LABEL=ROOT" rootflags="subvol=@" rw
Enabling services⌗
Before leaving the chroot we should enable needed services so we can access the system after a reboot. SSHd is optional, only enable it, if the system should be reachable via SSH.
systemctl enable dhcpcd
systemctl enable sshd
Configuring sudo⌗
Open the sudo configuration with
visudo
and uncomment the line that says
%wheel ALL=(ALL) ALL
to enable all members of the “wheel” group to use sudo. Additionally, to get rid of a minor annoyance, add
Defaults passwd_timeout=0
to disable the sudo prompt timeout, which can be useful if a log runnning script asks for a sudo password later in the process and you miss it. Without this setting, it will timeout and you need to restart the script again.
Creating new user⌗
To be able to log in with our own user after the reboot, we create one now. If the user should be able to use sudo, we also add him to the wheel group.
useradd -m -s /usr/bin/fish USERNAME
usermod -aG wheel USERNAME
passwd USERNAME
Done⌗
After leaving the chroot and rebooting the system. everything should be up and running.