I had been wanting to reinstall my linux system for a while, so I wrote this blog post while installing it. When installing the system, I read the artix and the arch wiki, this blog post, watched this luke smith video, I also watched some videos by EF - Linux Made Simple and just googled stuff in general. Even though I'm gonna be writing as if this post was a guide on how to install artix or arch, this post isn't really a guide, but rather just a way for me to document the way I installed my system in case I want to reinstall it, and this could be helpful to someone who is doing a similar setup, so don't blindly follow everything I do here.
I'm gonna use artix with the runit init system. I wanna use btrfs so that I can use snapshots in case I fuck something up. Since I'm gonna dual boot windows (I already have windows installed, I'm only reinstalling artix), I'm gonna setup hibernation so that I can switch systems without having to close my stuff. Also I'm gonna do encryption bcuz I do illicit things on the internet :> (this is a joke, the most illicit thing I've done on the internet was to spread huge amounts of misinformation)
Also note that I'm using uefi, if you're on bios the setup will differ in some aspects
Download the artix iso, burn it to a usb drive by using the dd command (or use a program such as balena etcher if you're on windows), and boot from it. I usually download the xfce version of the artix iso so that I can have a graphical environment while I install the system.
Anyways the partition scheme is gonna be like this:
Windows partitions:
/dev/sda1 <- that's window's efi partition, so I'm gonna have 2 efi partitions, I know that you can have just one when you're dual booting but I'm gonna leave it with 2 boot partitions anyways cuz im stupid
Linux partitions:
/dev/sda2
/dev/sda3
/dev/sda4
/dev/sda5 <- efi partition
/dev/sda6 <- main partition
The linux efi partition is gonna be of 500M, and the main partition is gonna be of 500G. I'm not gonna use a swap partition, and instead I'm gonna use a swapfile
I usually partition the disk using cfdisk
Now that the system is partitioned, format the efi partition by running mkfs.fat -F32 /dev/sda5
, encrypt the main partition by running cryptsetup luksFormat /dev/sda6
and open the encrypted partition by running cryptsetup luksOpen /dev/sda6 cryptroot
, and now we can format the main partition by running mkfs.btrfs /dev/mapper/cryptroot
Now mount the main partition:
mount /dev/mapper/cryptroot /mnt
Create the btrfs subvolumes in /mnt
cd /mnt
btrfs subvolume create @
btrfs subvolume create @home
btrfs subvolume create @swap
btrfs subvolume create @snapshots
btrfs subvolume create @var_log
Unmount /mnt, and then mount the boot partition and the subvolumes
cd ..
umount /mnt
mount -o noatime,compress=zstd,space_cache=v2,subvol=@ /dev/mapper/cryptroot /mnt
mkdir -p /mnt/{boot,home,.snapshots,var/log,swap}
mount -o noatime,compress=zstd,space_cache=v2,subvol=@home /dev/mapper/cryptroot /mnt/home
mount -o noatime,compress=zstd,space_cache=v2,subvol=@snapshots /dev/mapper/cryptroot /mnt/.snapshots
mount -o noatime,compress=zstd,space_cache=v2,subvol=@var_log /dev/mapper/cryptroot /mnt/var/log
mount -o noatime,subvol=@swap /dev/mapper/cryptroot /mnt/swap
mount /dev/sda5 /mnt/boot
For this setup I'm gonna be using the zstd compression algorithm, you can check out the other compression algorithms here.
Run chattr +C /mnt/swap
to make it not be snapshotted and then create the swapfile
cd /mnt/swap
dd if=/dev/zero of=./swapfile bs=1M count= <- size of your swapfile status=progress
chmod 600 ./swapfile
mkswap -U clear ./swapfile
swapon ./swapfile
Once you've done that, you can install the system by running
basestrap -i /mnt base base-devel runit elogind-runit linux linux-firmware grub efibootmgr os-prober lvm2 lvm2-runit cryptsetup networkmanager networkmanager-runit btrfs-progs dosfstools mtools git vim
In this installation, I'm gonna be using grub as the boot loader, I really wanna try refind but since I'm doing things such as encryption and I'm also gonna do hibernation, I'm just gonna stick to grub because I don't really know how refind works, and learning how to use a new bootloader would make things a lot more complicated
Generate the filesystem table
fstabgen -U /mnt >> /mnt/etc/fstab
Now chroot into the system
artix-chroot /mnt bash
Setup the timezone
ln -s /usr/share/zoneinfo/YourRegion/Your_Timezone /etc/localtime
hwclock --systohc
For the localization, uncomment the locales you're gonna use in /etc/locale.gen
, run locale-gen
and put
export LANG="your locale"
export LC_COLLATE="C"
in your /etc/locale.conf
Set your hostname
echo "yourhostname" > /etc/hostname
And put this in your /etc/hosts:
Set your password and create the user
127.0.0.1 localhost
::1 localhost
127.0.1.1 yourhostname.localdomain yourhostname
passwd
useradd -m username
passwd username
Since I use colemak-dh as my keyboard layout, I'm gonna set my keyboard layout by running:
echo "KEYMAP=mod-dh-iso-us" >> /etc/vconsole.conf
Enable the arch repos by installing the package artix-archlinux-support
and following the instructions
Also run:
mkdir -p /run/runit/service
Other packages I like to install:
For network:
dhcpcd wpa_supplicant network-manager-applet
(run ln -s /etc/runit/sv/NetworkManager /etc/runit/runsvdir/default
after installing)
doas:
install the opendoas
package, and run the following:
echo "permit persist username as root" >> /etc/doas.conf
since base-devel
installs sudo, you can uninstall it by running pacman -Rsnd --nodeps sudo
also run ln -s $(which doas) /usr/bin/sudo
to symlink doas to sudo
Bluetooth support:
bluez bluez-utils bluez-runit blueberry
and run
ln -s /etc/runit/sv/bluetoothd /run/runit/service
to enable the service
Audio support:
pipewire lib32-pipewire pipewire-alsa pipewire-jack pipewire-pulse wireplumber pavucontrol playerctl
ssh:
openssh openssh-runit
and run ln -s /etc/runit/sv/sshd /run/runit/service
Fonts:
noto-fonts-extra adobe-source-han-sans-jp-fonts noto-fonts-cjk ttf-bitstream-vera ttf-cascadia-code
misc:
tlp mpv tmux thunar ranger zsh snapper ntfs-3g xorg xorg-xinit xorg-xmodmap xorg-server webkit2gtk xf86-video-intel intel-ucode
To decrypt the drive when booting, go to /etc/mkinitcpio.conf
and in the HOOKS
, put "encrypt
" and "lvm2
" after "block
" and put "resume
" before "fsck
" for hibernation to work. Also, while we're at it put "btrfs
" in the MODULES
and then run mkinitcpio -p linux
to create the initramfs image.
Now run lsblk -f
or blkid
in order to get the uuid of the encrypted partition. To get the offset of your swapfile, run btrfs inspect-internal map-swapfile -r /swap/swapfile
. Now go to /etc/default/grub
and put "cryptdevice=UUID=uuid-of-the-encrypted-partition:cryptroot root=/dev/mapper/cryptroot
" in GRUB_CMDLINE_LINUX_DEFAULT
and resume=/dev/mapper/cryptroot resume_offset=offset_of_your_swapfile
in GRUB_CMDLINE_LINUX
. Also uncomment the line that says GRUB_DISABLE_OS_PROBER=false
.
Now mount window's efi partition by running mount /dev/sda1 /mnt
so that os-prober can detect windows and run
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
and
grub-mkconfig -o /boot/grub/grub.cfg
to install grub and to generate the config.
Now exit out of the chroot, unmount everything, reboot, and hopefully the system should be installed. To hibernate, run zzz -Z
.
To set x.org's keyboard layout as colemak-dh, go to /etc/X11/xorg.conf.d/00-keyboard.conf
and paste the following in there:
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us"
Option "XkbModel" "i386"
Option "XkbVariant" "colemak_dh_iso"
Option "XkbOptions" ""
EndSection