<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tim Assavarat</title>
    <description>The latest articles on DEV Community by Tim Assavarat (@tassavarat).</description>
    <link>https://dev.to/tassavarat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F880160%2F0e841d47-567a-453b-b5c2-ebdce8b01e1d.jpeg</url>
      <title>DEV Community: Tim Assavarat</title>
      <link>https://dev.to/tassavarat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tassavarat"/>
    <language>en</language>
    <item>
      <title>Installing Arch Linux with Btrfs and Encryption</title>
      <dc:creator>Tim Assavarat</dc:creator>
      <pubDate>Wed, 20 Jul 2022 01:01:04 +0000</pubDate>
      <link>https://dev.to/tassavarat/installing-arch-linux-with-btrfs-and-encryption-48na</link>
      <guid>https://dev.to/tassavarat/installing-arch-linux-with-btrfs-and-encryption-48na</guid>
      <description>&lt;p&gt;For those looking to install Arch Linux, it is my hope that this guide will prove useful. Most of the information here is from &lt;a href="https://wiki.archlinux.org/" rel="noopener noreferrer"&gt;https://wiki.archlinux.org/&lt;/a&gt;. The advantage of this guide is all the information being available on one opinionated page. This guide assumes that we know how to download an Arch Linux image and boot into it, along with the system booting into UEFI mode. We will be messing with our systems so I strongly recommend to &lt;strong&gt;read this guide carefully&lt;/strong&gt;. With that out of the way let's begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Change console keymap
&lt;/h2&gt;

&lt;p&gt;Those using a different keyboard layout may want to change the console keymap. To change to dvorak, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;loadkeys dvorak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Connectivity
&lt;/h2&gt;

&lt;p&gt;Next we will want to connect to the internet. If your device is plugged in via Ethernet cable then you should be good to go. Otherwise, we can connect to a Wi-Fi network using iwctl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iwctl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find out the name of your wireless device:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;device list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scan for networks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;station &amp;lt;device name&amp;gt; scan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List network SSID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;station &amp;lt;device name&amp;gt; get-networks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Connect to network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;station &amp;lt;device-name&amp;gt; connect &amp;lt;SSID&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leave iwctl by sending a SIGINT signal with &lt;code&gt;Ctrl+c&lt;/code&gt;.&lt;br&gt;
Test connection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping archlinux.org
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we get a response then we can stop pinging using &lt;code&gt;Ctrl+c&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update system clock
&lt;/h2&gt;

&lt;p&gt;With connectivity taken care of let's enable and start network time synchronisation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;timedatectl set-ntp true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Partitioning
&lt;/h2&gt;

&lt;p&gt;Now we start the process for partitioning the disks. First we will identify disks in &lt;code&gt;/proc/partitions&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fdisk -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3juydifvnmrdcbzskq1i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3juydifvnmrdcbzskq1i.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are looking for a drive we want to install Arch on. The section labeled &lt;code&gt;Disk model&lt;/code&gt; should help us identify what drive we want. In the image above, if we wanted to install on the SanDisk, the location of the &lt;code&gt;block device&lt;/code&gt; would be &lt;code&gt;/dev/sda&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since we are going to encrypt our root directory, let's securely erase the drive. First, create a container called &lt;code&gt;to_be_wiped&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cryptsetup open --type plain -d /dev/urandom /dev/&amp;lt;block-device&amp;gt; to_be_wiped
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we will zero out the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dd bs=1M if=/dev/zero of=/dev/mapper/to_be_wiped status=progress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we close the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cryptsetup close to_be_wiped
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the drive erased, we will now use fdisk to partition the disk. fdisk is interactive and we will walk through the process together. First lets manipulate the drive we want to partition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fdisk /dev/&amp;lt;block-device&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can enter &lt;code&gt;m&lt;/code&gt; to see the available commands. The first thing we want to do is create a new partition table. We can do that by entering &lt;code&gt;g&lt;/code&gt;.&lt;br&gt;
We need two partitions: An EFI system partition to boot and a root directory / partition to hold our data. Let's create them now with &lt;code&gt;n&lt;/code&gt;.&lt;br&gt;
We will be prompted to assign a partition number, leave it at the default by hitting enter. Similarly, leave the first sector at the default and hit enter. Our first partition will be 512M so for the last sector enter &lt;code&gt;+512M&lt;/code&gt;.&lt;br&gt;
Change the partition type with &lt;code&gt;t&lt;/code&gt; then &lt;code&gt;1&lt;/code&gt; for EFI.&lt;br&gt;
Next we create another partition with &lt;code&gt;n&lt;/code&gt; and leave everything at their default values.&lt;br&gt;
If we enter &lt;code&gt;p&lt;/code&gt; fdisk will print out our partition table and we should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu5674p3c9ah17k3ptp56.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu5674p3c9ah17k3ptp56.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we write the partition table to disk with &lt;code&gt;w&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Format partitions
&lt;/h2&gt;

&lt;p&gt;We can now format the partitions. First we will format the boot partition, we are looking for the device with the type &lt;code&gt;EFI System&lt;/code&gt;. Partition it to FAT32 and label it &lt;code&gt;ESP&lt;/code&gt; with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkfs.fat -F32 -n ESP /dev/&amp;lt;boot-partition&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to encrypt our data, we will need to create a Linux Unified Key Setup (LUKS) partition. Look for the device with the type &lt;code&gt;Linux filesystem&lt;/code&gt;. Format and label it &lt;code&gt;ARCH_LUKS&lt;/code&gt; with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cryptsetup luksFormat --label ARCH_LUKS /dev/&amp;lt;linux-partition&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After setting a password, let's open the LUKS partition and map it to the device name of &lt;code&gt;cryptroot&lt;/code&gt;. If using a SSD, we can disable internal read and write workqueue for increased performance with encryption using &lt;code&gt;cryptsetup --perf-no_read_workqueue --perf-no_write_workqueue --persistent open /dev/&amp;lt;luks-partition&amp;gt; cryptroot&lt;/code&gt;. Otherwise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cryptsetup open /dev/&amp;lt;luks-partition&amp;gt; cryptroot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our LUKS partition is now mapped to &lt;code&gt;/dev/mapper/cryptroot&lt;/code&gt;. Next we'll finally format &lt;code&gt;cryptroot&lt;/code&gt; to Btrfs and label it &lt;code&gt;ARCH&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkfs.btrfs -L ARCH /dev/mapper/cryptroot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List block devices and view filesystem info with &lt;code&gt;lsblk&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsblk -f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Mounting
&lt;/h2&gt;

&lt;p&gt;We will first mount our Btrfs filesystem &lt;code&gt;cryptroot&lt;/code&gt;. To improve performance we will disable access time metadata updates. We will also use &lt;code&gt;ZSTD&lt;/code&gt; compression with a level of &lt;code&gt;1&lt;/code&gt; to prioritise performance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mount -o noatime,compress=zstd:1 /dev/mapper/cryptroot /mnt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have mounted &lt;code&gt;cryptroot&lt;/code&gt; we will create subvolumes. Create &lt;code&gt;root&lt;/code&gt; and &lt;code&gt;home&lt;/code&gt; with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;btrfs subvolume create /mnt/root
btrfs subvolume create /mnt/home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unmount &lt;code&gt;cryptroot&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;umount /mnt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will now mount the subvolumes &lt;code&gt;root&lt;/code&gt; and &lt;code&gt;home&lt;/code&gt; at the appropriate locations instead of the toplevel subvolume. This is done to simplify the creation of snapshots:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mount -o noatime,compress=zstd:1,subvol=root /dev/mapper/cryptroot /mnt
mount --mkdir -o noatime,compress=zstd:1,subvol=home /dev/mapper/cryptroot /mnt/home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally mount the boot partition we previously created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mount --mkdir /dev/&amp;lt;boot-partition&amp;gt; /mnt/boot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install essential packages
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;pacstrap&lt;/code&gt; to install some packages so we can start using our system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pacstrap /mnt base linux linux-firmware btrfs-progs networkmanager vim man-db man-pages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fstab
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;genfstab&lt;/code&gt; to create a fstab file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;genfstab -L /mnt &amp;gt;&amp;gt; /mnt/etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Chroot
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;chroot&lt;/code&gt; into our new system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arch-chroot /mnt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations! We are now in our now system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time zone
&lt;/h2&gt;

&lt;p&gt;Set the time zone, we can use tab completion to view possible options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln -sf /usr/share/zoneinfo/&amp;lt;region&amp;gt;/&amp;lt;city&amp;gt; /etc/localtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set the Hardware Clock:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hwclock --systohc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Localisation
&lt;/h2&gt;

&lt;p&gt;We will use vim as our text editor to uncomment locales in &lt;code&gt;/etc/locale.gen&lt;/code&gt;, we should at least uncomment &lt;code&gt;en_US.UTF-8 UTF-8&lt;/code&gt;. Afterwards generate locales with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;locale-gen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create locale.conf and set the LANG variable:&lt;br&gt;
&lt;code&gt;vim /etc/locale.conf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LANG=en_US.UTF-8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we previously changed the console keymap then make it persist with:&lt;br&gt;
&lt;code&gt;vim /etc/vconsole.conf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KEYMAP=dvorak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Network configuration
&lt;/h2&gt;

&lt;p&gt;Create the hostname file and set the hostname as you wish, for example arch:&lt;br&gt;
&lt;code&gt;vim /etc/hostname&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable networkmanager so we will have connectivity once we leave the live environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl enable NetworkManager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Initramfs
&lt;/h2&gt;

&lt;p&gt;Since we are using encryption, we will need to  edit &lt;code&gt;mkinitcpio&lt;/code&gt;, the script used to create the initial ramdisk. Edit the file &lt;code&gt;/etc/mkinitcpio.conf&lt;/code&gt;. Go to the &lt;code&gt;HOOKS&lt;/code&gt; line that isn't commented out and replace &lt;code&gt;udev&lt;/code&gt; with &lt;code&gt;systemd&lt;/code&gt;, and add &lt;code&gt;sd-vconsole&lt;/code&gt; (if we changed the keymap) and &lt;code&gt;sd-encrypt&lt;/code&gt; hooks after &lt;code&gt;keyboard&lt;/code&gt;. Then recreate initramfs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkinitcpio -P
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Root password
&lt;/h2&gt;

&lt;p&gt;Set the root password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;passwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Boot loader
&lt;/h2&gt;

&lt;p&gt;Next install GRUB bootloader and microcode updates. If using Intel processor, replace &lt;code&gt;amd-ucode&lt;/code&gt; with &lt;code&gt;intel-ucode&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pacman -S grub efibootmgr amd-ucode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will now install the GRUB EFI application and its modules and name the bootloader &lt;code&gt;GRUB&lt;/code&gt; using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's edit our kernel parameters file. We previously labeled everything but unfortunately need the &lt;code&gt;UUID&lt;/code&gt; of our &lt;code&gt;ARCH_LUKS&lt;/code&gt; partition. Find the &lt;code&gt;UUID&lt;/code&gt; with &lt;code&gt;lsblk -f&lt;/code&gt; then edit &lt;code&gt;/etc/default/grub&lt;/code&gt;:&lt;br&gt;
All the following parameters need to be appended to &lt;code&gt;GRUB_CMDLINE_LINUX_DEFAULT&lt;/code&gt;.&lt;br&gt;
Unlock our device in initramfs by appending &lt;code&gt;rd.luks.name=&amp;lt;UUID&amp;gt;=cryptroot&lt;/code&gt;.&lt;br&gt;
Enable TRIM support, append &lt;code&gt;rd.luks.options=discard&lt;/code&gt;.&lt;br&gt;
Disable and blacklist watchdog module, append &lt;code&gt;nowatchdog module_blacklist=iTCO_wdt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fazczpymw9cinfdqcilhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fazczpymw9cinfdqcilhk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regenerate &lt;code&gt;grub.cfg&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grub-mkconfig -o /boot/grub/grub.cfg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our work in chroot is done, exit out with &lt;code&gt;exit&lt;/code&gt; or &lt;code&gt;Ctrl+d&lt;/code&gt; and &lt;code&gt;reboot&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Post-installation
&lt;/h2&gt;

&lt;p&gt;After rebooting and decrypting our drive, we should be greeted with a login screen. The only user we have right now is &lt;code&gt;root&lt;/code&gt; so enter that as our login username and supply the appropriate password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connectivity
&lt;/h3&gt;

&lt;p&gt;If we need to connect to Wi-Fi, use &lt;code&gt;nmcli&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmcli device wifi list
nmcli device wifi connect &amp;lt;SSID&amp;gt; password &amp;lt;PASSWORD&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Package management
&lt;/h3&gt;

&lt;p&gt;Arch usespacman as its package manager. Enable color output and parallel downloads by editing &lt;code&gt;/etc/pacman.conf&lt;/code&gt; and uncommenting &lt;code&gt;Color&lt;/code&gt; along with &lt;code&gt;ParallelDownloads&lt;/code&gt; and changing the value from 5 to 10. We can also an arguably nicer progress bar by adding &lt;code&gt;ILoveCandy&lt;/code&gt; right after &lt;code&gt;ParallelDownloads&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Remaining packages
&lt;/h3&gt;

&lt;p&gt;The choice of desktop environment if any at all is entirely up to the user. For the purposes of this guide we will be using GNOME.&lt;br&gt;
The packages required for display drivers varies based on hardware. I will link the appropriate wiki pages where we can find the correct packages to install:&lt;br&gt;
&lt;a href="https://wiki.archlinux.org/title/AMDGPU#Installation" rel="noopener noreferrer"&gt;AMD&lt;/a&gt;&lt;br&gt;
&lt;a href="https://wiki.archlinux.org/title/Intel_graphics#Installation" rel="noopener noreferrer"&gt;Intel&lt;/a&gt;&lt;br&gt;
&lt;a href="https://wiki.archlinux.org/title/NVIDIA#Installation" rel="noopener noreferrer"&gt;NVIDIA&lt;/a&gt;&lt;br&gt;
An example for AMD would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pacman -S sudo pacman-contrib archlinux-contrib reflector mesa vulkan-radeon libva-mesa-driver gnome gnome-tweaks pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber firewalld $(pacman -Ssq noto-fonts)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The display driver packages are &lt;code&gt;mesa vulkan-radeon libva-mesa-driver&lt;/code&gt;. &lt;code&gt;mesa&lt;/code&gt; provides 3D acceleration, &lt;code&gt;vulkan-radeon&lt;/code&gt; provides vulkan support, and accelerated video decoding is provided by &lt;code&gt;libva-mesa-driver&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Users and groups
&lt;/h3&gt;

&lt;p&gt;Let's create an unprivileged user and add it to the &lt;code&gt;wheel&lt;/code&gt; group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useradd -m -G wheel &amp;lt;user&amp;gt;
passwd &amp;lt;user&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Privilege elevation
&lt;/h3&gt;

&lt;p&gt;We will use &lt;code&gt;sudo&lt;/code&gt; to allow the user to run privileged commands. Since we have already added our user to the &lt;code&gt;wheel&lt;/code&gt; group, we just need to uncomment &lt;code&gt;%wheel ALL=(ALL) ALL&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EDITOR=vim visudo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will use &lt;code&gt;reflector&lt;/code&gt; to keep our mirrors up to date. To choose mirrors based in our country, and sort them by download rate. Edit &lt;code&gt;/etc/xdg/reflector/reflector.conf&lt;/code&gt;, uncomment and update &lt;code&gt;country&lt;/code&gt; and &lt;code&gt;sort age&lt;/code&gt; to &lt;code&gt;sort rate&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let's enable some timers and services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl enable fstrim.timer paccache.timer reflector.timer gdm firewalld bluetooth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally &lt;code&gt;reboot&lt;/code&gt; and login using our newly created user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finishing touches
&lt;/h3&gt;

&lt;p&gt;After decrypting our drive and logging in we should now be inside the GNOME desktop environment. If we changed our keymap, then the GNOME login will unfortunately be in qwerty, we will fix that now.&lt;/p&gt;

&lt;p&gt;Go to &lt;code&gt;Settings-&amp;gt;Keyboard&lt;/code&gt; and add in the desired keyboard layout. Next open &lt;code&gt;terminal&lt;/code&gt; and enter (replacing &lt;code&gt;us&lt;/code&gt; and &lt;code&gt;dvorak&lt;/code&gt; with the appropriate text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;localectl set-x11-keymap us dvorak
localectl set-keymap dvorak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are the only user and don't wish to enter a password to login after decrypting our drive, we can go to &lt;code&gt;Settings-&amp;gt;Users&lt;/code&gt; click &lt;code&gt;unlock&lt;/code&gt; and check &lt;code&gt;Automatic Login&lt;/code&gt;. Since we are no longer &lt;code&gt;root&lt;/code&gt; we need to use &lt;code&gt;sudo&lt;/code&gt; to install packages. For tracking unowned files, zsh, firefox, and gvim we will install the following packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -S pacutils zsh grml-zsh-config firefox gvim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;gvim&lt;/code&gt; will conflict with &lt;code&gt;vim-minimal&lt;/code&gt; that we installed earlier. Enter &lt;code&gt;y&lt;/code&gt; to remove &lt;code&gt;vim-minimal&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Start and configure &lt;code&gt;zsh&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;zsh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change &lt;code&gt;zsh&lt;/code&gt; to our default shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chsh -s $(which zsh)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make &lt;code&gt;vim&lt;/code&gt; our default editor and enable wayland for &lt;code&gt;Firefox&lt;/code&gt; by setting some environmental variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir .config/environment.d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;.config/environment.d/envvars.conf&lt;/code&gt; and have the following as the contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EDITOR=vim
MOZ_ENABLE_WAYLAND=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Source the environmental variables by restarting gdm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl restart gdm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that we are finally done! I hope this guide was helpful and we learned some things along the way.&lt;/p&gt;

</description>
      <category>archlinux</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
