- Introduction
- Preliminary Steps
- Main installation
- Disk partitioning
- Disk formatting
- Disk mounting
- Packages installation
- Fstab
- Context switch to our new system
- Set up the time zone
- Set up the language and tty keyboard map
- Hostname and Host configuration
- Root and users
- Grub configuration
- Unmount everything and reboot
- Automatic snapshot boot entries update
- Virtualbox support
- Aur helper and additional packages installation
- Finalization
- Video drivers
- Setting up a graphical environment
- Adding a display manager
- Gaming
- Additional notes
- Things to add
The goal of this guide is to help new users set up a modern and minimal installation of Arch Linux with BTRFS on an UEFI system. I'll start from the basic terminal installation and then set up video drivers, a desktop environment and provide basic gaming configuration. This guide is thought to be read alongside the wiki, so that it if something ever changes you can fix it but it's not necessary unless my guide becomes outdated. Also I will mention external references to justify some choices that I've made so that curious users can delve into the details.
Note that:
-
I won't prepare the system for secure boot because the procedure of custom key enrollment in the BIOS is dangerous and can lead to a bricked system. If you are wondering why not using the default OEM keys in the BIOS, it's because they will make secure boot useless by being most likely not enough secure.
-
I won't encrypt the system because I don't need it and because encryption always adds a little bit of overhead in the boot phase leading to a slower to varying degrees start-up, depending on your configuration. However it may be important for you so if you really wanna go this way I recommend reading the wiki page in this regards and must perform the documented steps IMMEDIATELY AFTER disk partitioning. Also note that you must set the type of partition to a LUKS partition instead of a standard Linux partition when partitioning with
fdisk. -
I'll skip the Arch ISO installation media preparation.
-
I'll use a wired connection, so no wireless configuration steps will be shown. If you want to connect to wifi, you can either launch
wifi-menufrom the terminal which is a TGUI or useiwctl.
<br>
First set up your keyboard layout
ls /usr/share/kbd/keymaps/**/*.map.gz | grep it
ls /usr/share/kbd/keymaps/**/*.map.gz | less
localectl list-keymaps
loadkeys it
<br>
Check that we are in UEFI mode
cat /sys/firmware/efi/fw_platform_size
<br>
Check the internet connection
ping -c 5 archlinux.org
<br>
Check the system clock
timedatectl
timedatectl set-ntp true
systemctl enable systemd-timesyncd.service
<br>
Disk partitioning #
I will make 2 partitions:
| Number | Type | Size |
|---|---|---|
| 1 | EFI | 512 Mb |
| 2 | Linux Filesystem | 99.5Gb (all of the remaining space ) |
<br>
fdisk -l
fdisk /dev/nvme0n1
g
ENTER
n
ENTER
ENTER
ENTER
+512M
ENTER
t
ENTER
ENTER
1
ENTER
n
ENTER
ENTER
ENTER # If you don't want to use all the space then select the size by writing +XG ( eg: to make a 10GB partition +10G )
p
ENTER # Now check if you got the partitions right
w
ENTER
q
ENTER
<br>
Disk formatting #
For the file system I've chosen BTRFS which has evolved quite a lot in the recent years. It is most known for its Copy on Write feature which enables it to make system snapshots in a blink of a an eye and to save a lot of disk space, which can be even saved to a greater extent by enabling built-in compression. Also it lets the user create subvolumes which can be individually snapshotted.
mkfs.fat -F 32 /dev/nvme0n1p1
mkfs.btrfs /dev/nvme0n1p2
mount /dev/nvme0n1p2 /mnt
<br>
Disk mounting #
I will lay down the subvolumes on a flat layout, which is overall superior in my opinion and less constrained than a nested one. What's the difference ? If you're interested this section of the old sysadmin guide explains it.
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
umount /mnt
<br>
For this guide I'll compress the btrfs subvolumes with Zstd, which has proven to be a good algorithm among the choices
mount -o compress=zstd,subvol=@ /dev/nvme0n1p2 /mnt
mkdir -p /mnt/home
mount -o compress=zstd,subvol=@home /dev/nvme0n1p2 /mnt/home
<br>
Now we have to mount the efi partition. In general there are 2 main mountpoints to use: /efi or /boot but in this configuration i am forced to use /efi, because by choosing /boot we could experience a system crash when trying to restore @ ( the root subvolume ) to a previous state after kernel updates. This happens because /boot files such as the kernel won't reside on @ but on the efi partition and hence they can't be saved when snapshotting @. Also this choice grants separation of concerns and also is good if one wants to encrypt /boot, since you can't encrypt efi files. Learn more here
mkdir -p /mnt/efi
mount /dev/nvme0n1p1 /mnt/efi
<br>
Packages installation #
pacstrap -K /mnt base base-devel linux linux-firmware git btrfs-progs grub efibootmgr grub-btrfs inotify-tools timeshift vim networkmanager pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber reflector zsh zsh-completions zsh-autosuggestions openssh man sudo
<br>
Fstab #
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
<br>
Context switch to our new system #
arch-chroot /mnt
<br>
Set up the time zone #
ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
hwclock --systohc
<br>
Set up the language and tty keyboard map #
Edit /etc/locale.gen and uncomment the entries for your locales. Each entry represent a language and its formats for time, date, currency and other country related settings. By uncommenting we will mark the entry to be generated when the generate command will be issued, but note that it won't still be active. In my case I will uncomment ( ie: remove the # ) en_US.UTF-8 UTF-8 and it_IT.UTF-8 UTF-8 because I use English as a display language and Italian for date, time and other formats.
vim /etc/locale.gen
locale-gen
<br>
Since the locale is generated but still not active, we will create the configuration file /etc/locale.conf and set the locale to the desired one, by setting the LANG variable accordingly. In my case I'll write LANG=it_IT.UTF-8 to apply Italian settings to everything and then override only the display language to English by setting ( on a new line ) LC_MESSAGES=en_US.UTF-8. ( if you want formats and language to stay the same DON'T set LC_MESSAGES ). More on this here
touch /etc/locale.conf
vim /etc/locale.conf
<br>
Now to make the current keyboard layout permanent for tty sessions , create /etc/vconsole.conf and write KEYMAP=your_key_map substituting the keymap with the one previously set here. In my case KEYMAP=it
vim /etc/vconsole.conf
<br>
Hostname and Host configuration #
touch /etc/hostname
vim /etc/hostname
touch /etc/hosts
Write the following ip, hostname pairs inside /etc/hosts, replacing Arch with YOUR hostname:
127.0.0.1 localhost
::1 localhost
127.0.1.1 Arch
vim /etc/hosts
<br>
Root and users #
passwd
useradd -mG wheel mjkstra
passwd mjkstra
EDITOR=vim visudo
<br>
Grub configuration #
Now I'll deploy grub
grub-install --target=x86_64-efi --efi-directory=/efi --boot-id=GRUB
<br>
Generate the grub configuration ( it will include the microcode installed with pacstrap earlier )
grub-mkconfig -o /boot/grub/grub.cfg
<br>
Unmount everything and reboot #
systemctl enable NetworkManager
exit
umount -R /mnt
reboot
timedatectl set-ntp true
<br>
Automatic snapshot boot entries update #
Each time a system snapshot is taken with timeshift, it will be available for boot in the boot, however you need to manually regenerate the grub configuration, this can be avoided thanks to grub-btrfs, which can automatically update the grub boot entries.
Edit the grub-btrfsd service and because I will rely on timeshift for snapshotting, I am going to replace ExecStart=... with ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto. If you don't use timeshift or prefer to manually update the entries then lookup here
sudo systemctl edit --full grub-btrfsd
sudo systemctl enable grub-btrfsd
<br>
Virtualbox support #
Follow these steps if you are running Arch on a Virtualbox VM. This will enable features such as clipboard sharing, shared folders and screen resolution tweaks
pacman -S virtualbox-guest-utils
systemctl enable vboxservice.service
Note: the utils will only work after a reboot is performed.
Warning: the utils seems to only work in a graphical environment.
<br>
Aur helper and additional packages installation #
To gain access to the arch user repository we need an aur helper, I will choose yay which also works as a pacman wrapper ( which means you can use yay instead of pacman ). Yay has a CLI, but if you later want to have an aur helper with a GUI you can install pamac ( a Manjaro software, so use at your own risk ), however note that front-ends like pamac and also any store ( KDE discovery, Ubuntu store etc. ) are not officially supported and should be avoided, because of the high risk of performing partial upgrades. This is also why later when installing KDE, I will exclude the KDE discovery store from the list of packages.
To learn more about yay read here
Note: you can't execute makepkg as root, so you need to log in your main account. For me it's mjkstra
sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si
yay -S timeshift-autosnap
Learn more about timeshift autosnap here
<br>
Finalization #
reboot
After these steps you should be able to boot on your newly installed Arch Linux, if so congrats !
The basic installation is complete and you could stop here, but if you want to to have a graphical session, you can continue reading the guide.
<br>
In order to have the smoothest experience on a graphical environment, Gaming included, we first need to install video drivers. To help you choose which one you want or need, read this section of the arch wiki.
Note: skip this section if you are on a Virtual Machine
<br>
Amd #
For this guide I'll install the AMDGPU driver which is the open source one and the recommended, but be aware that this works starting from the GCN 3 architecture, which means that cards before RX 400 series are not supported. ( I have an RX 5700 XT )
sudo pacman -S mesa vulkan-radeon libva-mesa-driver mesa-vdpau
32 Bit support
If you want to add 32-bit support, we need to enable the multilib repository on pacman: edit /etc/pacman.conf and uncomment the [multilib] section ( ie: remove the hashtag from each line of the section. Should be 2 lines ). Now we can install the additional packages.
yay
sudo pacman -S lib32-mesa lib32-vulkan-radeon lib32-libva-mesa-driver lib32-mesa-vdpau
<br>
Nvidia #
In summary if you have an Nvidia card you have 2 options:
The recommended is the proprietary one, however I won't explain further because I don't have an Nvidia card and the process for such cards is tricky unlike for AMD or Intel cards. Moreover for reason said before, I can't even test it.
<br>
Intel #
Installation looks almost identical to the AMD one, but every time a package contains the radeon word substitute it with intel. However this does not stand for h/w accelerated decoding, and to be fair I would recommend reading the wiki before doing anything.
<br>
I'll provide 2 options:
- KDE-plasma
- Hyprland
On top of that I'll add a display manager, which you can omit if you don't like ( if so, you have additional configuration steps to perform ).
<br>
Option 1: KDE-plasma #
KDE Plasma is a very popular DE which comes bundled in many distributions. It supports both the older Xorg and the newer Wayland protocols. It's user friendly, light and it's also used on the Steam Deck, which makes it great for gaming. I'll provide the steps for a minimal installation and add some basic packages.
sudo pacman -S plasma-desktop plasma-pa plasma-nm plasma-systemmonitor plasma-firewall plasma-browser-integration kscreen kwalletmanager kwallet-pam bluedevil powerdevil power-profiles-daemon kdeplasma-addons xdg-desktop-portal-kde xwaylandvideobridge kde-gtk-config breeze-gtk cups print-manager konsole dolphin ffmpegthumbs firefox kate okular gwenview ark pinta spectacle dragon
Now don't reboot your system yet. If you want a display manager, which is generally recommended, head to the related section in this guide and proceed from there otherwise you'll have to manually configure and launch the graphical environment each time (which I would advise to avoid).
<br>
Option 2: Hyprland [WIP] #
Note: this section needs configuration and is basically empty, I don't know when and if I will expand it but at least you have a starting point.
<br>
Hyprland is a tiling WM that sticks to the wayland protocol. It looks incredible and it's one of the best Wayland WMs right now. It's based on wlroots the famous library used by Sway, the most mature Wayland WM there is. I don't know if I would recommend this to beginners because it's a totally different experience and it may not be better. Moreover it requires you to read the wiki for configuration but it also features a master tutorial. The good part is that even if it seems discouraging, it's actually an easy read because it is written beautifully.
pacman -S --needed hyprland swaylock wofi waybar dolphin alacritty
yay -S wlogout
<br>
Display managers are useful when you have multiple DE or WMs and want to choose where to boot from or select the display protocol ( Wayland or Xorg ) in a GUI fashion, also they take care of the launch process. I'll show the installation process of SDDM, which is highly customizable and compatible.
Note: hyprland does not support any display manager, however SDDM is reported to work flawlessly from the wiki
sudo pacman -S sddm
sudo systemctl enable sddm
pacman -S --needed sddm-kcm
reboot
<br>
Gaming on linux has become a very fluid experience, so I'll give some tips on how to setup your arch distro for gaming.
Before going further I'll assume that you have installed the video drivers, also make sure to install with pacman, if you haven't done it already: lib32-mesa, lib32-vulkan-radeon and additionally lib32-pipewire ( Note that the multilib repository must be enabled, here I've explained how to do it ).
Let's break down what is needed to game:
- Gaming client ( eg: Steam, Lutris, Bottles, etc..)
- Windows compatibility layers ( eg: Proton, Wine, DXVK, VKD3D )
Optionally we can have:
- Generic optimization ( eg: gamemode )
- Overclocking and monitoring software ( eg: CoreCtrl, Mangohud )
- Custom kernels
<br>
Gaming clients #
I'll install Steam and to access games from other launchers I'll use Bottles, which should be installed through flatpak.
sudo pacman -S steam flatpak
flatpak install flathub com.usebottles.bottles
<br>
Windows compatibility layers #
Proton is the compatibility layer developed by Valve, which includes DXVK( DirectX 9-10-11 to Vulkan), VKD3D ( DirectX 12 to Vulkan ) and a custom version of Wine. It is embedded in Steam and can be enabled for non native games direclty in Steam: Steam > Settings > Compatibility > Enable Steam Play for all other titles. A custom version of proton, Proton GE exists and can be used as an alternative if something is broken or doesn't perform as expected. Can be either downloaded manually or through yay as below.
yay -S proton-ge-custom-bin
<br>
Generic optimizations #
We can use gamemode to gain extra performance. To enable it read here
sudo pacman -S gamemode
<br>
Overclocking and monitoring #
To live monitor your in-game performance, you can use mangohud. To enable it read here.
In order to easily configure mangohud, I'll use Goverlay.
sudo pacman -S goverlay
To overclock your system, i suggest installing corectrl if you have an AMD Gpu or TuxClocker for NVIDIA.
<br>
-
On KDE disabling mouse acceleration is simple, just go to the settings via the GUI and on the mouse section enable the flat acceleration profile. If not using KDE then read here
-
To enable Freesync or Gsync you can read here, depending on your session ( Wayland or Xorg ) and your gfx provider ( Nvidia, AMD, Intel ) the steps may differ. On a KDE wayland session, you can directly enable it from the monitor settings under the name of adaptive sync
-
Some considerations if you are thinking about switching to a custom kernel:
- You have to manually recompile it each time there is a new update unless you use a precompiled kernel from pacman or aur such as
linux-zen. - There is no such thing as the best kernel, all kernels make tradeoffs ( eg: latency for throughtput ) and this it why it's generally advised to stick with the generic one.
- If you are mainly a gamer you MAY consider the TKG or CachyOS kernel. These kernels contain many optimizations and are highly customizable, however the TKG kernel has to be compiled ( mainly it's time consuming, not hard ), while CachyOS kernel comes already packaged and optimized for specific hardware configurations, and can be simply installed with pacman upon adding their repos to
pacman.conf. Some users have reported to experience a smoother experience with lower latency, however I couldn't find consistent information about this and it seems that is all backed by a personal sensation and not a result obtained through objective measurements ( Also this is difficult because in Linux there can be countless configuration variables and it also depends by the graphic card being used ).
- You have to manually recompile it each time there is a new update unless you use a precompiled kernel from pacman or aur such as
-
Some recommended reads:
- How to build your KDE environment
- Gaming on Wayland ( old article but still relevant )
- Improving Linux Gaming Performance
- Arch linux system maintenance
- Arch linux general recommendations <br>
- Additional pacman configuration ( paccache, colors, download packages simultaneously )
- Reflector configuration
- Snapper: a more advanced snapshot program as a timeshift alternative.
- Overhaul the subvolumes partitioning into a richer set including @log @cache @tmp @snapshots. This way they they won't be included when snapshotting the root subvolume ( ie: @ ).
- Better fstab structure
<br>