Document is from mjnaderi
Warning: This document is only intended for myself as documentation of the steps I took when installing Arch Linux in BIOS/MBR mode with LVM on LUKS, without ethernet, using wifi only.
Please use the official guide when installing on your system,
Note: the boot partition is not encrypted with this approach.
/dev/sda
is the system disk, and /dev/sdb
is the USB.
Flash the USB drive:
# dd if=arch.iso of=/dev/sdb bs=4M status=progress oflag=sync
Set boot mode to "Legacy" in BIOS and boot from USB.
Used iwd to connect to wifi from live USB:
# iwctl
(iwd) device list
(iwd) station device scan
(iwd) station device get-networks
(iwd) station device connect SSID
ctrl+c to send EOF and exit
Update system clock
# timedatectl set-ntp true
Partitioning with fdisk
# fdisk /dev/sda
Create an empty MBR partition table (**WARNING:** This will erase entire disk)
(fdisk) o
Create 2 primary partitions (/dev/sda1 and /dev/sda2).
(fdisk) n
(fdisk) p
(fdisk) 1
(fdisk) <Enter>
(fdisk) +256M
(fdisk) t
(fdisk) 83
(fdisk) n
(fdisk) p
(fdisk) 2
(fdisk) <Enter>
(fdisk) <Enter>
(fdisk) t
(fdisk) 83
(fdisk) w (Write Changes)
Format boot partition:
mkfs.ext4 /dev/sda1
Setup encryption
# cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/sda2
# cryptsetup luksOpen /dev/sda2 luks
Create LVM partitions with one volume group
# pvcreate /dev/mapper/luks
# vgcreate vg0 /dev/mapper/luks
# lvcreate -L 8G vg0 -n swap
# lvcreate -L 80G vg0 -n root
# lvcreate -l +100%FREE vg0 -n home
Format LVM partitions
# mkfs.ext4 /dev/mapper/vg0-root
# mkfs.ext4 /dev/mapper/vg0-home
# mkswap /dev/mapper/vg0-swap
Mount the new system
# mount /dev/mapper/vg0-root /mnt
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot
# swapon /dev/mapper/vg0-swap
Install base system and some useful packages for a first run, especially for wifi
# pacstrap -i /mnt base base-devel linux linux-firmware openssh vim git iwd nano man-db man-pages lvm2 sudo dhcpcd
Generate /etc/fstab
.
# genfstab -pU /mnt >> /mnt/etc/fstab
Enter the new system
# arch-chroot /mnt /bin/bash
Set TimeZone
See available timezones:
# ls /usr/share/zoneinfo/
Set timezone:
# ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime
Set Locale and Keymap
# nano /etc/locale.gen (uncomment en_US.UTF-8 UTF-8 and sv_SE.UTF-8 UTF-8)
# locale-gen
# echo LANG=sv_SE.UTF-8 > /etc/locale.conf
# export LANG=sv_SE.UTF-8
# echo KEYMAP=sv-latin1 > /etc/vconsole.conf
Set the hardware clock mode
# hwclock --systohc --utc
Set hostname
# echo myhostname > /etc/hostname
Add it to /etc/hosts:
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
Create User
# useradd -m -g users -G wheel -s /bin/bash myusername
# passwd myusername
# EDITOR=nano visudo
uncomment %wheel ALL=(ALL) ALL
Configure mkinitcpio with modules needed for the initrd image
# vim /etc/mkinitcpio.conf
Add 'ext4' to MODULES
Add 'encrypt' and 'lvm2' to HOOKS before 'filesystems'
Add 'keymap' to HOOKS after 'keyboard'
Regenerate initrd image
# mkinitcpio -p linux
Setup grub
# pacman -S grub
# grub-install --target=i386-pc --recheck /dev/sda
In /etc/default/grub edit the line GRUB_CMDLINE_LINUX to:
GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda2:luks:allow-discards"
[Tip] To automatically search for other operating systems on your computer,
install os-prober (pacman -S os-prober) before running the next command.
# grub-mkconfig -o /boot/grub/grub.cfg
Exit new system and unmount all partitions
# exit
# umount -R /mnt
# swapoff -a
Reboot into the new system
# reboot
Start and enable iwd.service
and connect again with iwct
Create file `/etc/systemd/network/20-wired.network`:
[Match]
Name=en*
Name=eth*
[Network]
DHCP=yes
Create file `/etc/systemd/network/25-wireless.network`:
[Match]
Name=wlan0
[Network]
DHCP=yes
Restart `systemd-networkd` and `systemd-resolved`:
# systemctl restart systemd-networkd systemd-resolved
# ping archlinux.org
Restart `systemd-networkd` and `systemd-resolved` again if required
Install Xorg server
# pacman -S xorg-server
Install graphics driver (Arch wiki). My graphics driver was xf86-video-intel
# pacman -S xf86-video-intel
Install Gnome Display Manager and Gnome Desktop.
# pacman -S gnome gdm
# pacman -S gnome-extra
Enable GDM service
# systemctl enable gdm
Reboot!