I spent a lot of time running Ubuntu as my choice of OS, mainly because in college, I needed something to work straight up and I did not have enough patience to go through the ArchWiki for every topic (I still don’t. But I do try now, so that counts :P). Moreover, the college wifi also had us to login through another portal that required one to go to the browser to use it, so installing Arch on WiFi was a pain. 6-7 months ago, I decided to give it a shot again, one weekend, while thinking of moving away from GNOME and using BSPWM. This post is as much a documentation for me to not forget the steps, as it hopefully is for other people to get Arch set up quickly. Though, the best source and guide for installation is still the wiki page, which anyone installing Arch should definitely read.
Pre-installation steps
The first step for any dual-boot installation (yes, I still have Windows on my laptop, I know) is to create the bootable medium to install the new OS from. I also like to create the partitions before installation process begins, just to be safe about what I’m doing and so that I don’t lose stuff due to a typing mistake in the command. So, the first steps are to create the following partitions.
/
: 30GB/home
: The rest that you want the home directory to have. I currently have 270GB for this.Once these partitions are made, using any of
gparted
orDisk Management Utility
(for Windows), create a bootable USB from the Arch Linux ISO. The ISO can be downloaded from the archlinux page (link). Download the ISO, verify the signature, and then create the bootable USB using rufus on windows or dd on Linux.
Installing Arch
Once booted into the live environment, (often by pressing a key during the POST phase or using Shift+Restart
in Windows and using the USB to boot from), you’ll be logged into a virtual console as the root user with a Zsh prompt. While being in this tty, you can use Alt+arrow
to switch to a different console if one wants to open the ArchWiki Installation guide using Lynx (pre-installed in the USB medium) during the process. The following are the steps that need to be taken then, to get the Arch installation in the required partition up and running.
Keyboard Layout
The default keyboard layout is US and doesn’t need any changes for me, but if required, one can use the following steps to change the layout.
List the available layouts
1ls /usr/share/kbd/keymaps/**/*.map.gz
Set layout
1# loadkeys <name-of-layout>
Verify boot mode
My MSI laptop boots into the UEFI mode and that can be confirmed by checking the efivars
directory. If it is not empty, that means that the system has booted into UEFI mode.
1ls /sys/firmware/efi/efivars
Internet
Internet connection is required for installing arch and various packages required for the proper installation. To ensure that the network interface is listed and enabled, check the output of ip link
. If it lists the required interface (WiFi, in my case) then go ahead and connect to one of the networks. I will be writing about connecting to a WiFi network, but ethernet should work on just plugging in the cable. iwctl
can be used to connect to the WiFi network.
On running iwctl
, you will enter into the iwd
prompt where you can perform various operations to connect. The following command can be used to list the devices that are available to connect.
1[iwd]# device list
From the output, select the device that you want to connect and use the following command to scan for available networks
1[iwd]# station <device> scan
From the list of stations available, select one of the SSID to connect and run the following command. It will prompt for the pasword, if required
1[iwd]# station <device> connect <SSID>
In case one wants to perform the entire operation in one command, in a script for example, one can use:
1iwctl --passphrase <password> station <device> connect <SSID>
System clock
To use network synchronization on the clock, set the NTP parameter for timedatectl
to true by using
1timedatectl set-ntp true
One can check the time and the service status by using timedatectl status
Partitions
After creating partitions and formating them to ext4
format using gparted
(or equivalent) mount the partitions to be used by the installation by the following commands. Do change the sda10 to the partition name to which the OS /
is to be mounted. Consequently, mount the required /dev/<>
partitions to /mnt
, /mnt/home
etc. for /
, /home
for the OS respectively. (Will have to create the further mount points in the /mnt
directory using the mkdir
command)
1mount /dev/sda10 /mnt23# mkdir /mnt/home4# mount /dev/<home partition> /mnt/home
Mirrors
The default pacman mirrorlist works good enough for me and hence, I prefer not to make any changes to it.
Base packages
While using the bootable medium, the pacstrap
script can be used to install packages into the installation system. Using this, install the base
, linux
, linux-firmware
packages. Furthermore, the base
package doesn’t include a lot of required tools and packages that are necessary for a functional system. The following is the packages that I prefer to install at the same time, to have a working system.
1pacstrap /mnt base linux linux-firmware dhcpcd iputils netctl vim emacs man-db man-pages texinfo wpa_supplicant dialog base-devel
Once these packages are installed, they will be available in the system later on, either in chroot or while logging in.
System Configuration
After installing the required packages, we now need to configure the system to be usable without the live boot medium.
FSTAB
To generate and configure the fstab
, the genfstab
command can be used with the -U
and -L
flags to define the partition points by UUID or label respectively.
1genfstab -U /mnt >> /mnt/etc/fstab
The resulting file can be checked and edited in case of any changes.
Chroot
Now, change the root to the new system by using the arch-chroot
command on the /mnt
directory.
1arch-chroot /mnt
Timezone
You can set the timezone of the system by linking the required file to /etc/localtime
by using the following command.
1ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime
Once you do this, use hwclock
to generate /etc/adjtime
and sync hardware clock.
1hwclock --systohc
Generate Locales
To generate the locales you want for the system, edit the /etc/locale.gen
file using the editors installed using pacstrap
and uncomment the lines corresponding to the locales. (ex: en_US.UTF-8 UTF-8
, en_IN UTF-8
etc). Then, the locales can be generated by running:
1locale-gen
Also create the /etc/locale.conf
file and set the LANG
variable in the file:
1LANG=en_US.UTF-8
Network configuration
After creating the locales, we now need to setup configuration for networking and connections. For this, create the hostname file in /etc/hostname
.
1<hostname>
Also add matching entries to the hosts file in /etc/hosts
:
1127.0.0.1 localhost2::1 localhost3127.0.1.1 <hostname>.localdomain <hostname>
Password
To set the password for the root
user, use the passwd
command.
Boot Loader
Install a linux-compatible boot loader to use multiple OSes. I have grub
installed already from the Ubuntu partition so I just use sudo update-grub
for it to recognise the new installation. Since grub is in Ubuntu, after rebooting in the following step, I log into Ubuntu and update grub, and then reboot again to log into the new Arch installation. For a completely new installation, one can install a boot loader in this step and configure it.
Reboot
On finishing the above steps, exit the chroot environment using the exit
command and the reboot the machine using reboot
on the console. While the machine gets rebooted, remove the live installation USB and use the newly installed system to log into via the boot-loader. This will log you in and you will see the console on tty1.
Post Basic Installation
Once the basic installation for Arch is done and you are logged into the console, first point of order should be to create a user account using:
1useradd -m <username>
Add password to the newly made account using:
1passwd <username>
Also add the new user to the sudoers group by editing the /etc/sudoers
file. It is a fairly self-explanatory file and can be edited easily using vim (or another such editor). Log out from the root user and log in to the newly created user accounts to set up the required packages and system.
X-server
X-server is needed to get the graphical display running, for any WM to run. My WM of choice is BSPWM which is available in the Arch repositories itself and can be installed using pacman. Run the following command to install the required packages:
1sudo pacman -S xorg xorg-init xterm bspwm sxhkd git python kitty zsh
After installing, to enable tap-to-click, natural scrolling, and a few other niceities, create the following file /etc/X11/Xorg.conf.d/10-touchpad.conf
1Section "InputClass"2 Identifier "touchpad overrides"3 Matchdriver "libinput"4 Option "ClickMethod" "clickfinger"5 Option "DisableWhileTyping" "true"6 Option "MiddleEmulation" "true"7 Option "Tapping" "true"8 Option "NaturalScrolling" "true"9EndSection
Once these things are set up, to start the server, run startx
from the virtual console, or if you want to start it automatically, add this to your .bash_profile
/ .zprofile
:
1if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]];then2 startx -- :03fi
startx
looks at the ~/.xinitrc
file, which should start the simple processes for your session and, at the end, exec
the WM of your choice. A very simple (and my current) config for this can be:
1#!/bin/sh23userresources=$HOME/.Xresources4usermodmap=$HOME/.Xmodmap5sysresources=/etc/X11/xinit/.Xresources6sysmodmap=/etc/X11/xinit/.Xmodmap78# merge in defaults and keymaps9if [ -f $sysresources ]; then10 xrdb -merge $sysresources11fi1213if [ -f $sysmodmap ]; then14 xmodmap $sysmodmap15fi1617if [ -f "$userresources" ]; then18 xrdb -merge "$userresources"19fi2021if [ -f "$usermodmap" ]; then22 xmodmap "$usermodmap"23fi2425# start some nice programs26if [ -d /etc/X11/xinit/xinitrc.d ] ; then27 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do28 [ -x "$f" ] && . "$f"29 done30 unset f31fi3233# set the mouse pointer to a left arrow pointer instead of a cross34xsetroot -cursor_name left_ptr3536dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY37export PATH="${HOME}/.config/bin:${PATH}"38exec bspwm
For starters, you can use the example configs for bspwmrc
and sxhkdrc
that are provided with BSPWM and can be found in /usr/share/doc/bspwm/examples
directory. Copy these files to ~/.config/bspwm/bspwmrc
and ~/.config/sxhkd/sxhkdrc
respectively. Make sure to properly update the sxhkdrc
file to use the programs installed in the system, at least the right terminal, before running startx, so that you can have access to the terminal once you start BSPWM and can then continue to build the system from there.
AUR Helper
A big big part of Arch is the AUR where one can find a package of almost anything. To install these packages, using an AUR helper is recommended. My preferred AUR helper right now is paru
which can be installed by following the following commands:
1git clone https://aur.archlinux.org/paru.git2cd paru3makepkg -si
paru
can now be used to install any required packages from the arch repositories or the AUR. A list of my preferred utilities can be installed using the command
1paru -S feh lemonbar picom wireless_tools alsa-utils pulseaudio pulseaudio-alsa xtitle tdrop ttf-iosevka ttf-hack ttf-fira-go ttf-jetbrains-mono libnotify dunst mu isync tmux firefox chromium slock bat mpv arc-gtk-theme arc-icon-theme pcmanfm-gtk3 xorg-xfd brightnessctl wget tldr evince pass unzip usbutils
For a program launcher, I am currently using a patched version of dmenu
, including the linewidth, and fuzzy search+highlight patches. It can be installed by building it using the code from the suckless website.
1git clone https://git.suckless.org/dmenu2cd dmenu3sudo make clean install
A detailed list of packages, classified on the basis of purpose and requirement shall be the subject of another post. I also plan to write a post on the BSPWM config and other tools I like in my setup.