fmartingr.com/content/blog/_drafts/01/archlinux/install/from-zero-to-hero/index.md

4.8 KiB

+++ title = "Arch Linux on my Dell XPS" date = 2021-12-31 draft = true +++

Create install media

Install

  • Follow the wiki
# Connect to the internet, the moment we do relector will update the mirrorlist
iwctl station wlan0 connect <bssid>

# Set up date and time
timedatectl set-ntp true
timedatectl set-timezone Europe/Madrid

# Prepare the disk, the setup I used:
# Disk #0: 512MB, Boot partition, UEFI type
# Disk #1: 16384MB, SWAP, swap type
# Disk #2: Rest of the disk, btrfs type
# fdisk ...

# Prepare the filesystems and the luks encryption
mkfs.vfat -F32 /dev/nmve0n1p0
mkswap /dev/nmve0n1p1
cryptsetup luksFormat /dev/nvme0n1p2 # Password here
cryptsetup open /dev/nvme0n1p2 luks
mkfs.btrfs -L btrfs /dev/mapper/luks

# Prepare the btrfs partition
mkdir /mnt/luks
mount -t btrfs /dev/mapper/luks /mnt/luks
cd /mnt/luks
btrfs subvolume create root
btrfs subvolume create home
btrfs subvolume create snapshots

# Mount everything under /mnt
mkdir /mnt/{home,boot}
mount -o subvol=root,compress=lzo /dev/mapper/luks /mnt
mount -o subvol=home,compress=lzo /dev/mapper/luks /mnt/home
mount /dev/nvme0n1p0 /mnt/boot

# Run pacstrap with several base packages:
pacstrap /mnt \
base \
linux-lts linux-firmware \
intel-ucode \
terminus-font \ # Fonts in vconsole
man-db man-pages \ # Man pages
iwd sudo vim NetworkManager # Utilities

# Generate the /etc/fstab file
genfstab -L /mnt >> /mnt/etc/fstab

# Check everything is correct, replace realtime with noatime and discard flags to
# make flash drive last longer
vim /mnt/etc/fstab

# Enter into the system
arch-chroot /mnt

# Setup timedate
timedatectl set-timezone Europe/Madrid

# Sync the RTC from the system time (useful if dual booting)
hwclock --systohc

# Set the en_US.UTF-8 locale (uncomment)
vim /etc/locale.gen
locale-gen

# Setup default locale
echo 'LANG=en_US.UTF-8' > /etc/locale.conf

# Setup keymap and font
echo 'KEYMAP=us\nFONT=ter-232n' > /etc/vconsole.conf
pacman -S physlock # To allow locking the computer when in VConsole

# Setup the computer hostname
echo 'deru' > /etc/hostname

# Setup the hosts file
echo '127.0.0.1 localhost\n::1 localhost\n127.0.1.1 deru.localdomain deru' > /etc/hosts

# Set root password
passwd

# Setup init hooks to use systemd
vim /etc/mkinitcpio.conf
# Remove udev and add systemd, sd-vconsole and sd-encrypt

# Regenerate initrd
mkinitcpio -p linux-lts

# Setup systemd-boot
bootctl --path=/boot install

# Create the bootloader entry for Arch
LUKS_UUID=$(cryptsetup luksUUID /dev/nvme0n1p2)
cat >/boot/loader/entries/arch.conf <<EOL
title  Arch Linux (LTS)
linux  /vmlinuz-linux-lts
initrd /intel-ucode.img
initrd /initramfs-linux-lts.img
options rw luks.uuid=${LUKS_UUID} luks.name=${LUKS_UUID}=luks root=/dev/mapper/luks rootflags=subvol=root
EOL

# Setup bootloader
echo 'default arch.conf' > /boot/loader/loader.conf

# System ready!
exit
reboot

# Login as root

# Setup systemd-resolved
systemctl enable --now systemd-resolved
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

# Install and start netowrk manager
systemctl enable --now NetworkManager

# Connect to wifi if required
nmcli d wifi connntect <ssid> password <pass>

# Setup hibernate
# Get the swap disk UUID (double check manually)
sudo blkid | grep swap | sed -rn 's/^.* UUID=\"([a-z0-9\-]+)\".*$/\1/p'

# Add the resume boot parameter
vim /boot/loader/entries/arch.conf
# Under options:
# resume=UUID=<uuid>
# Systemd should check automatically for the swap partition on GPT tables [1]

# Setup suspend-then-hibernate
vim /etc/systemd/login.conf
# My enabled options:
# HandlePowerKey=suspend-then-hibernate
# HandleLidSwitch=suspend-then-hibernate
# HandleLidSwitchExternalPower=suspend-then-hibernate
# HandleLidSwitchDocked=ignore
# IdleAction=suspend-then-hibernate
# IdleActionSec=10min

vim /etc/systemd/sleep.conf
# Find HibernateDelaySec and set to 5min

# All these will be into effect in next boot
  • Boot in 1080p mode
  • Docked toggle
  • VConsole auto lock?
    • IDLE toggle in VConsole?
  • Hardware acceleration

Hardware acceleration

pacman -S vulkan-intel

Power

pacman -S tlp

# Edit tlp configuration link power to prevent corruption on btrfs devices
# /etc/tlp.conf
# ...
SATA_LINKPWR_ON_BAT=max_performance
# ...

Enable and start tlp

systemctl enable --now tlp

Audio

pacman -S alsa-utils pulseaudio pulseaudio-alsa pavucontrol systemctl start --user pulseaudio.socket

Bluetooth

pacman -S bluez bluez-utils
modprobe btusb
systemctl enable --now bluetooth
bluetoothctl -- power on

Brightness control

pacman -S brightnessctl

Fonts

pacman -S otf-ipafont # Japanese
pacman -S ttf-bitstream-vera # Default

Userspace

Enable multilib repos to install steam

useradd fmartingr
pacman -S sway dmenu xorg-xwayland alacritty qutebrowser
pacman -S mako # notifications
# TODO notification history?