Artix Linux - Installation
Personal Artix Linux installation guide; this is part of my Linux installtion guide. The instructions here are based on Artix Wiki's installation and full disk encryption installation wikis, and ArchWiki's installation and dm-crypt wikis.
Pre-installation
Boot from the installation media.
Set keyboard layout
$ loadkeys <map>
where <map> is one of the available layouts from
$ ls /usr/share/kbd/keymaps/**/*.map.gz
omitting path and file extension.
Connect to the Internet
Verify that there is a working Internet connection
$ ping artixlinux.org
A wired connection is setup automatically, if found. Wireless connections must be configured by the user. If no connection is available, check ArchWiki's Network configuration for possible solutions.
Partition the disks
If required, manage the partitions on the disks. Execute
$ fdisk /dev/<dev>
where <dev> is the device identifier of the disk to partition (e.g., sda,
nvme0n1).
Create a new partition table
If needed, create a new GUID Partition Table (GPT). Creating a GPT on a disk with data on it will erase all the data
on the disk. To create a new GPT, on fdisk's prompt type g to create it.
Manage partitions
- To create a new partition, on
fdisk's prompt:- Type
n; - Specify the partition number;
- Specify the first sector. It is advisable to use the default value;
- Specify the last sector. It is advisable to specify it by using
+<size>[K|M|G|T].
- Type
- To change the partition type, on
fdisk's prompt:- Type
t; - Specify the partition number;
- Specify the partition type (press
Lto list all possible values).
- Type
- To list the partitions, on
fdisk's prompt typep.
To write the changes to disk, on fdisk's prompt type w.
Device encryption
Setup the root and home partitions as encrypted LUKS partitions
$ cryptsetup -v --type luks -c aes-xts-plain64 -s 512 -h sha512 -y luksFormat /dev/<devpart_root> $ cryptsetup -v --type luks -c aes-xts-plain64 -s 512 -h sha512 -y luksFormat /dev/<devpart_home>
where <devpart_root> and <devpart_home> refer to the device
identifier and partition number of the root and home partitions, respectively (e.g., /dev/sda2 or
/dev/nvme0n1p2).
Format the partitions
Unlock the partitions
$ cryptsetup open /dev/<devpart_root> cryptroot $ cryptsetup open /dev/<devpart_home> home
where <devpart_root> and <devpart_home> are as explained above.
Unlocking the partitions will map them to a new device name under /dev/mapper using the device mapper. For
example, the commands above will map /dev/<devpart_root> and
/dev/<devpart_home> to /dev/mapper/cryptroot and /dev/mapper/home,
respectively.
Format the partitions by executing
$ mkfs.fat -F32 /dev/<devpart_ESP> $ mkfs.ext4 /dev/mapper/cryptroot $ mkfs.ext4 /dev/mapper/home
where <devpart_ESP> refers to the device identifier and partition number of the
EFI system partition or ESP (e.g.,
/dev/sda1 or /dev/nvme0n1p1).
Mount the file systems
Mount the root partition under /mnt and the ESP and home partition under the corresponding mounting
points
$ mount /dev/mapper/cryptroot /mnt $ mkdir /mnt/boot $ mkdir /mnt/home $ mount /dev/<devpart_ESP> /mnt/boot $ mount /dev/mapper/home /mnt/home
where <devpart_ESP> is as explained above.
Installation
Install initial packages
$ basestrap /mnt base runit elogind-runit linux linux-firmware base-devel cryptsetup cryptsetup-runit polkit e2fsprogs dosfstools man-db man-pages vim tmux rsync wget git openssh openssh-runit unzip p7zip bc htop tree networkmanager networkmanager-runit
Generate /etc/fstab file
$ fstabgen -U /mnt >> /mnt/etc/fstab
Change root into the new system
$ artix-chroot /mnt
Time zone
$ ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime
where <Region> is one of the available options from
$ ls /usr/share/zoneinfo
and <City> is one of the available options from
$ ls /usr/share/zoneinfo/<Region>
To generate /etc/adjtime, execute
$ hwclock --systohc
Locale
Update /etc/locale.gen by uncommenting the desired localisations. To generate them, execute
$ locale-gen
Create /etc/locale.conf and add lines setting the variables
LANG and
LANGUAGE to
the desired values
/etc/locale.conf
LANG=<localisation> LANGUAGE=<list_languages>
Make the desired
keymap persistent by
setting KEYMAP in /etc/vconsole.conf
/etc/vconsole.conf
KEYMAP=<map>
Network configuration
Create /etc/hostname and add a line with the desired hostname <hostname>
/etc/hostname
<hostname>
Create /etc/hosts and add matching entries
/etc/hosts
127.0.0.1 localhost ::1 localhost 127.0.1.1 <hostname>
If the system has a permanent IP address, it should be used instead of 127.0.1.1.
Enable NetworkManager service
$ ln -s /etc/runit/sv/NetworkManager /etc/runit/runsvdir/default/
Configure mkinitcpio
Update /etc/mkinitcpio.conf so that it contains the following hooks
/etc/mkinitcpio.conf
... HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck) ...
encrypt must be placed after the udev hook and keymap must appear before the
encrypt hook (otherwise the encryption password is entered using the default US keymap instead of that
specified in /etc/vconsole.conf).
Regenerate the initramfs
mkinitcpio -p linux
Set root password
$ passwd
Boot loader
Get the latest version of rEFInd (0.13.2 when writing this guide), uncompress the file and copy the rEFInd files into the ESP
$ wget https://downloads.sourceforge.net/project/refind/0.13.2/refind-bin-0.13.2.zip $ unzip refind-bin-0.13.2.zip $ mkdir /boot/EFI $ cp -r refind-bin-0.13.2/refind /boot/EFI/
Remove files not relevant to the x64 architecture
$ cd /boot/EFI/refind $ rm -r refind_ia32.efi refind_aa64.efi drivers_ia32 drivers_aa64 tools_ia32 tools_aa64
Also, it is strongly recommended to remove
unneeded drives in drivers_x64 (see rEFInd's
page on drivers). Rename the configuration file
$ mv refind.conf-sample refind.conf
The boot option for this installation will be specified with a manual boot stanza. Kernel parameters are set in the boot stanza. Particularly, we need to set those required to boot from an encrypted root partition:
root: specifies the device of the decrypted root file system.cryptdevice: parsed bymkinitcpio'sencrypthook to identify the device containing the encrypted system. This will make the system prompt for the passphrase to unlock the device containing the encrypted installation on boot.
Create a manual boot stanza at the end of /boot/EFI/refind/refind.conf
/boot/EFI/refind/refind.conf
...
menuentry "Artix Linux" {
volume "<PARTUUID_ESP>"
loader /vmlinuz-linux
initrd /initramfs-linux.img
options "cryptdevice=UUID=<UUID_root>:cryptroot root=/dev/mapper/cryptroot"
}
where <PARTUUID_ESP> is the PARTUUID of /dev/<devpart_ESP>,
<UUID_root> is the UUID of /dev/<devpart_root> and
<devpart_ESP> and <devpart_root> are as explained above. The
PARTUUID and UUID can be obtained with
$ blkid
Unlock the home partition at boot
Create or copy a keyfile for unlocking the home partition and set the correct file permissions:
-
If creating a file, execute
$ dd bs=512 count=4 if=/dev/random of=/etc/keyfile-home iflag=fullblock status=progress $ chmod 600 /etc/keyfile-home
-
If copying a file, execute
$ cp <path_to_keyfile> /etc/keyfile-home $ chmod 600 /etc/keyfile-home
Add a keyslot for the keyfile to the LUKS header
$ cryptsetup luksAddKey /dev/<devpart_home> /etc/keyfile-home
where <devpart_home> is as explained above.
Update /etc/crypttab for automatically unlocking the home partition at boot
/etc/crypttab
home UUID=<UUID_home> /etc/keyfile-home
where <UUID_home> is the UUID of /dev/<devpart_home>.
Reboot
Exit the chroot environment by executing exit or pressing Ctrl+D. Optionally,
unmount all partitions
$ umount -R /mnt
Restart the machine by executing reboot.
Post-installation
Configure the system following the post-installation guide. Also, take a look at the post-installation guides for different devices.