Arch Linux - Install Guide
Take this article with a grain of salt as the steps I used to install were scattered across numerous pages of notes.
This was my first foray into installing Arch on a real system.
Previously I’d used community ISOs that already had a desktop environment setup.
After my bad experience with Garuda KDE and Cinnamon I decided that it was time that I put my big boy pants on and actually did it the proper way.
I’d tried to use the archinstall
script included in the live disk and arch GUI ISO floating around but neither of them allow me to do what I wanted so.
It was clear, if I was going to have what I wanted it I was going to have to work for it.
For more information go the installation page for Arch here: https://wiki.archlinux.org/title/Installation_guide
Or a brilliant video resource is: https://www.youtube.com/c/EFLinuxMadeSimple/videos. Part of this is pieced together from his videos which were incredibly enlightening and helpful.
Note for VirtualBox users
For things to work correctly CPU virtualisation needs to be enabled in the BIOS. On AMD CPUs this is called “SVM Mode”.
You need to check the “Enable EFI” box in the VM’s settings if you want to do the UEFI way of booting rather than legacy.
Before booting into the live disk
Disable Secure Boot in the BIOS - Makes life harder anyway.
Obviously you’ll need to grab an Arch ISO and burn it to a USB. Then when booting jump into the BIOS and boot from the USB instead.
Booting into the live disk
Make sure the internet is connected
If an ethernet cable is not being used it may be necessary to configure the wifi:
iwctl
> station wlan0 connect <network_ssid>
Sync the time
Need to update the system clock with the command:
timedatectl set-ntp true
Partition Disks
I personally prefer cfdisk
as it gives a nice TUI.
gdisk
and fdisk
are also both fine choices but require a greater technical understanding of storage devices.
Partitioning should be:
- 400 MB, mark as “EFI System” - This is not necessary if one already exists due to windows being installed to the same system
- Same size as your system RAM, mark as “Linux Swap”
- The rest as you wish either such as a single root partition or root and a home partition, mark as “Linux filesystem”
Note: A swap partition is exactly necessary as something called ZRAM can be used instead. This compresses memory that would be written to swap instead back onto RAM technically making it faster but I’m not 100% what the downsides are.
Format Disks
The partition names being used are just an example, they will most likely be different.
Note: formatting a boot partition is only necessary if one doesn’t exist. If you are dual booting and Windows is already installed, skip this step.
mkfs.fat -F32 /dev/sda1 # make a FAT32 parition for boot
mkswap /dev/sda2 # make a swap partition
mkfs.btrfs /dev/sda3 # format with btrfs
# or
mkfs.ext4 /dev/sda3 # if you want ext4 instead
For more information on btrfs please read here
Setup and mount BTRFS sub-volumes
Remember, if a folder doesn’t exist like home or boot or boot/efi, create it with mkdir.
The btrfs filesystem will need to be mounted first before sub-volumes can be created.
It is convention to prepend sub-volume names with @
.
Now there seemed to be other people who would create loads of sub-volumes for no apparent reason.
I will just stick to a root and home sub-volume.
Follow the commands below if you want the same setup:
# Mount the partition so that it can be used
mount /dev/sda3 /mnt
# Create the sub-volumes
btrfs sub-volume create /mnt/@
btrfs sub-volume create /mnt/@home
# Unmount the partition so that the sub-volumes may now be mounted instead
umount /mnt
# Mount the sub-volumes with options specified, they will be explained later
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=/@ /dev/sda3 /mnt
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=/@home /dev/sda3 /mnt/home
Options explained
- noatime: The access time is changed
- compress=zstd: Enables compression on write to disk, significantly reducing disk usage.
- ssd: Enables a set of options to make mounting to an SSD better
- discard=async: Discards unused block on an SSD asynchronously.
- space_cache=v2: Sets the space cache implementation version, v2 is less safe than v1 as it is newer but is more performant.
- subvol=/@: Specifies the sub-volume to be mounted.
Mount Swap
Just enter:
swapon /dev/sda2
Mount boot partition
Now there seems to be contention online about where exactly EFI system partition (ESP) goes.
The wiki state that modern convention is to put it at /boot
(/mnt/boot
for the live disk that is).
However, because I’m dual booting my partition is only 100MB and to hold all the boot images for Linux would not be good.
Also, moving Windows on the disk and expanding the boot partition would be a pain.
The wiki also states here that previously the ESP could be mounted to /boot/efi
.
Cool, imma do that instead cause after poking around in boot all the large images are stored in /boot
and not the ESP.
I’ve seen in other tutorials that also mounted to /boot/efi
and I’ve tested it myself so it seems to be a valid solution.
There are other, what I would call, jank solutions like “bind mounting” but I’m afraid I would break something and it seems to unnecessarily complicate things anyway.
Anyway, we need to mount the ESP to the system:
mount /dev/sda1 /boot/efi
Pacstrap - Install essential packages
Use the following command to install base packages to the system:
pacstrap /mnt base base-devel btrfs-progs neovim linux-zen linux-firmware linux-zen-headers
Note: If you get a complaint about keys not being trusted or something. Chances are the keyring is out of date and needs updating with the following command:
pacman -Syy archlinux-keyring
Now you can change neovim to your editor of choice. You will also notice that linux-zen is there, that’s cause I wanted bleeding edge baby. If you want good ol’ fashioned linux install that instead.
Generating the fstab
The fstab file defines how disk partitions and other devices should be mounted to the system.
To generate one for the mounted device structure:
genfstab -U /mnt >> /mnt/etc/fstab
-U will used the UUID of the device rather than the path which can sometimes change at boot. Check the resulting file for any errors. It should like something like this (obviously nvme0n1 will be whatever the basename of your memory device is):
# Static information about the filesystems.
# See fstab(5) for details.
# <filesystem> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p6
UUID=702cf984-7ed2-48d2-8b5e-b7cbf032eb38 / btrfs rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@ 0 0
# /dev/nvme0n1p1
UUID=48D4-EDD3 /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/nvme0n1p6
UUID=702cf984-7ed2-48d2-8b5e-b7cbf032eb38 /home btrfs rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home 0 0
# /dev/nvme0n1p4
UUID=9a478274-c58e-4ce3-9596-dcd85efec120 none swap defaults 0 0
Chrooting into the new system
Now starts where we change the root filesystem to that of the system we are installing:
arch-chroot /mnt
Set the timezone
Set the timezone to your city/area:
timedatectl list-timezones # to find your timezone
ln -sf /usr/share/zoneinfo/REGION/CITY /etc/localtime
Update the hardware clock to the system time:
hwclock --systohc
Set locale information
Edit /etc/locale.gen
and uncomment the relevant line for your language.
I find that even being in another region a lot of software complains when US english is not used.
So typically I would uncomment the en_US.UTF-8
line.
Generate the locales that were just uncommented:
locale-gen
Edit /etc/locale.conf
and add the language that you just uncommented.
Should look like:
LANG=en_US.UTF-8
Name the computer
Edit the etc/hostname
file and add the name you wish to use.
Would recommend keeping it lowercase and simple.
For example:
arch-computer
Create the hosts file
Edit the /etc/hosts
file to add a couple basic entries:
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch-computer.localdomain arch-computer
Note: those are tabs between the entries, though as far as I know the whitespace is not significant.
Generate the initramfs
The initramfs is the initial image loaded at boot, here is a description from the mkinitcpio page on the arch wiki:
The initial ram disk is in essence a very small environment (early userspace) which loads various kernel modules and sets up necessary things before handing over control to init. This makes it possible to have, for example, encrypted root filesystems and root filesystems on a software RAID array. mkinitcpio allows for easy extension with custom hooks, has autodetection at runtime, and many other features.
Anyway, because we’re being fancy with btrfs we need to make sure the btrfs module gets loaded at boot.
To do this we need to edit the /etc/mkinitcpio.conf
file and add btrfs
to the MODULES
variable.
Should look something like this:
...
MODULES=(btrfs)
...
Then use the following command to generate all “presets"
mkinitcpio -P
# or
mkinitcpio -p linux-zen
Set a password for root
Follow the prompts to set a root password:
passwd
Updating the pacman conf file
We can edit the /etc/pacman.conf
file and add some nice things:
# Misc options
ILoveCandy # Added this line, enables "pacman" theme, wakka wakka
#UseSyslog
Color # Uncomment this for colour
#NoProgressBar
CheckSpace
#VerbosePkgLists
ParallelDownloads = 10 # Uncomment this to allow packages to be downloaded in parallel
Add some more packages for booting
Now that we are actually in the system we don’t need to pacstrap
and can just use pacman.
We need some additional packages to create and install the bootloader.
I will use GRUB
cause it’s stable and looks to be the most supported.
pacman -Syu grub os-prober net-tools networkmanager network-manager-applet wpa_supplicant dialog mtools dosfstools gvfs bluez bluez-utils blueberry xdg-utils xdg-user-dirs pulseaudio alsa-utils reflector
Installing GRUB
Edit the file /etc/default/grub
and uncomment the line GRUB_DISABLE_OS_PROBER=false
.
This will allow grub to discover other OSs in the ESP partition, i.e. Windows.
Next we need to install grub to the ESP partition:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
Then generate the grub configuration:
grub-mkconfig -o /boot/grub/grub.cfg
Time to reboot
Pray you didn’t mess anything up, and the grub menu should show you Arch and Windows (if windows is installed to the system).
After selecting Arch, you should be brought to a simple login prompt.
Log in with root
and the password that was set earlier.
A brand spankin’ new system
If you’ve made it this far, congratulations you’ve successfully installed Arch Linux. Now, you might be wondering “Where are the graphics?”. Well, much to my surprise and delight, when they say Arch is minimalist, they mean it. Everything, and I mean everything needs to be installed. If it’s not essential it most likely was not included in the base install.
Adding a new user
Having just a root user is not very smart. Sure it’s convenient and the computer does anything you ask it to without question. It’s also a really easy way to destroy your system in one fell swoop.
useradd -m username # -m to generate a home directory
usermod -aG wheel username # wheel group has super user privileges
usermod -aG rfkill username # rfkill group has control over things like bluetooth
Information about the user can also be added such as full name, which makes the login screen look a little more polished:
chfn -f "Full Name" username
Then we need to give a password to the new user:
passwd username
And finally, give the user superuser privileges if necessary, by giving the wheel
group superuser privileges.
Why wheel
you say?
I haven’t the faintest.
According to Wikipedia it is because:
The term was derived from the slang phrase big wheel, referring to a person with great power or influence.
To do this, we need to the etc/sudoers
file, thankfully there is a convenience program called visudo
to make sure that it valid when we’re finished with it.
Now to do this as well we’ll probably need to set the $EDITOR
variable to let visudo
know what program to use when editing it.
This can be done by prepending the visudo
command with the editor of your choice:
EDITOR=nvim visudo
Then make the following edit:
...
## User privilege specification
##
root ALL=(ALL:ALL) ALL
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL:ALL) ALL # Uncomment this line
...
Hooray! Now when the user logs in they can do whatever they want to the system.
Sanity check
Log out of root and log back in as your user to ensure that your user is working and that it has superuser privileges. The rest of this should be done as the intended user.
Desktop Environment
Now this is the juicy stuff, but sadly, also the complicated stuff I’m not entirely sure on.
My system is an AMD CPU, so I will need the amd-ucode
package for that.
I also have an NVIDIA graphics card; normally this would mean the nvidia
package is installed.
But, because we’re being fancy with the linux-zen kernel we need the nvidia-dkms
package.
I preference lightdm and the cinnamon desktop environment so that’s what I will be using. Cinnamon is a nice Windows like desktop environment, although weirdly enough it is missing a few things like, a terminal, document viewer, calculator, etc.
sudo pacman -Syu cinnamon gnome-terminal firefox lightdm lightdm-slick-greeter amd-ucode nvidia-dkms nvidia-settings nvidia-utils
Dealing with NVIDIA
I don’t know which of these fixed the issue I was having so I will just list the steps that were taken. I will do more investigation in the future to see which step/s exactly allowed the NVIDIA drivers to function.
This step generates and Xorg configuration file at /etc/X11/xorg.conf
. It states in the wiki that this step shouldn’t be required for the proprietary drivers.
sudo nvidia-xconfig
Change the MODULES variable in the /etc/mkinitcpio.conf
file to add all the nvidia modules:
...
MODULES=(btrfs nvidia nvidia_modeset nvidia_uvm nvidia_drm)
...
Enable Direct Rendering Manager:
echo "options nvidia-drm modeset=1" > /etc/modprobe.d/nvidia.conf
Regenerate the initramfs:
mkinitcpio -P
Create a shell script to allow lightdm to configure the screen correctly:
# Create this shell
sudo nvim /etc/lightdm/display_setup.sh
# Add the following lines:
#!/bin/sh
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
#
# Set permissions allow execution:
sudo chmod +x /etc/lightdm/display_setup.sh
# Edit the lightdm conf:
sudo nvim /etc/lightdm/lightdm.conf
# Add the line for the setup script:
...
[Seat:*] # Under this section
...
display-setup-script=/etc/lightdm/display_setup.sh
...
Enable services
Lightdm
Lightdm is the chosen “Display Manager” some people would rather this term be “Login Manager” as that’s basically the function they serve. It is the login screen you will be presented with when the system is booted and allows you to select the user to login as and the Desktop Environment the use, i.e. cinnamon.
Need to edit /etc/lightdm/lightdm.conf
and set the greeter theme:
...
[Seat:*] # Under this section
...
greeter-session=lightdm-slick-greeter
...
Then we need to enable the lightdm systemd service for it to start on boot:
sudo systemctl enable lightdm
Bluetooth
Enable bluetooth functionality:
sudo systemctl enable bluetooth
Reflector
Reflector is a tool that’s used to ping the closest package servers for pacman. Routinely running this will make sure that the servers you’re using are the best for you.
Need to configure the settings in /etc/xdg/reflector/reflector.conf
.
Open it up, it’s pretty self-explanatory.
I just updated the region.
Enable the timer to run which will trigger reflector once a week I believe:
sudo systemctl enable reflector.timer
Enable fstrim
fstrim will clean up any unused block on storage devices once a week.
I’m not sure how necessary this is because of the discard=async
mount option for the filesystem but can’t hurt right?
sudo systemctl enable fstrim.timer
Reboot
Now reboot and hopefully everything was configured correctly.
A Whole New World
Welcome (hopefully) to your new fully fledged graphical environment! Pretty neat huh?
Install an AUR helper
For those that don’t know, there are user submitted packages that aren’t on the official package servers. These repositories contain very useful software that it is highly recommended that a program be installed to facilitate installing the packages.
Both paru
and yay
are excellent choices for this.
This install I decided to go with paru.
git clone https://aur.archlinux.org/paru.git
cd paru/
makepkg -si
We can now install gnome-terminal-transparency
and brave-bin
, if you want brave as a browser that is.
Things like spotify
and discord
are also on the AUR.
Adding snapshot functionality and restoring with Timeshift
This tool will save your system from a messed up update and allow you to revert your system to a previous point.
paru -S timeshift timeshift-autosnap
# Recommended to also install grub-btrfs to allow snapshot selection at the grub menu on boot
sudo pacman -S grub-btrfs
Launch timeshift
and go through the prompts.
Don’t need to backup home when it asks for it.
I think all the settings can be left as default.
The timeshift-autosnap
package will also ensure that a snapshot is taken every time the system is upgraded.
A fix for cinnamon
The build I was using of cinnamon forgot to create a folder that it was dependant on and wallpaper and themes section of the system settings app will freeze without it:
mkdir -p $HOME/.cache/cs_themes/
There were also missing icons in my install, I don’t know if I accidentally uninstalled them. But if you find things like system-settings are missing icons install the following package from the AUR. Why a package from the AUR helps is anyone’s guess, seems a bit silly.
paru -S gnome-icon-theme
Loose ends to tie up
Here are some additional packages to install and the purpose:
- arc-gtk-theme & arc-icon-theme: a simple dark theme for cinnamon that’s very visually appealing.
- gnome-disk-utility: an easy to use tool for managing disk options such as auto-mounting.
- gparted: an easy to use tool for partitioning and formatting disks.
- gnome-multi-writer: write an iso file to multiple USBs at once, great for creating boot disks.
- grub-btrfs: Adds support for selecting btrfs snapshots at the grub menu. Should be used with a tool such as Timeshift.
- gnome-terminal: however after installing an AUR helper like paru or yay switch to gnome-terminal-transparency as it has a transparency slider.
- gnome-system-monitor: Simple GUI system monitor similar to Task Manager in Windows.
- htop: Simple system monitor but for the terminal.
- galculator: A simple and nice looking calculator. The gnome-calculator has no colour customisation that I could find.
- evince - simple effective document viewer, ships with Ubuntu and Mint.
- archlinux-wallpaper: adds some arch linux wallpapers.
- blueberry: simple and easy to use bluetooth frontend.
- noto-fonts: The noto fonts are simple sans fonts.
- noto-fonts-emoji: The emoji font adds emoji support.
- noto-fonts-cjk: Adds Asian character support; Chinese, Japanese, and Korean.
- nerd-fonts-fantasque-sans-mono: A very nice comic-sans-esque monospace which is very easy on the eyes. Currently use this as the terminal and editor font. Found this after my time with the Garuda distro.
- vscodium-bin: a fork of VSCode that doesn’t track you.
- mpv: The best video player hands down.
- vlc: Also a great video player, I use this for music playlists mainly or just as a backup for mpv.
- kolourpaint: A free Microsoft paint clone.
Needs the
breeze
package also installed or else it won’t function correctly.breeze
will install the correct icons and stops the colour picker from crashing the program. - rsync: The best file copying and backup program ever, only transfers what has changed making it super fast. Install it, learn it, use it.
- libreoffice-fresh: The most recent version of libreoffice, a Microsoft office alternative.
- mtpfs: Support for the Android filesystem.
- gvfs-mtp: Integrate Android filesystem support into file explorers. This allows your file explorer to automatically mount an Android phone when it is plugged in.
- ntfs-3g: Support for formatting the ntfs filesystem.
Fixing an issue mounting the Windows partition
If you would like to be able to mount the Windows partition while using Linux you will need to fix some options.
Go the power options in settings. Click “Change what the buttons do”. Uncheck fast boot and hibernate.
Then, because hibernate is not truly disabled, open an admin terminal and enter the following command:
powercfg /h off
Then the Windows partition should be able to be mounted.
Final words
This probably didn’t cover everything, but I needed to get the majority of these notes down in written form so that I could refer to them later.
If anyone else reads this, I hope it helps as installing arch or another system like this can be incredibly confusing. I’m glad that the Arch wiki exists and has clear information (most of the time), without it or the people on Youtube I don’t think this would have been possible.