# Arch Installation Guide
Table of Contents
You must be thinking - yet another installation guide! There is no dearth of Installation guides of Arch on web. So why another one?
With advancements like BTRFS file system, UEFI motherboards and modern in-development desktop environment like Plasma 5; traditional Arch Wiki guide and Arch Beginners’ Guide can only be of a limited help. After I got my new desktop, my goal was to setup it with a modern setup. I decided to go with Arch Linux with btrfs file system and Plasma 5 desktop. Coming from OSX, I just love how far linux has come in terms of looks - quite close to OSX!
I will cover this in two parts. First in this post, I will install the base system. Then, in a follow up post, I will discuss details of setting up final working Plasma 5 desktop.
Table of Contents
Initial Setup
Download the latest iso from Arch website and create the uefi usb installation media. I used my mac to do this on terminal:
diskutil listdiskutil unmountDisk /dev/disk1dd if=image.iso of=/dev/rdisk1 bs=1m20480+0 records in20480+0 records out167772160 bytes transferred in 220.016918 secs (762542 bytes/sec)
diskutil eject /dev/disk1
Use this media to boot into your machine. You should boot into UEFI mode if you have a UEFI motherboard and UEFI mode enabled.
To verify you have booted in UEFU mode, run:
efivar -l
This should give you a list of set UEFI variables. Please look at the Begineers’ Guide in case you do not get any list of UEFI variables.
Ethernet/Wifi
Ethernet should have started by default on your machine. If you do not plan to use wifi during installation, you can skip to the next section. If desired later, wifi will still be configurable after you are done with all the installation.
To setup wifi simply run:
wifi-menu
This is a pretty straight forward tool and will setup wifi for you for this installation session.
This will also create a file at /etc/netctl/. We will use this file later to enable wifi at the first session after installation.
System Updates
For editing different configurations, I tend to use vim. So we will update our package cache and install vim.
pacman -Syypacman -S vim
Hard Drives
In my desktop, I have three hard drives, one 256 GB solid state drive (SDD), one 1 TB HDD and another 3TB HDD. I set up my drives as follows: -SDD for root(/), /boot, and /home partitions, 1st HDD for /data and the 2nd HDD for /media partitions.
For UEFI machines, we need to use a GPT partition table and /boot partition has to be a fat32 partition with a minimum size of 512 MB. We will format rest other partitions with BTRFS. See this link for benefits of using btrfs partitions.
First list your hard drives with the following:
lsblkcat /proc/partitions
Assuming, my setup above, now create gpt partitions and format them.
dd if=/dev/zero of=/dev/sda bs=1M count=5000gdisk /dev/sdaFound invalid MBR and corrupt GPT. What do you want to do? (Using theGPT MAY permit recovery of GPT data.) 1 - Use current GPT 2 - Create blank GPT
Then press 2 to create a blank GPT and start fresh
ZAP:press x - to go to extended menupress z - to zappress Y - to confirmpress Y - to delete MBR
It might now kick us out of gdisk, so get back into it:
gdisk /dev/sda
Command (? for help): mCommand (? for help): n
Partition number (1-128, default 1):First sector (34-500118158, default = 2048) or {+-}size{KMGTP}:Last sector (2048-500118, default = 500118) or {+-}size{KMGTP}: 512MCurrent type is 'Linux filesystem'Hex code or GUID (L to show codes, Enter = 8300): ef00Changed type of partition to 'EFI System'
Partition number (2-128, default 2):First sector (34-500118, default = 16779264) or {+-}size{KMGTP}:Last sector (16779264-500118, default = 500118) or {+-}size{KMGTP}:Current type is 'Linux filesystem'Hex code or GUID (L to show codes, Enter = 8300):Changed type of partition to 'Linux filesystem'
Command (? for help): pPress w to write to diskPress Y to confirm
Repeat the above procedure for /dev/sdb and /dev/sdc, but create just one partition with all values as default. At the end we will have three partitions: /dev/sda1, /dev/sda2, /dev/sdb1 and /dev/sdc1
Now we will format these partitions.
mkfs.vfat -F32 /dev/sda1mkfs.btrfs -L arch /dev/sda2mkfs.btrfs -L data /dev/sdb1mkfs.btrfs -L media /dev/sdc1
Now, we will create btrfs subvolumes and mount them properly for installation and final setup.
mount /dev/sda2 /mntbtrfs subvolume create /mnt/ROOTbtrfs subvolume create /mnt/homeumount /mnt
mount /dev/sdb1 /mntbtrfs subvolume create /mnt/dataumount /mnt
mount /dev/sdc1 /mntbtrfs subvolume create /mnt/mediaumount /mnt
Now, once the sub-volumes have been created, we will mount them in appropriate locations with optimal flags.
$SSD_MOUNTS="rw,noatime,nodev,compress=lzo,ssd,discard, space_cache,autodefrag,inode_cache"HDD_MOUNTS="rw,nosuid,nodev,relatime,space_cache"EFI_MOUNTS="rw,noatime,discard,nodev,nosuid,noexec"mount -o $SSD_MOUNTS,subvol=ROOT /dev/sda2 /mntmkdir -p /mnt/homemkdir -p /mnt/datamkdir -p /mnt/mediamount -o $SSD_MOUNTS,nosuid,subvol=home /dev/sda2 /mnt/homemount -o $HDD_MOUNTS,subvol=data /dev/sdb1 /mnt/datamount -o $HDD_MOUNTS,subvol=media /dev/sdc1 /mnt/media
mkdir -p /mnt/bootmount -o $EFI_MOUNTS /dev/sda1 /mnt/boot
Base Installation
Now, we will do the actually installation of base packages.
pacstrap /mnt base base-devel btrfs-progsgenfstab -U -p /mnt >> /mnt/etc/fstab
Edit the /mnt/ect/fstab file to add following /tmp mounts.
tmpfs /tmp tmpfs rw,nodev,nosuid 0 0tmpfs /dev/shm tmpfs rw,nodev,nosuid,noexec 0 0
Finally bind root for installation.
arch-chroot /mnt /bin/bash
Basic Setup
Here are some basic commands you need to run to get the installation started.
pacman -Syypacman -S sudo vimvim /etc/locale.gen
...# en_SG ISO-8859-1en_US.UTF-8 UTF-8# en_US ISO-8859-1...
locale-genecho LANG=en_US.UTF-8 > /etc/locale.confexport LANG=en_US.UTF-8ls -l /usr/share/zoneinfoln -sf /usr/share/zoneinfo/Zone/SubZone /etc/localtimehwclock --systohc --utcsed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/" /etc/sudoersHOSTNAME=eulerecho $HOSTNAME > /etc/hostnamepacman -S dosfstools efibootmgrsed -i 's/^\(HOOKS=.*fsck\)\(.*$\)/\1 btrfs\2/g' /etc/mkinitcpio.confmkinitcpio -p linuxpasswd
We will also add hostname to our /etc/hosts file:
...127.0.0.1 localhost.localdomain localhost $HOSTNAME::1 localhost.localdomain localhost $HOSTNAME...
Bootloader Setup
systemd-boot, previously called gummiboot, is a simple UEFI boot manager which executes configured EFI images. The default entry is selected by a configured pattern (glob) or an on-screen menu. It is included with the systemd, which is installed on an Arch systems by default.
Assuming /boot is your boot drive, first run the following command to get started:
bootctl --path=/boot install
It will copy the systemd-boot binary to your EFI System Partition ( /boot/EFI/systemd/systemd-bootx64.efi
and /boot/EFI/Boot/BOOTX64.EFI
- both of which are identical - on x64 systems ) and add systemd-boot itself as the default EFI application (default boot entry) loaded by the EFI Boot Manager.
Finally to configure out boot loader, we will need the UUID of out root drive (/dev/sda2). You can find that by:
lsblk -no NAME,UUID /dev/sda2
Now, make sure that the following two files look as follows, where $UUID is the value obtained from above command:
...timeout 3default arch...
...
title Arch Linuxlinux /vmlinuz-linuxinitrd /initramfs-linux.imgoptions root=UUID=$UUID rw rootfstype=btrfs rootflags=subvol=ROOT...
Network Setup
First setup hostname using systemd:
hostnamectl set-hostname $HOSTNAME
Check the “Ethernet controller” entry (or similar) from the lspci -v
output. It should tell you which kernel module contains the driver for your network device. For example:
lspci -v$...04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 11) Subsystem: ASUSTeK Computer Inc. Device 859e Flags: bus master, fast devsel, latency 0, IRQ 29 I/O ports at d000 [size=256] Memory at f7100000 (64-bit, non-prefetchable) [size=4K] Memory at f2100000 (64-bit, prefetchable) [size=16K] Capabilities: <access denied> Kernel driver in use: r8169 Kernel modules: r8169...$
Next, check that the driver was loaded via dmesg | grep module_name
. For example:
dmesg | grep r8169$...[ 3.215178] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded[ 3.215185] r8169 0000:04:00.0: can't disable ASPM; OS doesn't have ASPM control[ 3.220477] r8169 0000:04:00.0 eth0: RTL8168g/8111g at 0xffffc90000c74000, 78:24:af:d7:1d:3d, XID 0c000800 IRQ 29[ 3.220481] r8169 0000:04:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko][ 3.226949] r8169 0000:04:00.0 enp4s0: renamed from eth0[ 5.128713] r8169 0000:04:00.0 enp4s0: link down[ 5.128713] r8169 0000:04:00.0 enp4s0: link down[ 8.110869] r8169 0000:04:00.0 enp4s0: link up...$
Proceed if the driver was loaded successfully. Otherwise, you will need to know which module is needed for your particular model. Please follow the Arch Wiki Networking guide for further assistance.
Get current device names via /sys/class/net
or ip link
. For example:
$...enp4s0 lo wlp3s0...$ip link$...2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 78:24:af:d7:1d:3d brd ff:ff:ff:ff:ff:ff...$
Using this name of the device, we need to configure, enable following two systemd services: systemd-networkd.service and systemd-resolved.service.
For compatibility with resolv.conf, delete or rename the existing file and create the following symbolic link:
ln -s /usr/lib/systemd/resolv.conf /etc/resolv.conf
Network configurations are stored as *.network in /etc/systemd/network. We need to create ours as follows.:
$...[Match]Name=enp4s0
[Network]DHCP=ipv4
...
$
Now enable these services:
systemctl enable systemd-resolved.servicesystemctl enable systemd-networkd.service
Your network should be ready for first use!
First Boot
Now we are ready for the first boot! Run the following command:
exitumount -R /mntreboot
Awesome! We are ready to play with our new system. Alas! what you have is just a basic installation without any GUI.
Please see my next post for where to go next!