Skip to content

Arch Linux

Installation

Once the system has loaded from a USB flash drive, as mentioned in Bootable Installation Media, and the installation has started. You should see a zsh shell, where you are logged in as root@archiso. From this point onwards, the next step, according to the official documentation 1, is to set the keyboard layout:

loadkeys uk

Note

In situations, where the layout name is unknown, the localectl list-keymaps command would list all available layouts that could be viewed using regular arrow keys in a terminal.

localectl list-keymaps

Based on the quick Google search, good UK fonts are ter-v32b, Uni2-Terminus16, Lat2-Terminus32x16, and Lat2-Terminus16. The ter-v20b font is a smaller variant which seems to be a good fit for my monitor size, i.e. 24″ at 1080p.

Note

These fonts won't be available in the installed system unless explicitly installed.

setfont ter-v20b

Note

Similar to the layout name, it possible to preview the fonts using a command to list all files in the fonts folder. The --color=always and -R parameters are to preserve the colour in the output.

ls -lash --color=always /usr/share/kbd/consolefonts/ | less -R

Verify the boot mode 2. The output could be either 64 or 32, in my case it was 64. There could be situations where the file is missing. In such situations, it means the system was booted in BIOS mode.

cat /sys/firmware/efi/fw_platform_size

Verify the networking status by first checking if the network interface is up. Importantly, the UP flag appears inside angle brackets. In my case, it was easy to mistake this for state DOWN, especially since the latter was highlighted in red due to the --color parameter.

ip --color link

If the connection is down and the only way is to use WiFi, then use iwctl. From an extensive search on the internet, this command seems to be the easiest and most recommended way of connecting to Wi-Fi.

iwtcl

There could be a special situation where we would be bound to notorious eduroam. Then we have to create a configuration file and let iwctl to pick it up. An example file is stored at project/archlinux/var/lib/iwd/eduroam.8021x which is a configuration for the eduroam network using login and password. Required by iwctl. There is project/archlinux/var/lib/iwd/eduroam.8021x which is a configuration to let built-in DHCP daemon resolve an IP address for the host. In case if the installed OS plans to use iwctl to connect to eduroam later then install iwd and dhcpdc and then systemctl enable iwd and systemctl enable dhcpdc to run the daemons on the system start up. Then inside the iwctl tool:

device list
station wlan0 scan
station wlan0 get-networks
station wlan connect [network_name]
exit

Check the internet connection:

ping archlinux.org

Manually check and sync the time and date:

timedatectl

List the available storage devices and their locations:

lsblk

In my case, it listed /dev/nvme0n1. Then, I used the fdisk utility to partition the drive:

fdisk /dev/nvme0n1

Next, you are presented with a somewhat interactive text-based interface (TUI), although, in my opinion, it uses a rather cryptic method of operation. For example, it uses a single letter p to list information about the current partitioning, if any. I would personally prefer to type out full commands, but we have to work with what is provided. At this stage, I created an EFI, a swap, and a Linux filesystem partition. This part is not detailed in the official guide, as partitioning schemes are use-case specific. Fortunately, the author in 3 offers some helpful hints.

g # Create GPT.
ENTER
n # Create new partition.
ENTER
ENTER
ENTER
+512M
ENTER
t # Change type.
ENTER
ENTER
1 # To EFI.
ENTER
n # Create new partition.
ENTER
ENTER
ENTER
+32G
ENTER
t # Change type.
ENTER
ENTER
swap # To swap.
ENTER
n # Create new partition.
ENTER
ENTER
ENTER
ENTER
p # View the results so far.
ENTER
w # Write it.
ENTER

Format the partitions:

mkfs.fat -F 32 /dev/nvme0n1p1
mkswap /dev/nvme0n1p2
mkfs.ext4 /dev/nvme0n1p3

Now, mount the file systems. Be careful with the order here: first mount the main filesystem, and then mount the EFI system partition. If you mount them in the wrong order, the EFI mount point may overwrite itself and fail to appear correctly in /etc/fstab later.

mount /dev/nvme0n1p3 /mnt
mount --mkdir /dev/nvme0n1p1 /mnt/boot
swapon /dev/nvme0n1p2

Install the essential packages: base, linux, and linux-firmware. These form the minimum needed to have a functional operating system.

The efibootmgr and grub packages are required to pass control from the UEFI firmware to the Linux kernel. There are other bootloaders available, but I am most familiar with these. Without these packages, the rest of the installation would not work.

It is possible to install amd-ucode after booting into Arch Linux, but it is best to install it during setup so that it can be loaded early through the bootloader for full effect. If you are using an Intel CPU, use intel-ucode instead. If you are in a VM then the microcode packages should be omitted.

The networkmanager package is needed to connect to the internet after the installation, in order to complete the post-installation setup. For most users, NetworkManager is the better choice due to its ease of use, GUI support, and good compatibility with desktop environments. Although, iwd is lighter and faster, but it is better suited for minimal or embedded setups.

The neovim package is needed to provide a text editing tool. For instance, to edit /etc/locale.gen file later on. And, it so happened, my text editor of choice is neovim.

pacstrap -K /mnt base linux linux-firmware efibootmgr grub networkmanager neovim amd-ucode

Generate an fstab file.

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

Verify /etc/fstab.

vim /mnt/etc/fstab

Change root into the new system.

arch-chroot /mnt

Set the time zone.

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

Run hwclock to generate /etc/adjtime.

hwclock --systohc

Edit /etc/locale.gen and uncomment en_GB.UTF-8 UTF-8 and other needed UTF-8 locales. Then, generate the locales.

locale-gen

Create the /etc/locale.conf file, and set the LANG variable accordingly.

LANG=en_GB.UTF-8

If you set the console keyboard layout, make the changes persistent in /etc/vconsole.conf. Later on, we can also change the font of the console Post Installation.

KEYMAP=uk

Create the /etc/hostname file.

Standard-PC

Set the root password.

passwd

Add user.

useradd -mG wheel user
passwd user

Deploy grub.

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

Generate the grub configuration (it will include the microcode installed with pacstrap earlier).

grub-mkconfig -o /boot/grub/grub.cfg

Enable NetworkManager before rebooting. This is considered good practice within the community. The main reason is to ensure network connectivity after rebooting, especially in situations where an SSH service is set up and there is no input or output available, such as no keyboard, mouse, or monitor connected to the system.

systemctl enable NetworkManager

Exit from chroot.

exit

Unmount everything to check if the drive is busy.

umount -R /mnt

Reboot the system and unplug the installation media.

Note

Instead, I prefer to shutdown the PC, unplug the USB drive, and manually boot back.

shutdown -h now

Post Installation

After the installation of the barebones Arch Linux Installation. Basic terminal login should be presented to the user. Log in with your user credentials.

Once logged in, ensure that the internet connection is working. Refer to the ip --color link command mentioned in Installation to verity the networking status. In situations where there is only Wi-Fi then use nmcli. Otherwise, the wire connection usually picked up automatically.

nmcli device wifi list
nmcli device wifi connect *SSID* password *your_wifi_password*
nmcli connection show

Enable and start the time synchronisation service. It requires an active internet connection to synchronise the system clock with online NTP servers.

timedatectl set-ntp true

Configure pacman and mirrors. All was okay for me, so I just skimmed it through and left it as is.

nvim /etc/pacman.d/mirrorlist
nvim /etc/pacman.conf

Update and upgrade the system. If not root then execute su -.

pacman -Syu

To proceed further, it is paramount to install custom packages to help better manage hardware resources and improve overall UX. The sudo package is important, it allows us to run as super user. The base-devel package group in Arch Linux provides essential development tools like make, gcc, and binutils, which are required to compile software, especially when using the AUR (Arch User Repository) What Are The Base Devel Dependencies. The openssh package is used to ssh and manage keys. The man package to "read the f-ing manual" 4. The git git-lfs packages are there because of VCS 5. To download files from the internet: curl wget. The xorg xorg-xinit packages are to enable GUI through X Systems as I consider Wayland too early to adapt. The xf86-video-amdgpu package is optional and it was included because the target computer iGPU is AMD-based. The polkit-gnome package is optional. Some software require priviliges and they are capable to self-elevate the priviliges if polkit is available. It comes as a dependency of the polkit-gnome package. The alacritty terminal is the default temrinal emulator of choice. The firefox browser is a compromise between widely available and provided the features I like. The keepassxc software is a password manager tool. To connect to my Google Drive I use rclone. To make colours warmer during late hours I use redshift. The p7zip package is used to extract archives. The pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber packages are needed to manage audio. The new audio framework replacing pulse and jack. And, wireplumber is the pipewire session manager. The bluez bluez-utils packages provide bluetoothctl. Finally, we install a bunch of fancy fonts, terminus-font nerd-fonts ttf-terminus-nerd noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-font-awesome, at a cost of large storage space, i.e. aproximately 8-9 GB. On a bright side, it should cover almost any character including various emojis. If not root then execute su -.

pacman --sync sudo base-devel openssh man git git-lfs curl wget xorg xorg-xinit xf86-video-amdgpu polkit-gnome alacritty firefox keepassxc rclone redshift p7zip pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber bluez bluez-utils terminus-font nerd-fonts ttf-terminus-nerd noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-font-awesome

Setup sudo priviliges for the wheel group by uncommenting the %wheel ALL=(ALL:ALL) ALL line.

Note

You don't need to reboot the PC for the changes to take effect.

su -
EDITOR=nvim visudo

Here's how you can set EDITOR=nvim system-wide on Arch Linux or similar systems using /etc/environment. Open /etc/environment with root privileges:

sudo nvim /etc/environment

Add the line below (or modify if EDITOR already exists). And, save and exit. This change applies to all users at next login.

EDITOR=nvim

As in 67, to find what package is required to install a command run the following.

clear ; pacman -Fy bluetoothctl

I wanted to keep the barebones Arch Linux installation as minimal as possible, so I moved console font configuration to here as a post-installation step. Append /etc/vconsole.conf. The FONT parameter depends on the terminus-font package, and while optional, it resolved a warning that was raised when building mkinitcpio 8. This font is used system-wide when booting into the system.

FONT=ter-v20b

After modification, the initial RAM file system needs to be rebuilt. After reboot, the console fonts should change to the one specified in the configuration file.

sudo mkinitcpio -p linux

To enable bluetooth, ensure bluez, and bluez-utils are installed on the system. The utilities package should contain bluetoothctl command 9. Enable and start the service.

clear ; sudo systemctl status bluetooth
clear ; sudo systemctl enable bluetooth
clear ; sudo systemctl start bluetooth
clear ; sudo systemctl status bluetooth

To connect a device via bluetoothctl.

bluetoothctl
power on
agent on
scan on
pair <MAC>
connect <MAC>
trust <MAC>

The most up-to-date approach to manage audio seems to be pipewire but it comes with its own quirks like rtkit warnings 10. On a bright side, it seems like it works out-of-the-box.

At this point, it might be a good idea to install a GUI like dwm. Refer to the instructions in dwm to install dwm.

Since we installed polkit and the agent, let's add it to the .xinitrc. This is optional as it requires polkit and implies that we use WM instead of a DE.

exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

At this point, the customised part of ~/.xinitrc should have the following. To find ATITUDE:LONGITUDE for Redshift follow the instructions at 11. 51.50853, -0.12574

# my rules
setxkbmap gb
status &
redshift -P -O 2700 -l LATITUDE:LONGITUDE &
exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
exec dwm

And, ~/.bashrc should have the following.

alias ls='LC_COLLATE=C ls --color=auto --group-directories-first --sort=version'
alias ll='ls -lashF'

PATH=~/.local/bin:$PATH

# By default, Arch would use `vi` as the default editor.
export EDITOR=nvim

There was a situation where the PC used iGPU to calculate graphics but used dGPU to output graphics. In situations where the PC should be forced to use xf86-video-amdgpu modify /etc/X11/xorg.conf.d/xorg.conf. Bare in mind that "PCI:19:0:0" is taken from the output of lspci -nnk, where the numbers are represented in hexadecimal format but the BusID is in decimal format. I didn't need to append zeros at the beginning, e.g. PCI:0:19:0 is invalid.

Section "Device"
    Identifier "iGPU"
    Driver "amdgpu"
    BusID "PCI:19:0:0"
EndSection

At this point, the installation of Arch Linux should be somewhat usable. Further information on post-installation advices is available at 12.


  1. https://wiki.archlinux.org/title/Installation_guide#Set_the_console_keyboard_layout_and_font 

  2. https://wiki.archlinux.org/title/Installation_guide#Verify_the_boot_mode 

  3. https://gist.github.com/mjkstra/96ce7a5689d753e7a6bdd92cdc169bae#main-installation 

  4. https://en.wikipedia.org/wiki/Jargon_File 

  5. https://en.wikipedia.org/wiki/Version_control 

  6. https://forum.manjaro.org/t/bluetoothctl-missing-in-my-installation/88318 

  7. https://wiki.archlinux.org/title/Bluetooth 

  8. https://forum.manjaro.org/t/is-it-safe-to-remove-the-consolefont-buildhook/87086/2 

  9. https://wiki.archlinux.org/title/Bluetooth 

  10. https://github.com/NixOS/nixpkgs/issues/382076 

  11. https://wiki.archlinux.org/title/Redshift 

  12. https://wiki.archlinux.org/title/General_recommendations