Skip to content

Arch Linux Setup: Pre Installation

Denis Mitana edited this page Jul 12, 2020 · 5 revisions

Pre-Installation

Download installation media and verify signature

The installation media and their GnuPG signatures can be acquired from the Download page.

It is recommended to verify the image signature before use, especially when downloading from an HTTP mirror.

# On a system with GnuPG installed
$ gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig

# Alternatively, from an existing Arch Linux installation
$ pacman-key -v archlinux-version-x86_64.iso.sig

Create USB flash installation medium

Find out the name of your USB drive with lsblk. Make sure that it is not mounted.

Run the following command, replacing /dev/sdx with your drive, e.g. /dev/sdb. (Do not append a partition number, so do not use something like /dev/sdb1):

$ sudo cp path/to/archlinux.iso /dev/sdx

Warning: This will irrevocably destroy all data on /dev/sdx. To restore the USB drive as an empty, usable storage device after using the Arch ISO image, the ISO 9660 filesystem signature needs to be removed by running wipefs --all /dev/sdx as root, before repartitioning and reformatting the USB drive.

Boot the live environment

When the Arch menu appears, select Arch Linux install medium and press Enter to enter the installation environment.

To switch to a different console—for example, to view this guide with ELinks alongside the installation—use the Alt+arrow shortcut. To edit configuration files, nano and vim are available.

Set the keyboard layout

The default console keymap is US. Available layouts can be listed with:

$ ls /usr/share/kbd/keymaps/**/*.map.gz

To modify the layout, append a corresponding file name to loadkeys, omitting path and file extension. For example, to set a Slovak qwerty keyboard layout:

$ loadkeys sk-qwerty

Verify the boot mode

Archiso uses systemd-boot for booting in UEFI mode and syslinux for booting in BIOS mode.

To verify the boot mode, list the efivars directory:

$ ls /sys/firmware/efi/efivars

If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode. If the system did not boot in the mode you desired, refer to your motherboard's manual.

Connect to the internet

To set up a network connection, go through the following steps:

  1. Ensure your network interface is listed and enabled, for example with ip-link:
$ ip link

You should see something like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
		link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s30: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
		link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
3: wlp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
		link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff permaddr 00:00:00:00:00:00

enp0s30 is the wired interface

wlp7s0 is the wireless interface

  1. For wireless, make sure the wireless card is not blocked with rfkill.

Many laptops have a hardware button (or switch) to turn off wireless card, however, the card can also be blocked by kernel. This can be handled by rfkill. To show the current status:

$ rfkill list

You should see something like this:

0: phy0: Wireless LAN
	Soft blocked: yes
	Hard blocked: yes

If the card is hard-blocked, use the hardware button (switch) to unblock it. If the card is not hard-blocked but soft-blocked, use the following command:

$ rfkill unblock wifi
  1. Connect to the network.
  • For ethernet - plug in the cable.
  • For Wi-Fi - authenticate to the wireless network using iwctl:
# To get an interactive prompt
$ iwctl

# List all Wi-Fi devices
[iwd]$ device list

# Scan for networks
[iwd]$ station device scan

# List all available networks
[iwd]$ station device get-networks

# Connect to a network
[iwd]$ station device connect SSID
  1. The connection may be verified with ping:
$ ping archlinux.org

Note: The installation image has systemd-networkd.service, systemd-resolved.service and iwd.service enabled by default. That will not be the case for the installed system.

Update the system clock

Use timedatectl to ensure the system clock is accurate:

# List available timezones
$ timedatectl list-timezones

# Set timezone
$ timedatectl set-timezone Europe/Vienna

# Activate network time synchronization
$ timedatectl set-ntp true

# Check the service status
$ timedatectl status

Partition the disks

Identify block devices using lsblk or fdisk.

$ lsblk
$ fdisk -l

Use fdisk to modify partition tables, for example fdisk /dev/sdX.

Create the boot partition

I am currently using EFI system partition from Windows. Once I create it manually, I will add the guide. Now you can check it here.

Create the partition for LVM

  • Press n to add a new partition.
  • If prompted, specify the partition type, type p to create a primary partition or e to create an extended one. There may be up to four primary partitions.
  • Press Enter to select default partition number (e.g. 5 so the full path is /dev/sda5).
  • Press Enter to select default starting sector.
  • Press Enter to select default ending sector or use the + symbol to specify a position relative to the start sector measured in sectors, kibibytes (K), mebibytes (M), gibibytes (G), tebibytes (T), or pebibytes (P); for instance, setting +2G as the last sector will specify a point 2GiB after the start sector.
  • Type 30 (Linux LVM) as the partition's type id. If not promted, press t to change a partition type, then press Enter to select default (latest) partition number and then type 30 as the partition type.
  • Press w to write table to disk and exit.

Create the swap partition

Note: Swap partition may be on a different device than LVM partition.

  • Press n to add a new partition.
  • If prompted, specify the partition type, type p to create a primary partition or e to create an extended one. There may be up to four primary partitions.
  • Press Enter to select default partition number.
  • Press Enter to select default starting sector.
  • Type +16G to create a swap of size 16GB (adjust based on your RAM size).
  • Type 19 (Linux swap) as the partition's type id. If not promted, press t to change a partition type, then press Enter to select default (latest) partition number and then type 19 as the partition type.
  • Press w to write table to disk and exit.

Create physical volume

$ pvcreate /dev/sda5

Create volume group

$ vgcreate vg0 /dev/sda5

Create logical volumes

$ lvcreate -L 25G vg0 -n root
$ lvcreate -L 60G vg0 -n home

Note: Sizes can be adjusted, but left some space in the volume group for root filesystem snapshots. As you can see, I left 5GB unallocated.

Format the partitions

$ mkfs.ext4 /dev/vg0/root
$ mkfs.ext4 /dev/vg0/home

Also initialize a swap partition.

$ mkswap /dev/sdX2
$ swapon /dev/sdX2

Mount the file systems

Mount the file system on the root partition to /mnt. Create any remaining mount points (such as /mnt/home) using mkdir and mount their corresponding partitions.

$ mount /dev/vg0/root /mnt
$ mkdir /mnt/home
$ mount /dev/vg0/home /mnt/home
$ mkdir /mnt/efi
$ mount /dev/sda2 /mnt/efi

Warning: In case of small EFI system partition (Windows 10 creates only 100MB EFI partition) do not mount this partition to /boot, because there are stored kernel and initramfs files that can be large. In any case, it is better to mount EFI system partition on /efi.

I am using second HDD as a data storage and also Windows as a secondary OS, so I also mount these partitions.

$ mkdir /mnt/data
$ mkdir /mnt/windows
$ mount /dev/sdb1 /mnt/data
$ mount /dev/sda4 /mnt/wwindows

genfstab will later detect mounted file systems and swap space.

Continue to the Installation.