# Abstract
Fresh arch linux install guide with linux-lts kernel, systemd boot manager, fallback bootloader entry, fix for cpu vulnerability, lvm on luks, zram, ufw.
> I assume that you have previous experience installing linux of any kind.
# Prepare install medium
A USB with 8GB or more is recommended. However, anything larger than arch install image will do.
- Windows : Use `rufus` or `ventoy`
- Linux : `dd if=/path-to-iso of=/path-to-usb status=progress`
- Mac : `balena etcher` should do.
# Connect to wifi
Skip this part if using wired internet. Execute following commands line by line.
iwctl station list station <your network deive> scan station <your network device> get-networks station <your network device> connect <AP name>
exit
# Disk partition preview
If `mount point example` seems alien to you, don't proceed.
|Layout|Mount point example|alias in this document|size|
|---|---|---|---|
|Entry|/dev/sda or</br>/dev/nvme0n1|/dev/{entry}|Equal to physical disk size|
|Boot|/dev/sda1 (or)</br>/dev/nvme0n1p1|/dev/{boot}|1G (512M or 550M also possible)|
|LVM|/dev/sda2 (or)</br>/dev/nvme0n1p2|/dev/{lvm}|100% of remaining|
# Disk partitioning
cfdisk /dev/{entry}
Create boot partition
partition size : 1G # 512M or 550M if you prefer them. Wiki recommends 1GB.
Create lvm partition. This partition will be encrypted.
partition size : # press enter
Confirm disk layout. Write and quit.
# luks on lvm
Encrypt and mount the partition. `cryptlvm` is available at `/dev/mapper/cryptlvm`
cryptsetup --use-random luksFormat /dev/{lvm} cryptsetup open /dev/{lvm} cryptlvm
Create physical volume, `cryptlvm`.
pvcreate /dev/mapper/cryptlvm
Create volume group, `vg0`. We can now use `/dev/vg0`
vgcreate vg0 /dev/mapper/cryptlvm
Create logical volume.
lvcreate -L 128G vg0 -n root lvcreate -l 100%FREE vg0 -n home lvreduce -L -256M vg0/home
Format file system of each logical volumes.
mkfs.fat -F 32 /dev/{boot} mkfs.ext4 /dev/vg0/root mkfs.ext4 /dev/vg0/home
Mount partitions for pacstrap.
mount /dev/vg0/root /mnt mount --mkdir -o uid=0,gid=0,fmask=0077,dmask=0077 /dev/{boot} /mnt/boot mount --mkdir /dev/vg0/home /mnt/home
# Install essential package
- Double check for typos or missing package.
For intel processor
pacstrap -K /mnt base linux-lts linux-firmware vim sudo man lvm2 networkmanager intel-ucode
For amd processor
pacstrap -K /mnt base linux-lts linux-firmware vim sudo man lvm2 networkmanager amd-ucode
# Configure the system
Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
Chroot into new system.
arch-chroot /mnt
Set time.
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime hwclock --systohc
Generate locale.
vim /etc/locale.gen
en_US.UTF-8 UTF-8locale-gen
echo 'LANG=en_US.UTF-8' >> /etc/locale.conf
Change hostname.
echo "{my-hostname}" >> /etc/hostname
Enable networkmanager. Important for configuring wifi later.
systemctl enable NetworkManager
Generate initramfs with encryption and lvm enabled.
vim /etc/mkinitcpio.conf
encrypt and lvm2 before filesystemmkinitcpio -P
Set root password
passwd
# Setup systemd-boot manager
Install systemd-boot. It comes with `base` package.
bootctl install
Automatic update of bootloader. `pacman` only installs systemd-boot *installer*. So systemd-boot, by default, doesn't reinstall itself through pacman update.
systemctl enable systemd-boot-update.service
Configure bootloader. Edit `/boot/loader/loader.conf`. Don't use tab for indentation. Use spaces.
default arch.conf timeout 2 console-mode auto editor no
Create main bootloader entry. Edit `/boot/loader/entries/arch.conf`.
title Arch Linux linux /vmlinuz-linux-lts initrd /intel-ucode.img # amd-ucode.img for amd users initrd /initramfs-linux-lts.img options cryptdevice=/dev/{lvm}:cryptlvm root=/dev/vg0/root quiet rw
# Reboot to new system.
exit reboot
# Post install
## wifi
Wifi was disabled on my system after reboot. Use nmcli to connect to wifi, as we have `NetworkManager` installed.
nmcli device wifi connect {AP-name} password {your-password}
## Firewall
pacman -S ufw systemctl enable ufw.service ufw default deny ufw enable ufw status verbose # Run this command to s check the policy.
## Create a user with root privilege
Create a user
useradd -mG wheel {my-username} passwd {my-username}
Grant root privilege
visudo
%wheel ALL=(ALL) ALL
## zram
Disable zswap as it hinders zram functionality.
echo 0 > /sys/module/zswap/parameters/enabled
Install zram-generator
pacman -S zram-generator
Create and edit `zram-generator.conf`
vim /etc/systemd/zram-generator.conf
[zram0] zram-size = ram * 2 compression-algorithm = zstd swap-priority = 100 fs-type = swap
Reload daemon
systemctl daemon-reload
Start zram service
systemctl start [email protected]
Check zram status
zramctl
## Fallback boot loader entry
Create fallback bootloader entry. *NEVER* edit this again.
Edit mkinitcpio preset. Edit `/etc/mkinitcpio.d/linux-lts.preset`
#ALL_config="etc/mkinitcpio.conf" ALL_kver="/boot/vmlinuz-linux-lts"
PRESET=('default' 'fallback')
default_config="/etc/mkinitcpio.conf" default_image="/boot/initramfs-linux-lts.img"
fallback_config="/etc/mkinitcpio.conf" fallback_image="/boot/initramfs-linux-lts-fallback.img" fallback_options="-S autodetect"
Create fallback boot entry. Edit `/boot/loader/entries/arch-fallback.conf`.
title Arch Linux(Fallback) linux /vmlinuz-linux-lts initrd /intel-ucode.img # amd-ucode.img for amd users. initrd /initramfs-linux-lts-fallback.img options cryptdevice=/dev/{lvm}:cryptlvm root=/dev/vg0/root quiet rw
Rebuild boot images
mkinitcpio -P
# Happy Hacking.
# Reference
[Arch install guide](<https://wiki.archlinux.org/title/installation_guide#Partition_the_disks>)
[lvm on luks](<https://wiki.archlinux.org/title/dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS>)
[mount(8): mount filesystem - Linux man page (die.net)](<https://linux.die.net/man/8/mount>)
[Systemd bootloader](<https://wiki.archlinux.org/title/systemd-boot>)
[Zram](<https://wiki.archlinux.org/title/Zram>)
[Hyprland Wiki](<https://wiki.hyprland.org/>)