Arch Linux Setup
Created: 2024-10-13 Last Modified: 2025-02-22
Arch Linux Setup
I recently installed Arch Linux on my PC. And I saw this as a nice oppoturnity to drop a new post on this site with my notes on the installation.
Everything I did, I mainly followed the Arch Linux install guide. Just for the specific parts regarding LVM and Cryptsetup I followed another linked page of the wiki.
Therefore, my notes show how I installed my system whilst having a fully encrypted partition with my data.
- https://wiki.archlinux.org/title/Installation_guide/
- https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS/
WARNING
This is not a guide, neither is it a full installation instruction. I installed Arch Linux before already, so I was familiar with the process. But this is my first time installing it with LVM and Cryptsetup. These are justm y notes.
Do not follow this guide expecting to have a working system in the end. I expect you to know what you are doing if you should run these commands. Maybe I made some mistake while writing things down. So far everything looks good on my machine, so I doubt I made large mistakes during the installtion.
Please follow the official docs over on https://wiki.archlinux.org/!
I warned you.
I use Arch btw
Process
Download arch iso and flash to usb drive
I partitioned the drive beforehand into two paritions on another machine.
nvme0n1 259:6 0 953.9G 0 disk
├─nvme0n1p1 259:7 0 512M 0 part
└─nvme0n1p2 259:8 0 953.4G 0 part
Then create the encrypted container on /dev/nvme0n1p2
and choose a password
cryptsetup luksFormat /dev/nvme0n1p2
Open the container and name it luks
cryptsetup open /dev/nvme0n1p2 luks
Create the logical volumes in the group called vg
pvcreate /dev/mapper/luks
vgcreate vg /dev/mapper/luks
lvcreate -L 64G -n root vg
lvcreate -l 100%FREE -n home vg
lvreduce -L -265M vg home
Create the file systems (boot, root, home)
mkfs.fat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/vg/root
mkfs.ext4 /dev/vg/home
Now mount filesystem accordingly
mount --mkdir /dev/vg/root /mnt/
mount --mkdir /dev/vg/home /mnt/home
mount --mkdir /dev/nvme0n1p1 /mnt/boot
Install base system and switch into it
pacstrap -K /mnt base linux linux-firmware git vim amd-ucode lvm2
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
Setup root password
passwd
Setup timezone and update system clock
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc
Setup locale
vim /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
Set hostname
echo "ZeljkoLinuxDesktop" >> /etc/hostname
Setup bootloader, I use systemd-boot
$ cat /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options rd.luks.name="ID_OF_PARTITION_HERE"=luks root=/dev/vg/root rw rootfstype=ext4
$ cat /boot/loader/entries/arch-fallback.conf
title Arch Linux (fallback initramfs)
linux /vmlinuz-linux
initrd /initramfs-linux-fallback.img
options rd.luks.name="ID_OF_PARTITION_HERE"=luks root=/dev/vg/root rw rootfstype=ext4
The UUID of the partition can be fetched with blkid
.
$ blkid | grep '/dev/nvme0'
/dev/nvme0n1p1: UUID="SOME_ID" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="SOME_UUID" # this is my boot partition!
/dev/nvme0n1p2: UUID="THE_ID_OF_THE_PARTITION" TYPE="crypto_LUKS" PARTUUID="SOME_UUID" # this is the encrypted partition
Edit the mkinitcpio.conf
and add LVM, dm-crypt and friends. Please check out the official docs for that.
Regenerate initramfs
mkinitcipio -p
Install the bootloader
bootctl install
From this moment on the system should be usable. Reboot and check if everything is correct.
Then I setup the system to how I need it.
Add myself as a user
pacman -S sudo
useradd -m zeljkobekcic
passwd zeljkobekcic
usermod -aG wheel zeljkobekcic
vim /etc/sudoers # uncomment the line with wheel
From this moment on I just install all packages which I need and I am ready to go. I try to write down each package which I install in my dotfiles.