Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save strongestFairy/7fdad442f135442aac34163bc673ed9c to your computer and use it in GitHub Desktop.

Select an option

Save strongestFairy/7fdad442f135442aac34163bc673ed9c to your computer and use it in GitHub Desktop.
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI for Lenovo 720S-13IKB
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Unblock wifi adapter
rfkill list
rfkill unblock all
rfkill list
# This assumes a wifi only system...
wifi-menu
ip a
ping ya.ru
# Create partitions with fdisk or any other tool
cgdisk /dev/nvme0n1
1 200MB EFI partition
2 400MB Boot partition
3 100GB Crypt partition
mkfs.vfat -F 32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2
lsblk -f
# Setup the encryption of the system
cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/nvme0n1p3
cryptsetup luksOpen /dev/nvme0n1p3 luks
# Create encrypted partitions
# This creates one partions for root, modify if /home or other partitions should be on separate partitions
pvcreate /dev/mapper/luks
vgcreate vg0 /dev/mapper/luks
lvcreate --size 8G vg0 --name swap
lvcreate --size 2G vg0 --name log
lvcreate -l +100%FREE vg0 --name root
# Create filesystems on encrypted partitions
mkfs.ext4 /dev/mapper/vg0-root
mkfs.ext4 /dev/mapper/vg0-log
mkswap /dev/mapper/vg0-swap
# Mount the new system
swapon /dev/mapper/vg0-swap # Not needed but a good thing to test
mount /dev/mapper/vg0-root /mnt # /mnt is the installed system
mkdir /mnt/boot
mount /dev/nvme0n1p2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi
mkdir /mnt/log
mount /dev/mapper/vg0-log /mnt/var/log
# Install the system also includes stuff needed for starting wifi when first booting into the newly installed system
pacstrap /mnt base base-devel linux grub-efi-x86_64 efibootmgr dialog wpa_supplicant \
linux-firmware mkinitcpio cryptsetup lvm2 netctl dhcpcd cronie vim git man
# 'install' fstab
genfstab -pU /mnt >> /mnt/etc/fstab
# Make /tmp a ramdisk (add the following line to /mnt/etc/fstab)
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
# Change relatime on all non-boot partitions to noatime (reduces wear if using an SSD)
# Enter the new system
arch-chroot /mnt /bin/bash
# Setup system clock
ln -s /usr/share/zoneinfo/Asia/Yekaterinburg /etc/localtime
hwclock --systohc --utc
# Set the hostname
echo MYHOSTNAME > /etc/hostname
# Update locale
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo LANGUAGE=en_US >> /etc/locale.conf
echo LC_ALL=C >> /etc/locale.conf
# Set password for root
passwd
# Add real user remove -s flag if you don't whish to use zsh
# useradd -m -g users -G wheel -s /bin/zsh MYUSERNAME
# passwd MYUSERNAME
# 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
# Regenerate initrd image
mkinitcpio -P
# Setup grub
grub-install
# In /etc/default/grub edit the line GRUB_CMDLINE_LINUX to
# GRUB_CMDLINE_LINUX="cryptdevice=/dev/nvme0n1p3:luks:allow-discards" then run:
grub-mkconfig -o /boot/grub/grub.cfg
# Setup wifi-connection
systemctl enable rfkill-unblock@all.service
# Exit new system and go into the cd shell
exit
# Unmount all partitions
umount -R /mnt
swapoff -a
# Reboot into the new system, don't forget to remove the cd/usb
reboot
# Setup network
wifi-menu
netctl enable <wlp1s0-name>
# Install xfce4
pacman -S xf86-video-intel xorg-server xfce4 xfce4-goodies pulseaudio pavucontrol
# Start GUI session
startxfce4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment