Skip to content

Instantly share code, notes, and snippets.

@ssdean
Last active March 27, 2025 11:01
Show Gist options
  • Save ssdean/b492330f773a36ed14970e162298150e to your computer and use it in GitHub Desktop.
Save ssdean/b492330f773a36ed14970e162298150e to your computer and use it in GitHub Desktop.
Arch Linux UEFI Install

Arch Linux UEFI Install

To add:

  • Networking with systemd-networkd + iwd
  • Update os-prober instructions

Connect to the network

Wired connection is activated automatically. For wi-fi use the following.

iwctl

You will now be running the iwctl interactive prompt. To get your device name enter the following.

device list

To list available networks.

station [dev name] get-networks

Connect the device.

station [dev name] connect [SSID]

You can now exit the iwctl prompt.

quit

Partitioning the disk

Use cfdisk to partition the drive as shown below. This allows easy creation and deletion of partitions. Be sure to write changes before exiting the program.

Ensure partition types are set as shown in table below.

Depending on the system the disk may not be called sda but this is what I'll be using fo the examples.

Note

Instructions on swap files are included further down the guide. Swap file elimintates the need for a swap partiton.

Note

If dual booting using a single disk, your existing EFI partition can be used instead of creating a new one.

A basic partition table is as follows:

Partition Mount point Size Type
sda1 /boot 512M EFI System
sda2 NA 8G Linux swap
sda3 / 20-50G Linux filesystem
sda4 /home Remainder Linux filesystem

If disk space allows I prefer 50G for root. Though this is not required.

Create and mount the filesystems

WARNING: The following is for example only. The names of partitions may vary. Ensure to remember which of your partitions corresponds to its respective partition in the guide when formatting and mounting.

Create

Running the following in order will format the paritions created earlier. sda1 is a FAT filesystem, this is required by boot partitions. sda2 is formatted as swap, this creates extra space for system memory. sda3 and sda4 are formatted as ext4, the default Linux filesystem.

mkfs.fat -F32 /dev/sda1

mkswap /dev/sda2

mkfs.ext4 /dev/sda3

mkfs.ext4 /dev/sda4

Mount

Firstly the root partition will need to be mounted. Denoted by /, this is the root of the filesystem from which the rest of the file system branches. During this stage of the installation we are working from outside of the installation, so root is mounted at /mnt rather than / for now. Once mounted we can begin to add our first directories to the system. Directories for UEFI and user files are then created and mounted to their respective partitions. Finally the swap partition is mounted.

mount /dev/sda3 /mnt

mkdir /mnt/boot

mount /dev/sda1 /mnt/boot

mkdir /mnt/home

mount /dev/sda4 /mnt/home

swapon /dev/sda2

Modify the mirrorlist

Mirrors are copies of the Arch Linux server which are hosted throughout the world. Without this step the installation of packages in the following steps may be terribly slow.

This first command is not required, however the mirror list it provides is grouped by locale which I find makes it much easier to edit.

curl -o /etc/pacman.d/mirrorlist https://archlinux.org/mirrorlist/all/

Determine which mirror locations are closest to you and uncomment them.

nano /etc/pacman.d/mirrorlist

Install the base packages

As well as a few things required for networking and booting the system. Change cpu_manufacturer bellow to your match your cpu (amd or intel).

pacstrap -i /mnt base base-devel linux linux-headers linux-firmware cpu_manufacturer-ucode dialog nano wpa_supplicant wireless_tools networkmanager network-manager-applet

Generate fstab (File system table)

This generates instructions for the system to follow when mounting the system. It will mimic the manually mounted system from earlier.

genfstab -U /mnt >> /mnt/etc/fstab

Chroot into the system

This command means change root. The following will cause /mnt to become the root of the filesystem (/). Steps from this point will be executed within the new installation rather than the installation media.

arch-chroot /mnt

[Optional] Swap file (If no swap partition)

The purpose of a swap file is the same as a swap partiton only it eliminates the need to mount its own partition.

The following will create a swap file and give the appropriate permissions

fallocate -l 8GB /swapfile

chmod 600 /swapfile

mkswap -L swap /swapfile

swapon /swapfile

Add the following line to the end of /etc/fstab

/swapfile none swap defaults 0 0

Configure locale

Timezone

Change "Australia" and "Brisbane" in the line bellow as required.

ln -sf /usr/share/zoneinfo/Australia/Brisbane /etc/localtime

Locale

Uncomment your preferred language in the following file. In my case this is en_AU.UTF-8 UTF-8 for Australia. If you are unsure use U.S settings en_US.UTF-8 UTF-8.

nano /etc/locale.gen

Generate locale

locale-gen

Language

Add language. Use the same language selected in /etc/locale.gen e.g LANG=en_AU.UTF-8

echo "LANG=en_AU.UTF-8" >> /etc/locale.conf

Clock

If you are running a system dual booted with Windows I recommend running hwclock --systohc --local This will prevent the clocks from interfering with each other and displaying incorrect times. The time will likely still be incorrect after completing the Arch installation. To fix this, boot into Windows. Type 'services' into the menu search bar and press enter. Scroll down to 'Windows time', right click and select 'start' or 'restart'. Wait for the time to update. Arch will now also display the correct time.

Otherwise, the default Linux clock setting is UTC. Enter hwclock --systohc --utc

Choose a hostname

Give the host machine a name, change <hostname> to what ever name you like.

echo <hostname> > /etc/hostname

Add the following to /etc/hosts.

127.0.0.1 localhost
::1       localhost
127.0.1.1 <hostname>.localdomain <hostname>

Create a root password

This will create the root password, required to login as the root user.

passwd

Configure a bootloader

Choose a bootloader, systemd-boot or GRUB

[Option 1] GRUB bootloader

pacman -S grub efibootmgr

For dual booted machines also install and run os-prober. This will ensure other operating systems are added to the GRUB menu.

pacman -S os-prober

To enable os-prober open /etc/default/grub for editing. Uncomment the following line from the end of the file.

GRUB_DISABLE_OS_PROBER=false

Run os-prober. Note that if the other OS is on another EFI partition, that partition will need to be mounted prior to running. e.g to /mnt.

os-prober

Configure GRUB.

grub-install --target=x86_64-efi bootloader-id=GRUB --efi-directory=/boot

grub-mkconfig -o /boot/grub/grub.cfg

[Option 2] Systemd-boot

Install systemd-boot

bootctl install

Create boot config

nano /boot/loader/entries/arch.conf

Add the following. Use lsblk to get root device name. In this case / is mounted to sda3

title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root=/dev/sda3 rw

Configure default

nano /boot/loader/loader.conf

Add the following

default      arch
timeout      3

Exit chroot and unmount

exit

umount -R /mnt

reboot

Remove the install media. Arch Linux is installed. It's now just a matter of creating users and configuring your desktop.

Create user

Log in as root and create your user.

First, give the wheel group sudoer access. This will allow members of the wheel group to use the sudo command.

Using the command EDITOR=nano visudo Uncomment the line %wheel ALL=(ALL) ALL DO NOT REMOVE THE %

Now we can create the user. -m creates a home directory for the user. -g adds the users primary group. -G adds any supplementary groups.

useradd -m -g users -G wheel <username>

passwd <username>

exit 

login as with your user profile.

Install a desktop environment

There are many different environments to choose from. Here are some popular options.

First re-connect to the internet.

sudo systemctl enable --now NetworkManager.service

To connect to Wi-Fi

nmcli device wifi connect <SSID> password <password>

i3

Bare bones window manager.

Note: i3 comes with no programs installed. Be sure to install the basics such as a browser and terminal along with the line below.

sudo pacman -S i3-wm dmenu xorg xorg-xinit lightdm lightdm-gtk-greeter network-manager-applet

sudo systemctl enable --now lightdm

Or, start from terminal.

echo "exec i3" > ~/.xinitrc

startx

Gnome

Simple, easy to use environment, Default display manager is gdm.

sudo pacman -S gnome

Start with display manager

sudo systemctl enable --now gdm

Or, start from terminal.

sudo pacman -S xorg-xinit

Add the following to ~/.xinitrc

export XDG_SESSION_TYPE=x11
export GDK_BACKEND=x11
exec gnome-session

start

startx

Plasma

Highly configurable desktop environment. Default display manager is sddm.

sudo pacman -S plasma

Start with display manager

sudo systemctl enable --now sddm

Or, start from terminal.

sudo pacman -S xorg-xinit

Add the following to ~/.xinitrc

export DESKTOP_SESSION=plasma
exec startplasma-x11

start

startx

xfce

A lightweight desktop. Default display manager is lightdm

sudo pacman -S lightdm-gtk-greeter xorg xorg-xinit firefox xfce4 xfce4-goodies

sudo systemctl enable lightdm

reboot

Or, start from terminal.

echo "exec startxfce4" > ~/.xinitrc

startx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment