Skip to content

Instantly share code, notes, and snippets.

@stonewalljones
Last active September 18, 2020 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stonewalljones/ef6d1dd4e33b7bc39be66f2925991de9 to your computer and use it in GitHub Desktop.
Save stonewalljones/ef6d1dd4e33b7bc39be66f2925991de9 to your computer and use it in GitHub Desktop.
UEFI Arch Linux
# Boot from the usb.
# Use cfdisk to create 1 boot part fat32 1GB and 1 linux partition on the freed space.
cfdisk /dev/nvme0n1
# format the first (EFI) partition using the (required) FAT32 filesystem.
mkfs.fat -F32 -n EFI /dev/disk/by-partlabel/EFI
# Create luks container. My linux partition is /dev/nvme0n1p4
cryptsetup luksFormat --align-payload=8192 -s 256 -c aes-xts-plain64 /dev/nvme0n1p4
# Open container
cryptsetup open /dev/nvme0n1p4 crypt-thunderfather
# LVM
pvcreate /dev/mapper/crypt-thunderfather
vgcreate thunderfather /dev/mapper/crypt-thunderfather
lvcreate -L 32G -n swap thunderfather
lvcreate -l 100%FREE -n btrfs thunderfather
mkswap /dev/thunderfather/swap
# Create and mount btrfs filesystem
mkfs.btrfs --force --label thunderfather-arch /dev/thunderfather/btrfs
o=defaults,x-mount.mkdir
o_btrfs=$o,compress=lzo,ssd,noatime
mount -t btrfs LABEL=archlinux /mnt
# Create btrfs subvolumes
btrfs subvolume create /mnt/@root
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots
# Umount everything
umount -R /mnt
# Remount only the subvolumes
mount -t btrfs -o subvol=root,$o_btrfs LABEL=thunderfather-arch /mnt
mount -t btrfs -o subvol=home,$o_btrfs LABEL=thunderfather-arch /mnt/home
mount -t btrfs -o subvol=snapshots,$o_btrfs LABEL=thunderfather-arch /mnt/.snapshots
swapon /dev/thunderfather/swap
# Mount EFI partition - in my case: /dev/nvme0n1p1
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
# Install base system
pacstrap /mnt base base-devel btrfs-progs snapper zsh htop \
vim grub grml-zsh-config
# Generate fstab
genfstab -L -p /mnt >> /mnt/etc/fstab
# Enter the new system
arch-chroot /mnt /bin/zsh
# Setup system clock
timedatectl set-ntp 1
timedatectl list-timezones
timedatectl set-timezone America/Detroit
# Generate and set default locale
localectl set-locale LANG=en_US.UTF-8
# Hostname
hostnamectl set-hostname thunderfather.stonewall.pw
# Install other needed packages
pacman -Syu gptfdisk dosfstools efibootmgr os-prober mesa xf86-video-amdgpu vulkan-radeon libva-mesa-driver mesa-vdpau
# Create mkinitcpio.conf
mv /etc/mkinitcpio.conf /etc/mkinitcpio.conf.orig
vim /etc/mkinitcpio.conf
...
MODULES="amdgpu"
BINARIES="/usr/sbin/btrfs"
FILES=""
HOOKS="base systemd sd-vconsole modconf keyboard block filesystems btrfs sd-encrypt sd-lvm2 fsck"
...
# Regenerate initrd image
mkinitcpio -p linux
# Install GRUB2
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ArchLinux --recheck
# Setup grub
# Edit /etc/default/grub,
...
GRUB_ENABLE_CRYPTODISK=y
#TODO
GRUB_CMDLINE_LINUX="rd.lucks.name=xxxxxxxxxxx=crypt-thunderfather rd.luks.options=discards root=/dev/mapper/thunderfather-btrfs rootflags=subvol=@root"
...
# Generate config file
grub-mkconfig -o /boot/grub/grub.cfg
# Exit new system and go into the cd shell
exit
# Unmount all partitions
umount -R /mnt
# Reboot into the new system, don't forget to remove the usb
reboot
# run:
mkinitcpio -p linux
# Reboot again, you’ll only need to enter your password once.
reboot
# Install the rest and configure the system
pacman -Syu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment