Arch Linux Installation UEFI btrfs - LeandroTheDev/arch_linux GitHub Wiki

Load keyboard language

  • loadkeys br-abnt2

Connect to the internet

  • iwctl
  • device list
  • station wlan0 scan

This will show the intenets in your area.

  • station wlan0 get-networks
  • station wlan0 connect "INTERNET NAME"

Test internet connectivity

  • ping google.com

Update time date

  • timedatectl set-ntp true
  • timedatectl set-timezone America/Sao_Paulo

Alternativily you can see the timezones with timedatectl list-timezones

  • timedatectl status

Partitions

Creating the partition Select the one you want install arch

  • lsblk

Opens partition, ? means the disk letter

  • cfdisk /dev/sd?

Select the disk you wanted The first partition needs 300 MB is the EFI system partition

  • 300M / EFI System

Alternative 1 Swap Partition

Linux system

  • Default / Linux filesystem

Home partition #Optionally for formating device without losing data

  • Default / Linux filesystem

Save

  • write
  • quit

The ? means the disk letter you formated, the number is the partition

Active the UEFI boot partition

  • mkfs.fat -F32 /dev/sd?1

Active linux partition, also for the home directory if exist

  • mkfs.btrfs /dev/sd?2
  • mount /dev/sd?2 /mnt

Creating the root and home modules for snapshoting

  • btrfs subvolume create /mnt/@
  • btrfs subvolume create /mnt/@home
  • umount /mnt

Enabling zstd compression

  • mount -o compress=zstd,subvol=@ /dev/sd?2 /mnt
  • mkdir -p /mnt/home
  • mount -o compress=zstd,subvol=@home /dev/sd?2 /mnt/home

Downloading linux

  • pacman -Sy archlinux-keyring
  • pacstrap -i /mnt base-devel base linux or linux-zen linux-firmware vim

Enabling mount system

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

Entering in root user on the system

  • arch-chroot /mnt

Changing timezone

  • ln -sf /usr/share/zoneinfo/AMERICA/Sao_Paulo /etc/localtime
  • hwclock --systohc

Language

  • vim /etc/locale.gen
  • en_US.UTF-8 -> remove the #

Install the language

  • locale-gen

Naming the machine

  • vim /etc/hostname

Configuring localhost

  • vim /etc/hosts

Rembember to use Tab Spaces

127.0.0.1         localhost
::1               localhost
127.0.1.1	  machinename.localdomain	machinename

Change root password

  • passwd

Create user

  • useradd -m username

Create user password

  • passwd username

Give access to user

  • usermod -aG wheel username

Edit visudo to grant previleges to users

  • visudo
  • export EDITOR=vim

Remove the #

#%wheel ALL=(ALL) ALL

Download the grub for boot manager

  • pacman -S btrfs-progs grub grub-btrfs efibootmgr dosfstools os-prober mtools ntfs-3g snapper
  • mkdir /boot/EFI
  • mount /dev/sd?1 /boot/EFI

Installing

  • grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
  • grub-mkconfig -o /boot/grub/grub.cfg

Script for updating grub

  • vim /usr/sbin/update-grub

Add

#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"

Update settings

  • chown root:root /usr/sbin/update-grub
  • chmod 755 /usr/sbin/update-grub
  • update-grub
  • Not necessary because you already updated the grub before, buuuut... why not?

Install a network manager to use internet

  • pacman -S networkmanager
  • systemctl enable NetworkManager

Finishing installing

  • exit umount -R /mnt
  • reboot

Creating a snapshot from your system for recovery

  • I recommend creating a snapshot in the fresh install so you can go back to it later if you want to reinstall the system without doing everthing again

  • sudo snapper create-config /
  • sudo snapper -c root create -d "Fresh Install"

View snapshots

  • sudo snapper -c root list

Update grub with the latest snapshot

  • sudo update-grub

Configuring Arch Linux

Permanent loadkeys for terminal

  • sudo vim /etc/vconsole.conf

Add

KEYMAP=br-abnt2

Load numlock on startup

  • sudo vim /usr/local/bin/numlock

Add

#!/bin/bash

for tty in /dev/tty{1..6}
do
    /usr/bin/setleds -D +num < "$tty";
done
  • chmod +x /usr/local/bin/numlock

  • sudo vim /etc/systemd/system/numlock.service

Add

[Unit]
Description=numlock

[Service]
ExecStart=/usr/local/bin/numlock
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
  • sudo systemctl enable numlock

Alternative 2 Swap File

Use dd to create a swap file recommended 8 GB

  • dd if=/dev/zero of=/swapfile bs=1M count=8k status=progress

Give Permissions

  • chmod 0600 /swapfile

Format to Swap File

  • mkswap -U clear /swapfile

Active Swap

  • swapon /swapfile

Add any Entry for Swap File

  • sudo vim /etc/fstab

Add

/swapfile none swap defaults 0 0

Connect to the internet

  • sudo nmcli device wifi connect "INTRNETNAME" password "password"

Active some Librarys for pacman

  • sudo vim /etc/pacman.conf

Remove the #

#[multilib]
#Include = /etc/pacman blablablabla

Arch logs when entering

  • sudo vim /etc/default/grub

Implement

GRUB_CMDLINE_LINUX="loglevel=2 nowatchdog"

# Remove the hashtag
GRUB_DISABLE_OS_PROBER=false

Disable Stop Job

  • sudo vim /etc/systemd/system.conf

Remove the #

DefaultTimeoutStopSec=1s

Reload daemon after changing system.conf

  • sudo systemctl daemon-reload

Get Windows in Grub

  • sudo vim /etc/default/grub

Freezes and Improvements Workaround

AMD Users

  • sudo pacman -S amd-ucode earlyoom

Intel Users

  • sudo pacman -S intel-ucode earlyoom

Add to Startup Command

  • earlyoom -m 5,5

Update Grub to run amd-ucode

  • sudo update-grub
  • reboot

CPU Improvements not Recomended

  • linux-cachyos-bore auracle

  • Only for terminal uses

  • ananicy-git auracle

  • systemctl enable ananicy.service

  • cfs-zen-tweaks auracle

  • systemctl enable set-cfs-tweaks.service

Finish

  • Have Fun