Skip to content

Instantly share code, notes, and snippets.

@eminboydak
Last active April 7, 2024 23:31
Show Gist options
  • Save eminboydak/e6c4b9c87f6dcf8c13fd991bbf5e9314 to your computer and use it in GitHub Desktop.
Save eminboydak/e6c4b9c87f6dcf8c13fd991bbf5e9314 to your computer and use it in GitHub Desktop.
Notes on my Arch Linux installation

Notes on my Arch Linux installation

Hardware

  • Lenovo Thinkpad E14G3 (20Y7004ETX)
    • AMD Ryzen 7 5700U
    • 16GB RAM
    • 1TB SSD
    • 14" FHD

Preparation

Boot up Arch Linux ISO and do the following:

  • Disable the annoying beep sound: rmmod pcspkr
  • Bring up WiFi via iwctl station wlan0 connect <SSID>
  • Have some coffee ☕

Pre-installation

Update the system clock

timedatectl

Select the drive

export DRIVE=/dev/nvme0n1

(Use lsblk to determine the correct drive to install)

Zap the disk

sgdisk --zap-all $DRIVE
-Z, --zap-all
    Zap (destroy) the GPT and MBR data structures and then exit. This option works much like -z, but as it wipes the MBR as well as the GPT, it's more  suitable  if  you  want  to repartition a disk after using this option, and completely unsuitable if you've already repartitioned the disk.

Create the partitions

sgdisk --clear \
       --new=1:0:+512MiB --typecode=1:ef00 --change-name=1:EFI \
       --new=2:0:+16GiB   --typecode=2:8200 --change-name=2:swap \
       --new=3:0:0       --typecode=3:8300 --change-name=3:system $DRIVE

Partition types

Check the partitions

lsblk -o +PARTLABEL

Format EFI partition

mkfs.fat -F 32 -n EFI /dev/disk/by-partlabel/EFI

Format SWAP partition

mkswap /dev/disk/by-partlabel/swap

Format and mount SYSTEM partition

mkfs.ext4 -L system /dev/dis/by-partlabel/system
mount LABEL=system /mnt

Mount EFI partition

mount --mkdir LABEL=EFI /mnt/boot

Enable SWAP partition

swapon /dev/disk/by-partlabel/swap

Installation

Install essential packages

pacstrap -K /mnt base linux linux-firmware

Generate fstab

genfstab -L /mnt >> /mnt/etc/fstab
-L
  Use labels for source identifiers (shortcut for -t LABEL).

Boot into the system

arch-chroot /mnt

Configure the system

pacman -S vim
# Set the time zone
ln -sf /usr/share/zoneinfo/Europe/Istanbul /etc/localtime

# Set the Hardware Clock from the System Clock, and update the timestamps in /etc/adjtime.
hwclock --systohc

# Uncomment desired locales
vim /etc/locale.gen
# Generate the locales
locale-gen

# Create the locale.conf and set LANG variable
echo LANG=tr_TR.UTF-8 > /etc/locale.conf

# Create the hostname
vim /etc/hostname

# Set the root password
passwd

Regenerate initramfs

Create a backup of the original config:

cp /etc/mkinitcpio.conf /etc/mkinitcpio.conf.orig

Regenerate:

mkinitcpio -p linux

Select the CPU architecture

export CPU_ARCH=amd # amd or intel

Install microcode

Processor manufacturers release stability and security updates to the processor microcode. These updates provide bug fixes that can be critical to the stability of your system. Without them, you may experience spurious crashes or unexpected system halts that can be difficult to track down.

All users with an AMD or Intel CPU should install the microcode updates to ensure system stability.

pacman -S $CPU_ARCH-ucode

Install systemd-boot

Make sure the system has booted in UEFI mode and that UEFI variables are accessible:

ls /sys/firmware/efi/efivars

Use bootctl to install systemd-boot into the EFI system partition:

bootctl install
Created "/boot/EFI"
Created "/boot/EFI/systemd"
Created "/boot/EFI/BOOT"
Created "/boot/loader"
Created "/boot/loader/entries"
Created "/boot/EFI/Linux"
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi"
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/BOOT/BOOTX64.EFI"
Created "/boot/xxxxxx"
Random seed file /boot/loader/random-seed successfully written (512 bytes).
Created EFI boot entry "Linux Boot Manager".

Configure systemd-boot

/boot/loader/loader.conf:

default arch*.conf
timeout 5
editor no
console-mode auto

/boot/loader/entries/arch.conf:

title Arch Linux
linux /vmlinuz-linux
initrd /<CPU-ARCHITECTURE>-ucode.img
initrd /initramfs-linux.img
options root=<ROOT-PARTITION-UUID> rw audit=0 acpi_backlight=vendor splash
  • <ROOT-PARTITION-UUID>: lsblk -o NAME,UUID | grep nvme0n1p3 | awk '{print $NF}'
  • <SWAP-PARTITION-UUID>: lsblk -o NAME,UUID | grep nvme0n1p2 | awk '{print $NF}'
  • <CPU-ARCHITECTURE>: value of $CPU_ARCH

Update kernel parameters

  • audit=0: disable audit logs
  • acpi_backlight=vendor: prefer vendor specific driver for backlight (see the other options)
  • splash: show splash during boot

Install network manager

pacman -S netctl wpa_supplicant dhcpcd dialog
systemctl enable systemd-networkd.service
systemctl enable systemd-resolved.service
systemctl enable netctl.service
systemctl enable wpa_supplicant.service
systemctl enable dhcpcd.service

Post-installation

Set up a wireless netwok

wifi-menu
netctl list
netctl enable <profile>
netctl is-enabled <profile>

Create an user

useradd -G wheel -m emin
passwd emin
pacman -S sudo vi
visudo # uncomment "%wheel ALL=(ALL) ALL"

Install an AUR helper

pacman -S git wget rust base-devel
mkdir /home/emin/gh
cd /home/emin/gh/
git clone https://aur.archlinux.org/paru
cd paru/
makepkg -si

Install display server

pacman -S xorg-server xorg-xinit xterm

Also, install xf86-video-amdgpu or xf86-video-intel based on CPU architecture respectively.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment