Arch Linux installation instructions.
Warning Disclaimer: All text that follows is an expression of a personal view of the author. The statements must be taken rather critically. There is no guarantee, that this tutorial covers all possible issues that may occur during installation, and all responsibility for reader's actions (and for the results of these actions) is fully on the reader. If reader is unwilling to take the responsibility, it is better to not to follow this tutorial
The following tutorial is designed as a beginner-friendly guide of installing arch linux. The purpose of the project therefore is to provide a clear and concise way of installing arch linux, because official tutorial sucks in brevity, community sucks in being helpful and other 3rd-party tutorials suck in being up-to-date, completeness and usefulness.
The scope of this tutorial is to guide the reader through the entire installation process from having only current Linux OS installed on one's PC to a useful installation of arch linux alongside the existing OS. To keep the tutorial concise, there are certain axioms, that are taken at the beginning:
- The reader is comfortable with using some basic tools related to linux and OS installation, such as bootloader, GRUB, partition table, and is ready to search meaning of unknown words on their own;
- Currently, reader already has a linux-based OS and GRUB bootloader installed. In particular, the assumption is that the reader has Ubuntu 22.04 as their main OS right now, and this OS is the first one linux-based OS installed on current device. The linux-based is important here, because reader may also have a windows-based OS, which was installed earlier. The important thing is that the first installed linux-based OS usually contains GRUB config, and that's exactly the reason why this OS will be used later to update the config to make it available to choose the OS at PC startup. Such OS is referred below as current linux OS;
- The tutorial only covers UEFI system configuation, because BIOS is outdated (this can be checked by entering one's device's boot menu on startup by pressing a certain combination of keys, which may be different for different devices; alternatively, if you see the option Enter EFI configuration in your grub menu, then you are using UEFI system);
- The tutorial only covers GPT partition table, becaue DOS is outdated (specifically, before following this instruction reader must make sure that they are using this type of partition table, which can be done using such tool as cfdisk).
As follows from the list above, the tutorial is applicable if reader has an existing linux installation with configured GRUB, uses device with UEFI system and GPT partition table. If some of the points are not applicable, the tutorial is also useful in case reader is ready to resolve problems that may occur during installation on their own.
Note This tutorial draws inspiration for its structure from the
UML Use cases
specification. Each section is separated into three main parts - 'preconditions', 'main flow' and 'postconditions'. There are a few optional sections: 'pitfalls', in which possible errors and mitigation strategies are described, and 'extension-points', in which the branching of the installation is described (situations of uncertainty, when in some situations one option will be preferable and in other circumstances - another options; for example - gpu drivers installation).
Note Terms 'section' and 'stage' might be used interchengeably. However, term 'section' is more related to a part of 'tutorial' itself, and 'stage' is related to the part of installation process which corresponds to particular element of the tutorial.
P.S. In cases of ambiguities in the tutorial, refer to the installation logs which are histories of commands from real arch installations.
Although being incomplete, imprecise and out-of-date, some tutorials are still useful when installing arch linux by complementing the present guide. Some of the tutorials are:
- Official arch linux installation guide;
- Ubuntu and arch dual-boot installation guide - be warned, here the author uses DOS partition table (and possibly BIOS instead of UEFI), which is incompatible with this tutorial;
- Arch installation guide on youtube - this guide goes through installation on an empty disk using
linux lvm
.Linux lvm
actually only complicates the installation process, and overall the guide is extensive but poorly structured; - How to install GRUB on Arch Linux - this tutorial may be useful as an extension to the current guide which doesn't discuss the issue of installing GRUB bootloader.
- Official gentoo linux installation guide proposes a brief explanation of the fundamental concepts required for manual installation of linux such as partition tables, bootloader, file systems, etc. Therefore, it is strongly recommended to read the gentoo installation guide up to the third stage at least before proceeding in this guide.
This section of the tutorial deals with preparations steps - basically these are steps, which might be done without leaving reader's current linux OS or by booting from live usb.
The reader has loaded current linux OS and is getting started to install arch linux on the current device
Before starting the tutorial a couple of preparation steps should be made:
- Think carefully whether you want to install this distribution. It is not recommended to use as your main OS (and on your main device) if you haven't used it previously due to greater complexity in comparison to other alternatives;
- If you've decided to install arch linux, then backup all data that must not be lost, because if anything goes wrong during installation, there may be awful concequences like wiping out your entire data. That's another reason to not to use it on your main device;
- After you've become rock-solid in your decision to install arch linux and backed up all data, then comes the last preparation step - make sure that you've got enough storage capacity to install the new system. I would recommend at least 128 GB. This can be done via various utilities (like gparted), the discussion of which is out of the scope of this tutorial. In case reader haven't got free storage on the disk, it is advisable to load from a live usb, pick an existing partition and cut off a part of storage from it by resizing (which, again, might be done with such tool as gparted). For example, if there is a partition of 800 GB with Ubuntu installed, and only 50% of this space is used, it is possible to cut 200 GB from this partition, which will be converted into free space. However, the cutting operation may lead data loss, so make sure that you've copied all important data to an external device;
- When there is enough free space, the partition on which arch linux will be installed must be created in advance using the same tool which was applied during the current linux OS installation to avoid later problems with booting from such partition. In this case the reader will have to boot from a live usb, because it's not allowed to edit active partitions. The type of new partition must be Linux filesystem. When creating a new parition double check that you haven't accidentally changed other partitions. This is the most dangerous step of the tutorial. If everything looks file, go ahead and commit changes. The created partition must obtain a name, which looks like
/dev/sda6
, and may be viewed usingfdisk -l
. In each particular case, the name will be different (the number at the end will change), so this partition will be called /dev/sdaX below for generality; - Format the partition either right in the UI of the preferred partitioning tool, either via command line:
mkfs.ext4 /dev/sdaX
; - Before proceeding the reader must also make sure that they have latest arch iso downloaded and written to
libe usb
. At the time of writing the latest version is6.5.7
, and current release is2023.10.14
. It is highly advised to use ventoy tool to prepare thelive usb
with multipleiso
files.
Important Don't forget to create a new partition before proceeding, and format it as
ext4
The reader has created a new partition, prepared a live usb
with iso
file for installing arch linux.
There is a pitfall that may occur on this stage, but resurface on later stages:
When partition for arch linux is created after booting from a live usb with arch linux via such tool as cfdisk, weird flags may be set for the partition. One of such flags is metadata_csum_seed
. This problem is likely happened when after installing arch linux
you are trying to boot into the OS and see the following message:
error: file `/boot/vmlinuz-linux` not found
error: you need to load the kernel first.
During sudo update-grub
this problem shows itself by the following messages in the log:
/usr/sbin/grub-probe: error: unknown filesystem.
Supposedly, this happens because GRUB is unable to read data from the partition. To fix that, flag metadata_csum_seed
must be disabled. To achieve that, one should boot from a live usb with arch linux (it can't be done from ubuntu easily, because ubuntu uses an outdated version of tune2fs, which doesn't support this flag - version 1.47.0
is required), install package e2fsprogs
by the following commands:
arch-chroot /mnt
pacman -S e2fsprogs
After that, you may check that this flag is indeed set by running:
tune2fs -l /dev/sdaX | grep metadata_csum_seed
If flag is set, then to disable it, run:
tune2fs -O ^metadata_csum_seed /dev/sdaX
Then check again, if there is no such flag anymore, then reboot and hopefully now the problem disappears.
Related links:
unknown filesystem when updating grub
grub bug description
tune2fs problem
This section of the tutorial describes how to install core components of the arch linux OS. Before proceeding, reader must've booted from the live usb
prepared on the previous stage. This sections contains 4 extension points, some of which are required
and some are optional
. The optional
extension points here are not optional
in the sense that usually you should ignore them and just proceed to the next steps, they are optional in the sense that they are highly advisable, and if you don't want to execute them, then technically you don't have to, and the installation will boot without them, but you must've got reasons for doing that.
The user has successfully booted from the live usb
with arch linux.
Basically, the installation consists of a several steps of downloading, copying and updating various pieces of software making up the linux distribution, which is not very different from the steps explained in other tutorials:
- First, disable the disgusting bell signal:
rmmod pcspkr
- Second, internet connection must be checked. For the most convenience it is advisable to connect using an
ethernet
cable and just check the connection status using:
ip a
ping -c 5 8.8.8.8
which lists all network interfaces and corresponding ip addresses, then pings google's DNS server. If reader hasn't got an ip address, then this should be fixed first before proceeding. It is also possible to connect to wifi, see instructions below for that. After connection the commands above should be executed for checking that link is indeed established.
- Format the partition created on the previous stage if haven't done it before:
mkfs.ext4 /dev/sdaX
- Mount the partition by running the following commands:
mount /dev/sdaX /mnt
mkdir /mnt/home
mount /dev/sdaX /mnt/home
- Bootstrap packages - essential arch distro tools should be installed at this stage by running the following command:
pacstrap -i /mnt base
- Generate filesystem information file:
genfstab /mnt >> /mnt/etc/fstab
- Install a couple of essential components, which aren't installed by default:
arch-chroot /mnt
[root@archiso /] pacman -S linux linux-headers vim sudo which
- Extension point (optional) - install network tools
Important Make sure to install the network packages and enable the services. These steps are vital for the network to work properly after reboot.
- Extension point (optional) - install cpu microcode
- Extension point (required) - install gpu driver. If this step is skipped, then there will be gpu driver issue after reboot
Important Don't skip gpu driver installation - the system will hang on boot without the driver
-
Extension point (optional) - install sound toolkit
-
Extension point (optional) - setup desktop environment
-
Extension point (optional) - setup developer tools
-
Configure the system language:
[root@archiso /] vim /etc/locale.gen # uncomment line which says 'en_US.UTF-8 UTF-8' (it is strongly recommended to uncomment this value, but if you know what you are doing, you can uncomment any other line which corresponds to your desired locale by removing the '#' symbol in front of it)
[root@archiso /] locale-gen
[root@archiso /] vim /etc/locale.conf # write: 'LANG=en_US.UTF-8' or whatever locale you've chosen
[root@archiso /] vim /etc/vconsole.conf # write: 'KEYMAP=us-eng' or whatever locale you've chosen
- Configure the system time:
[root@archiso /] ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime # or reader's own timezone
[root@archiso /] hwclock --systohc
[root@archiso /] timedatectl # check current date and time
- Configure root password:
[root@archiso /] passwd # then reader will be prompted to set a new password, type the desired value, then confirm and remember it
- Set the hostname:
[root@archiso /] vim /etc/hostname # write 'archeron' or any other name for your OS installation
- Update the
hosts
file - run commandvim /etc/hosts
and write the following content to the file (replacearcheron
with a custom host name):
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
127.0.0.1 archeron.localdomain archeron
- Make network connections persistent:
[root@archiso /] systemctl enable dhcpd
- Create a new user:
[root@archiso /] useradd -m -g users -G wheel mabel # or any other username instead of 'mabel'
[root@archiso /] passwd mabel # or custom username instead of 'mabel', then write password, confirm and remember it
- Associate
wheel
group withsudo
:
[root@archiso /] EDITOR=vim visudo # Go to line that says '# %wheel ALL=(ALL) NOPASSWD: ALL' and uncomment it by removing '# ' in the beginning
- Run the following command to refresh presets for initial ramdisk:
[root@archiso /] mkinitcpio -P
- Extension point (required) - setup grub
- Reboot into the newly installed OS - now the system should boot successfully, choose appropriate option from the GRUB menu:
[root@archiso /] ^D
reboot
To connect via wifi
, command iwctl
should be used in the following way:
iwctl
[iwd]> device list
[iwd]> wsc <device> push-button
then the reader should push WPS
button on the router to complete connection. The cli will not show the status of the connection, so reader should rather use router's web interface for checking connection status. Alternatively, one may connect through the name of the network:
iwctl
[iwd]> device list
[iwd]> station <device> scan
[iwd]> station <device> get-networks
[iwd]> station <device> connect <network-name>
after that the reader will be prompted to type password, and the connection will be established if the password is correct. Make sure to wait for a few seconds until the connection is established.
Reader has installed the core components of arch linux, configured GRUB and is ready to boot the newly installed system.
There is an issue which occurs when gpu drivers are not properly configured:
The issue is identified, when system starts to boot, but hangs after writing Triggering uevents
. The problem is diagnosed by editing GRUB entry - the reader should press e
button while selecting it in GRUB menu, and adding loglevel=7
at the end of line starting with linux
. Then the reader should reboot and pay attention to what is written on screen - if the last entries contain keywords related to gpu, then there is hight probability that problem lies in the drivers. The mitigation strategy is following:
- Make sure that all necessary steps from gpu installation extension point are executed;
- Make sure that command
mkinitcpio -P
is run after driver is installed.
Related links:
the system hangs at triggering uevents
agp and radeon graphics nomodeset
After the core components are installed, the system must boot well. However, it is still far from perfect and more changes should be commited to make it more useful. All steps of the main flow in this section are highly opinionated and entirely optional, so reader should feel free to skip them as they want.
The system has booted successfully, login screen is shown, after login the desktop manager is started.
-
Enable
tap to click
following this instruction, add secondary keyboard layouts in the I/O device settings as well -
Install some auxiliary software:
sudo pacman -S neofetch unzip python-pip git-lfs vlc
yay -S google-chrome
The browser can be launched either by typing google-chrome-stable
in the console either by choosing it in the app menu of the desktop manager.
- Setup fonts - enable emoji support and install nerd fonts - download preferred items, then run following commands, which should be adapted appropriately:
sudo pacman -S noto-fonts-emoji
cd Downloads/
mkdir Inconsolata
unzip Inconsolata.zip -d Inconsolata
mkdir UbuntuMono
unzip UbuntuMono.zip -d UbuntuMono
mkdir -p ~/.fonts
mv Inconsolata/*.tff ~/.fonts
mv UbuntuMono/*.tff ~/.fonts
rm -rf Inconsolata
rm -rf UbuntuMono
rm Inconsolata.zip
rm UbuntuMono.zip
sudo fc-cache -f -v
Note Fonts are not updated everywhere even after running
sudo fc-cache -f -v
. To apply the changes systemwise, relogin into the system.
- Install
bash-tools
by running the following commands, then reopen terminal to use added extensions:
git clone https://github.com/zeionara/bash-tools.git "$HOME/bash-tools"
echo -e '\n. "$HOME/bash-tools/.bashrc"' >> "$HOME/.bashrc"
- Generate
ssh
andgpg
keys, add them togithub
,gitlab
,huggingface
, etc:
ssgen
gpgeng
- Install
git-tools
, then reopen terminal to use added extensions:
git clone git@github.com:zeionara/git-tools.git "$HOME/git-tools"
echo -e '\n. "$HOME/git-tools/.bashrc"' >> "$HOME/.bashrc"
- Install
colorful-prompt
, then reopen terminal to see changes:
git clone git@github.com:zeionara/colorful-prompt.git "$HOME/colorful-prompt"
echo -e '\n. "$HOME/colorful-prompt/colorful-prompt.sh"' >> "$HOME/.bashrc"
- Install
neovim
:
curl -Ls https://bit.ly/setup-nvim | bash
Note Automatic installation through
setup
script is supported, but not tested yet
or manual installation
sudo pacman -S neovim
git clone git@github.com:zeionara/nvim-configs.git "$HOME/.config/nvim_"
mkdir "$HOME/.config/nvim"
ln "$HOME/.config/nvim_/lua/plugins.lua" "$HOME/.config/nvim/init.lua"
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerInstall'
rm -rf $HOME/.config/nvim
mv $HOME/.config/nvim_ $HOME/.config/nvim
mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
- Install alacritty, then make it the default terminal, if that didn't happen automatically:
sudo pacman -S alacritty
git clone git@github.com:zeionara/alacritty-config.git "$HOME/alacritty-config"
$HOME/alacritty-config/setup.sh
- Install
docker-tools
:
git clone git@github.com:zeionara/docker-tools.git "$HOME/docker-tools"
echo -e '\n. $HOME/docker-tools/aliases.sh' >> "$HOME/.bashrc"
- Install
kubetools
:
git clone git@github.com:zeionara/kubetools.git "$HOME/kubetools"
echo -e '\n. "$HOME/kubetools/.bashrc"' >> "$HOME/.bashrc"
- Install
curl-tools
:
git clone git@gist.github.com:582902c79fc1a58c36b1b2c554a02b81.git "$HOME/curl-tools"
echo -e '\n. "$HOME/curl-tools/.bashrc"' >> "$HOME/.bashrc"
ln "$HOME/curl-tools/.curlrc" "$HOME/.curlrc"
- Install
paste-token
:
git clone git@gist.github.com:cc99dafb61a766b7ff88d8efa09b93b3.git "$HOME/paste-token"
echo -e '\n. $HOME/paste-token/aliases.sh' >> "$HOME/.bashrc"
- Install
tmux
:
sudo pacman -S tmux
git clone git@github.com:zeionara/tmux-config.git "$HOME/tmux-config"
cd $HOME/tmux-config
./install.sh
- Setup
bashrc
git clone git@github.com:zeionara/bashrc.git "$HOME/bashrc"
$HOME/bashrc/setup.sh
[zsh default prompt] ^D # exit the shell entered afte oh-my-zsh has been configured, and continue installation
zsh # enter zsh shell again
fast-theme "$HOME/bashrc/snuffari.ini"
Then if you've answered 'yes' to make zsh the default shell
, relogin to apply the changes.
- Setup
conda
- the commands below are taken from the official website
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
Important If you installed the
bashrc
, there is no need to callconda init bash
, there is already shell initialization inbashrc/etc/conda.sh
. However, make sure that env variableCONDA_ROOT
contains the right folder name (anaconda3
for full installation,miniconda3
for minimal installation)
The system is fully configured and ready to use