Arch Linux Setup: Pre Installation - dmitana/dotfiles GitHub Wiki
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
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.
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.
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
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.
To set up a network connection, go through the following steps:
-
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 interfacewlp7s0
is the wireless interface -
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
-
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
-
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.
Use timedatectl
to ensure the system clock is accurate:
# List available timezones
# timedatectl list-timezones
# Set timezone
# timedatectl set-timezone Europe/Bratislava
# Activate network time synchronization
# timedatectl set-ntp true
# Check the service status
# timedatectl status
Identify block devices using lsblk
or fdisk
.
# lsblk
# fdisk -l
Use fdisk to modify partition
tables, for example fdisk /dev/sdX
.
You can reuse existing EFI system partion from Windows or create own EFI System partion followingly:
- Press
n
to add a new partition. -
If prompted, specify the partition type, type
p
to create a primary partition ore
to create an extended one. There may be up to four primary partitions. - Press
Enter
to select default partition number (e.g.1
so the full path is/dev/nvme0n1p1
). - Press
Enter
to select default starting sector. - Press
+1G
andEnter
to create partition with a size of 1GiB (it is enought for efi partition). - Type
1
(EFI System) as the partition's type id. If not promted, presst
to change a partition type, then pressEnter
to select default (latest) partition number and then type1
as the partition type. - Press
w
to write table to disk and exit.
- Press
n
to add a new partition. -
If prompted, specify the partition type, type
p
to create a primary partition ore
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/nvme0n1p5
). - Press
Enter
to select default starting sector. - Press
+1G
andEnter
to create partition with a size of 1GiB (it is enought for boot partition). - Type
20
(Linux filesystem) as the partition's type id. If not promted, presst
to change a partition type, then pressEnter
to select default (latest) partition number and then type20
as the partition type. - Press
w
to write table to disk and exit.
- Press
n
to add a new partition. -
If prompted, specify the partition type, type
p
to create a primary partition ore
to create an extended one. There may be up to four primary partitions. - Press
Enter
to select default partition number (e.g.6
so the full path is/dev/nvme0n1p6
). - 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
44
(Linux LVM) as the partition's type id. If not promted, presst
to change a partition type, then pressEnter
to select default (latest) partition number and then type44
as the partition type. - Press
w
to write table to disk and exit.
Note: Swap partition may be on a different device than LVM partition. If you want to have swap on created LVM partition skip this step.
- Press
n
to add a new partition. -
If prompted, specify the partition type, type
p
to create a primary partition ore
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, presst
to change a partition type, then pressEnter
to select default (latest) partition number and then type19
as the partition type. - Press
w
to write table to disk and exit.
I'm using LVM on LUKS
Create the LUKS encrypted container at the designated partition and enter the chosen password twice.
# cryptsetup luksFormat /dev/nvme0n1p6
Open the LUKS container:
# cryptsetup open /dev/nvme0n1p6 cryptlvm
The decrypted container is now available at /dev/mapper/cryptlvm
.
# pvcreate /dev/mapper/cryptlvm
# vgcreate vg0 /dev/mapper/cryptlvm
# lvcreate -L 16G vg0 -n swap
# lvcreate -L 65G vg0 -n root
# lvcreate -l 100%FREE vg0 -n home
# lvreduce -L -10G vg0/home
Tip: If a logical volume will be formatted with ext4
, leave at least 256
MiB free space in the volume group to allow using e2scrub(8)
. After creating
the last volume with -l 100%FREE
, this can be accomplished by reducing its
size with lvreduce -L -256M vg0/home
.
Note: Sizes can be adjusted, but left some space in the volume group for root filesystem snapshots. As you can see, I left 10GB unallocated.
# mkfs.ext4 /dev/vg0/root
# mkfs.ext4 /dev/vg0/home
# mkfs.fat -F 32 /dev/nvme0n1p1 # efi partion
# mkfs.ext4 /dev/nvme0n1p5 # boot partition
Also initialize a swap LV.
# mkswap /dev/vg0/swap
# swapon /dev/vg0/swap
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
$ mount --mkdir /dev/vg0/home /mnt/home
$ mount --mkdir /dev/nvme0n1p1 /mnt/efi
$ mount --mkdir /dev/nvme0n1p5 /mnt/boot
Warning: In case of small EFI system partition (Windows 10 creates only
100MB EFI partition) do not mount /boot
to this partition, 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.
$ mount --mkdir /dev/sdb1 /mnt/data
$ mount --mkdir /dev/nvme0n1p3 /mnt/windows
genfstab will later detect mounted file systems and swap space.
Continue to the Installation.