Archlinux wiki
This wiki is a cumulation of some helpful things I learnt whilst using Arch.
I also have a snippets chapter, full of little hacks that were hard to find.
Installation
Usually referring to the Arch installation guide should work, for times when it doesn't work, or if you are a seasoned user wanting to automate the installation, have a look at my arch-install script
Dual booting
If you are dual booting with Windows, then make sure to
- Not wipe the Windows Boot Manager partition.
- Run
powercfg /h off
in Powershell as admin. This will disable hibernation completely. This gets rid of hybrid boot, which can cause any shared hard drives to be read-only.
DE vs TWM
These are two ways of interacting with your computer and have different target audiences.
DE - Desktop Environments
Desktop Environments (DE) often come with everything you need and expect from Operating Systems such as Microsoft windows and MacOS. This includes things like: file browsers, web browsers, printing services, settings menu to change things like locale, keyboard layouts etc... This is what beginners should use if they have no clue how to set these up manually.
TWM - Tiling Window Manager
Tiling Window Managers, are programs that do only one thing: that is to manage windows. This means it only handles the opening, closing and management of windows. There are a wide variety of TWM's from ones with built in application launchers to ones that don't even register you keystrokes(handled to open applications or alteast the program to open applications.)
Introduces a whole world of ergonomics, being able to manage all your windows without a mouse.
After getting used to a TWM, you will find DE's to be "bloated". (if you know what you are doing and do not need GUI elements to configure your computer.)
X11 vs Wayland
Use wayland, cause why not :)
X11
Using the X-server server-client model. A very popular, stable choice but development has been almost non-existant. Most distributions are moving to wayland. However has the most support for hardware and is suitable for most people.
Wayland
The replacement for X11 window system. It is still seeing lots of active development, and I recommend switching over to wayland, although it is missing quite a few features, and might need temporary workarounds that may or may not suite your needs.
- Screensharing with audio. (only tested in discord)
- Hybrid graphics with nvidia cards on laptop. (as of now!)
Although people have reported difficulty in getting wayland working with nvidia, it is a bit of hassle but is easily doable, with the help of patience and a good guide!
Post Installation
Just logged in after installing? Let's make sure you have a working internet connection.
Try running ping gnu.org
. If you start receiving packets, then you are connected!. Stop this
command by pressing Ctrl-C
.
If you do not get any packets, you might want to connect to the
internet either using ethernet or wifi. If you are using NetworkManager, also make sure the service
is running by using the command sudo systemctl status NetworkManager
. If it is not running, start it and enable it using the command sudo systemctl enable --now NetworkManager
.
To connect to a wifi network using NetworkManager have a look at the Network Manager page
We will be modifying configuration files from the command line using the tool VIM. You can learn the basics by VIM by reading the VIM page.
PC Speaker
To provide auditory cues, your motherboard usually comes with a simple speaker capable
of producing beeps. This can be very loud and annoying when using the terminal, as it
might beep quite often. To test if you have this problem, just press <TAB>
multiple
after logging in, if you hear a beep and want to remove perform the following actions.
Non-Persistant solution
We can disable it by unloading the pcspkr
and snd_pcsp
kernel modules.
rmmod pcspkr
rmmod snd_pcsp
Persistant solution
There are two easy ways of persisting this change.
Blacklisting modules
You can blacklist the modules to prevent them from being loaded at boot.
Either by adding module_blacklist=pcspkr,snd_pcsp
in our bootloaders kernel line.
(This is "advanced" and will require regenerating your grub config if you are using grub)
or by creating the file /etc/modprobe.d/nobeep.conf
(with root permissions) with the
following content.
blacklist pcspkr
blacklist snd_pcsp
Console
You can uncomment set bell-style none
in /etc/inputrc
. (require root permission)
.bashrc
When we are using the terminal we are usually interacting with a shell inside of a terminal emulator.
When we open the shell, it loads its "configuration" from the file ~/.bashrc
. In here we can set
command shortcuts to improve our work flow.
Updating our computer using pacman usually is done using pacman -Syu
We can simplify it to update, by adding alias update='pacman -Syu'
in our ~/.bashrc
file.
Configuring Pacman
Now lets configure pacman so it is more perfomant and readable.
Enabling Parallel Downloads
This will usually significantly improve download times when using pacman.
Lets open the file /etc/pacman.conf
with root priviledges.
sudo vim /etc/pacman.conf
Now find this line. (using vim)
#ParallelDownloads...
and replace it with
ParallelDownloads = 15
Enabling multilib repository
This repository contains 32-bit applications. Includes applications such as steam.
To enable this, uncomment the following lines in /etc/pacman.conf
(root permission required)
[multilib]
Include = /etc/pacman.d/mirrorlist
Now you will need to update pacman's database by running
sudo pacman -Sy
Enabling color output
This will enable colour ouput which will be helpful for our AUR Helper paru.
To enable this, we will need to uncomment Color
from /etc/pacman.conf
. (root permission required)
Wayland
Wayland is the new display server protocol being developed as an alternative (and hoping to replace) X11/Xorg.
Recommended packages
Here are the packages I'd install to use Hyprland.
To make things easier I'm going to be using paru
paru -S noto-fonts noto-fonts-emoji noto-fonts-cjk ttf-jetbrains-mono ttf-font-awesome \
sxiv feh mpv zathura zathura-pdf-mupdf ffmpeg fzf man-db zip unzip unrar \
papirus-icon-theme dosfstools ntfs-3g git pipewire pipewire-pulse vim neovim \
arc-gtk-theme rsync firefox neofetch helix libnotify jq aria2 mako ranger \
waybar xdg-user-dirs libconfig polkit kitty networkmanager emacs-nativecomp \
dhcpcd wpa_supplicant pamixer mpd ncmpcpp swaylock wofi wlogout wl-clipboard \
hyprland waybar-hyprland-git
Hyprland
This is my WM (Window Manager) of choice on wayland.
To read more on configuring Hyprland, visit the Hyprland page
Here are some packages that you will need if you are using a wayland/wlroots based compositor.
swaylock
: a simple screen lock.wlogout
: a simple logout menu.wofi
: wayland version of rofi, an applications launcher.wl-clipboard
: clipboard functionality like xclip.mako
: notification daemon.
AUR helper
AUR Helper, is simple a program that helps manage packages for us rather than pacman. This is because
pacman
is not that intuitive.- we cannot install AUR (Arch User Repository) packages using
pacman
.
AUR is the Arch User Repository. These are packages made by people on the internet, be careful not to install malware/malicious packages, as you will be installing it at your own risk!!
Paru
Paru is my AUR helper of choice. It is very fast and feature rich. To see some configuration options visit the paru page.
Installing paru
To install paru, we will need rust, the preferred way of installing rust would be
using rustup
.
Lets make a ~/.source directory, cd into it and clone the paru repository.
Now we can build the paru package using makepkg -si
.
### Installing rust ###
sudo pacman -S rustup
rustup default stable
### Cloning the repo ###
mkdir ~/.source
cd ~/.source
git clone https://aur.archlinux.org/paru.git --depth 1
cd paru
makepkg -sic
~/.source
- a directory for cloning repositories that we will build/install on the system.makepkg -sic
- make the package,-s
will sync the dependencies for the application and the-i
flag will install the package and-c
will clean any remnant files.
Paru configuration
Just like how we changed the default settings in pacman, we will do the same with paru to get a better user experience.
Uncomment the following lines in the file /etc/paru.conf
. (root permission required.)
BottomUp
SudoLoop
NewsOnUpgrade
Paru usage
Just running the command paru
will do a full system update.
Searching packages
You can search for packages by running paru <package-name>
.
When you search for packages using paru
you can see what repostiory they are coming from.
Such as community, extra, core, multilib, AUR.
Installing packages
If you know the name of the package you want to install, you can install it using
paru -S <package-name>
.
Validating AUR packages.
When using paru, if you try to install and AUR script, it will prompt you with the PKGBUILD file. You can read through this file to make sure there is nothing that is obviously out of place. Things like if it's trying to download something from a sketchy url.
Installing Applications
Base packages
Here I will list some of the packages that provide "base" functionality.
Keyring service: gnome-keyring
It is a collection of components that stores secrets (passwords, certificates, etc...) and makes them available to applications.
Other
wofi
: An application launcher for wayland (similar to rofi).ranger
: A TUI file manager.thunar
: A GUI file manager.mpv
: A powerful, easily extensible media player.vlc
: Media player for normies.qutebrowser
: A keyboard centric browser with Vim-motions for navigation.
auto-cpufreq
This is an system service that will manage your processor clocks based your battery status. A must for laptops! (useless on desktops).
// TODO: walkthrough installation
Firefox extensions
- uBlock Origin.
- Bitwarden - Free Password Manager.
- Dark Reader.
- Disable WebRTC.
- Enhancer for YouTube.
- SponsorBlock for YouTube.
- FastForward.
- New Tab Override (setup a custom webpage on new tab).
- Simple Tab Groups.
- TWP - Translate Web Pages.
- User-Agent Switcher and Manager.
- ClearURLS.
Open Source Alternatives
Instead of using proprietary applications, how about you try some of these applications.
OSS Clients for Proprietary applications
- Webcord is a Open source client for discord. Install the binary version using
the command
paru -S webcord-bin
FOSS applications
-
Using
code
, instead ofvisual-studio-code-bin
. Code is the open source version that vscode is base on. However you will need to use the Open VSIX registry to install extensions rather than vscode marketplace. You can still install extensions from the vscode marketplace by downloading the.vsix
file. -
Using
logseq-desktop-bin
as an app for note-taking. Inspired from org-mode and roam-research. An amazing tool for note taking, learn more on their website. -
Using
insomnia-bin
, instead ofpostman-bin
. Insomnia is an API client and Design platform for GraphQL and REST. -
You should definitely be using
firefox
over any other browser. It offers the best customization and is much better than chrome.
Managing applications
Different ways of installing applications
What you would refer to as an application, is called a package on linux. There are multiple ways
to install a package and multiple formats they come in. Usually you will be installing the
packges from you package manager, which in our case is pacman
.
However sometimes this isn't the best solution due to various reasons.
- You do not want to upgrade from the current version, but instead want both versions
- Dependency breaking
- You want to install an older version which isn't possible by
pacman
.
The ideal solution would be something like nix
package manager. But I would recommend trying out
the alternatives first, as nix might be hard to understand for people new to linux package management.
Flatpak
AppImages
Windows apps
You can run windows executables through a emulation layer called wine
. The best way to do this
is using a flatpak application called Bottles, which is available on FlatHub.
If however you want software such as MS Office or Adobe applications, you will be better of using winapps. (Looking for maintainers as of 28/09/2021)
Using bottles
Using winapps
Network Manager
This is a program that handles network connections!
You can use it using the nmcli
command.
By default, wifi passwords are saved in clear text. Therefore anyone with root priviledges can access the password using the command
grep -r '^psk=' /etc/NetworkManager/system-connections/
Check #Securing wifi passwords for more
Connecting to WiFi
# turn wifi on
sudo nmcli radio wifi on
# list networks
sudo nmmli dev wifi list
# connect to a network using its ssid
sudo nmcli dev wifi connect <network-ssid> --ask
Connecting to eduroam
If you are in an institute that uses eduraom, you can visit the eduroam website to download an installer.
The installer is a python3
script. However python
is a symlink to python3
by default on arch linux, so we can simply run it after marking it as executable.
# making it executable
chmod +x <the file name>
# execute the file
./<file-name>
Securing WiFi passwords
To secure passwords you will need a keyring running. (Check the apps page).
Now run nm-connection-editor
in your terminal, select a network connection and click
Edit. Now select the Wifi Security tab and click on the right icon of password
and check Store the password only for this user.
Services
A service is a program that runs in the background.
We can add to remove services for a better experience. For example
we want our NetworkManager
service to automatically start on boot, so when we login,
we are connected to a network.
There are two scopes of services
- user scope: by adding the flag
--user
to any of the commands, we will be running the service as a user. If it isenabled
it will start only once the user logs in. - system scope: The service will start when the system boots up. (managed by the init system, systemd).
Managing services
Commands
sudo systemctl start <service_name>
: to start a servicesudo systemctl enable --now <service_name>
: starts the service but also makes sure it is running when you turn your computer on / log in. If you don't need the service to run/start right now, you can omit the--now
flag.sudo systemctl stop <service_name>
: to stop a running service.sudo systemctl disable <service_name>:
Stop a service from running on startup.
Some commands that are useful for debegging:
sudo systemctl | grep running
: see all the services that are running.sudo systemctl list-unit-files | grep enabled
: see the enabled services
Vim
Vim - Vi iMproved is a text editor that uses keystrokes to control everything! You do not need your
mouse whatsoever. This keystrokes are often called vim motions
. Vim motions are so effecient, that
most text-editors or IDE's have a Vim extension of some sort.
To learn how to use vim:
- Install
vim
package. - Type
:VimTutor
As much as I do love the intention behind vim, I cannot learn vim script, so I use Neovim instead.
Basic commands
gg
Goes to start of the file.G
Goes to end of file.h
,j
,k
,l
For navigation right, down, up, left respectively.:wq
To write and quit a file.:q!
Quit file without saving changes.i
To enter insert mode andesc
to exit insert mode.
You will not be able to type any changes into a file without going into insert mode.
Once you are done modifying the text, exit out of insert mode (puts you in command mode)
after while you will be able to use :wq
to write to a file and quit vim.
Neovim
Neovim is an opensource application that is basically vim, but extensible using the Lua programming language. (Neovim is an amazing project and a lot of work has been done to refector it!)
To try neovim, install the neovim
package.
I will not go into further detail on configuring neovim as I primarily use Emacs as my editor.
You try my nvim configuration here.
You try my nvim configuration here.
To use it copy and paste the commands below
sudo pacman -S ripgrep
mv ~/.config/nvim ~/.config/nvim.bak
git clone https://github.com/hegde-atri/.nvim ~/.config/nvim
Now open nvim and let Packer install its plugins. press q
once its over and now start using neovim!
Emacs
Think of something you would do on your computer... 🤔 ? You can do it in Emacs !
Installing and Enabling Emacs
Firstly make sure you have the emacs
package installed.
Then start its service by using the command systemctl --user enable --now emacs
For the best performance install emacs-nativecomp
.
This enables native compilation. This does mean that when you install plugins
it will start compiling it in the background, which might mean occasionally you
will notice emacs workers compiling things in the background.
Now you can launch Emacs using emacsclient -nc
. Optionally include the filename as an argument.
Doom Emacs
Configuring emacs, and keeping up to date with all the changes can be a daunting and time consuming task. Hence I use an Emacs framework called Doom Emacs. Make sure to read the Getting started. I will not be going through how to use emacs, as it is another whole book on its own.
To install Doom Emacs run the following command (taken from Doom Emacs docs)
# dependencies
pacman -S git ripgrep fd
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.emacs.d
~/.emacs.d/bin/doom install
Emacs on wayland
Native wayland emacs is coming with emacs 29, for now none of the emacs wayland AUR packages have worked for me.
Therefore I have just stuck to emacs-nativecomp
, but it does come with transparency glitches on wayland.
Config Folder
In your home directory, located /home/<username>
, or simply ~
, you will find
a directory ~/.config
. Directories prefixed with .
are hidden by default
so you will need to view it using ls -la
(-a
is the all flag).
In this directory lives all the configuration of installed applications. For example
your neovim
configuration will be in ~/.config/neovim
.
If you are using a TWM, you usually put you configuration in here.
These are usually called dotfiles.
Hyprland
Only if you are using the Hyprland Window Manager for Wayland.
Check out my configuration here.
I also recommend installing xdg-desktop-portal-hyprland
, for additionally functionality
with Hyprland.
Kitty
Kitty is my terminal emulator choice. It is very performant and extensive. Although kitty was terminal multiplexer features, I tend to stick to tmux as tmux can persistant shell sessions.
Dotfiles
You should save your configuration in a folder, preferrably a git repository. This way you do not have to spend any time configuring your applications, you can just copy this configuration into any machine your are using.
You can check out my dotfiles here.
Gaming
Lutris is the best client for installing and managing your game library on linux.
sudo pacman -S --needed wine-staging giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \
mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error \
lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \
sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama \
ncurses lib32-ncurses ocl-icd lib32-ocl-icd libxslt lib32-libxslt libva lib32-libva gtk3 \
lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader
If you have AMD hardware then also install the following packages to instlal support for the vulkan API.
sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader
For other hardware refer to the wiki.
Terminal basics
Commands
ls
: lists subdirectories or files in your current directorypwd
: gives your current directorycat <file>
: Outputs the contents of the file onto the terminal. Used to look at the contents of a file without opening it.cd <target_directory>
: Changes your current directory to the the specified target directory. The target directory must be in your current working folder/directory. You can check this by typing thels
command.grep "<string>" <file>
: This is the most basic usage of grep, for more flags/options, see here and here. Some usage flags include:-i
: ignore case,-H
: with file name (prints file name where each match is found),-L
stops at first match.touch <file>
: can be used to create a file in the current working directory, or in the directory provided like this ->touch <path_to_file>
.sed
: Extremely powerful tool, Sed, the ultimate stream editor. We can substitute words(like find and replace tool) using regex and so much more. Some examples would be:
sed -i 's/old/new/g' file
This would replace "old" with "new" for all occurrence's in file. For information on sed can be found here.
<command1>|<command2>
: The pipe command transfers the output of a given command (Here output of command1 is transferred to command2). For example if I wanted to transfer>
and>>
: The '>' operator overwrites the existing file, or creates the file if file mentioned cannot be found. The '>>' operator appends to the existing file, or creates the file if file does not exist. See script below. Usage of the operators would be :{command_with_output} > file
. Here is an example of a simple shell script.
#!/usr/bin/bash
# This is script I wrote that will append the given data to the file logger.md
echo -n "Enter line to be appended: "
read userinput
echo "$userinput" >> ~/Documents/logger.md
Shell Scripting
What is shell scripting // TODO // sh vs bash // posix compliant
Bash scripting
Basic shell script examples.
The first script takes your height and appends to a height tracking markdown file. The first line #!/bin/bash
indicates
that it is a bash script.
#!/bin/bash
# takes input
echo -n "Enter height: "
read height
currentDate=`date +"%d/%m/%Y"`
# The output must be in table format in markdown
echo "| $currentDate | $height |" >> ~/Documents/heightLogger.md
Or we could have it take one argument
#!/bin/bash
currentDate=`date +"%d/%m/%Y"`
# The output must be in table format in markdown
echo "| $currentDate | $1 |" >> ~/Documents/heightLogger.md
Now we can add some additional checks to it
#!/bin/bash
if [ -z $1 ]; then
echo "First argument required (your height)"
else
currentDate=`date +"%d/%m/%Y"`
# The output must be in table format in markdown
echo "| $currentDate | $1 |" >> ~/Documents/heightLogger.md
fi
Now we can set an alias or make our file and executable to use it.
Snippets
Installing different kernels
Getting the required modules
We will need to install the kernel itself.
sudo pacman -S linux-zen linux-zen-headers
If you are using a nvidia graphics card, replace your nvidia (drivers) package with nvidia-dkms package.
sudo pacman -S dkms nvidia-dkms
Modifying GRUB
Now we are gonna change the grub config to make it easier to use with multiple kernels.
Lets open the grub config file using sudo vim /etc/default/grub
.
Now modify the following properties (GRUB_DEFAULT=saved
needs to added, isn't already present)
GRUB_DEFAULT=saved
GRUB_SAVEDDEFAULT=true
GRUB_DISABLE_SUBMENU=y
Then to apply the changes regenerate your grub config using:
sudo grub-mkconfig -o /boot/grub/grub.cfg
The location of your grub config might vary!
Now you should be able to restart your computer and boot into your machine with the linux-zen kernel! Souce engine based games seem to run much better now and the zen-kernel is supposed to better for day to day use.
Issues
- booting/logging in to a black screen: run
mkinitcpio -P
Virtual Machines
Install QEMU/KVM and virt-manager
Installing all the packages we need.
sudo pacman -S qemu virt-manager archlinux-keyring virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat ebtables iptables libguestfs
Now lets start the KVM libvirt service
sudo systemctl enable --now libvirtd.service
Make sure libvirtd is running
sudo systemctl status libvirtd.service
Now lets give permissions for our standard user to manage KVM.
sudo vim /etc/libvirt/libvirtd.conf
Now uncomment unix_sock_group = "libvirt"
and unix_sock_rw_perms = "0770"
.
Now add your user to the libvirt group and restart the libvirt service.
sudo usermod -a -G libvirt $(whoami)
newgrp libvirt
sudo systemctl restart libvirtd.service
Enabling Nested Virtualization
This allows you to run virtual machines inside virtual machines.
# Intel CPU
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1
# AMD CPU
sudo modprobe -r kvm_amd
sudo modprobe kvm_amd nested=1
To make this configuration persistant:
echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf
# Intel CPU
systool -m kvm_intel -v | grep nested
cat /sys/module/kvm_intel/parameters/nested
# AMD CPU
systool -m kvm_amd -v | grep nested
cat /sys/module/kvm_amd/parameters/nested
Common Issues
If your network default
is not enabled run sudo virsh net-start default
Conclusion
Now you can install your virtual machines using virt-manager
NVIDIA
Youtubedl
Ricing
Ricing a term that came from adding parts to a car that only made it "look better" even though it added no performance value to the car. It is like adding RGB lights to your computer to make it faster. However it can be very satisfying to use a riced computer.
Applications
Fetch
Pipes
Screenshots
Here are some screenshots of my "rice".