Skip to content

Instantly share code, notes, and snippets.

@marc-fez
Forked from mattiaslundberg/arch-linux-install
Last active January 7, 2023 22:56
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save marc-fez/ca7ad54af72d353f595d08b4304fe0df to your computer and use it in GitHub Desktop.
Save marc-fez/ca7ad54af72d353f595d08b4304fe0df to your computer and use it in GitHub Desktop.
Instructions for installing arch linux on a Dell XPS 15 with full system encryption using dm-crypt and luks
# Having problems with the nvidia drivers
# Arch wiki page on XPS 15
# https://wiki.archlinux.org/index.php/Dell_XPS_15_9560
# Install ARCH Linux with encrypted file-system and UEFI on Dell XPS 15
# 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.
# Set UK keymap
loadkeys uk
# This assumes a wifi only system...
wifi-menu
# Find the main HD
fdisk -l
# Create partitions
cgdisk /dev/nvme0n1
1 250MB EFI partition # Hex code ef00
2 500MB Boot partition # Hex code 8300
3 100% size partiton # (to be encrypted) Hex code 8300
# Format disks
mkfs.vfat -F32 /dev/nvme0n1p1
mkfs.ext2 /dev/nvme0n1p2
# 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 16G vg0 --name swap
lvcreate -l +100%FREE vg0 --name root
# Create filesystems on encrypted partitions
mkfs.ext4 /dev/mapper/vg0-root
mkswap /dev/mapper/vg0-swap
# Mount the new system
mount /dev/mapper/vg0-root /mnt # /mnt is the installed system
swapon /dev/mapper/vg0-swap # Not needed but a good thing to test
mkdir /mnt/boot
mount /dev/nvme0n1p2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi
# Install the system also includes stuff needed for starting wifi when first booting into the newly installed system
# Unless vim and zsh are desired these can be removed from the command
pacstrap /mnt base base-devel grub-efi-x86_64 zsh vim git efibootmgr dialog wpa_supplicant
# '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/Europe/Amsterdam /etc/localtime
hwclock --systohc --utc
# Set the hostname
echo MYHOSTNAME > /etc/hostname
# Update locale
echo LANG=en_GB.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 linux
# Setup grub
grub-install
# In /etc/default/grub edit the line GRUB_CMDLINE_LINUX to
GRUB_CMDLINE_LINUX="cryptdevice=/dev/nvme0n1p3:luks:allow-discards"
# Tried a bunch of different acpi parameters, acpi_osi=Linux, acpi_osi=! acpi_osi="Windows 2009", acpi_osi="!Windows 2015"
# Finally settled on acpi acpi_rev_override=5 but to be perfectly honest, no idea what it's actually doing.
# edit the line GRUB_CMDLINE_LINUX_DEFAULT and add
acpi_rev_override=5
# then run:
grub-mkconfig -o /boot/grub/grub.cfg
# 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
# Log in
# Escalate to root
su
# locale settings didn't stick? reset the keyboard
loadkeys uk
# Add user to sudoers file
visudo
# Uncommment line %wheel ALL=(ALL) ALL
# return to regular user
exit
# connect to wifi
sudo wifi-menu
# Update
sudo pacman -Fy
sudo pacman -Syu
# if the kernel updates, reboot
sudo reboot
# Install linux headers to install from AUR
sudo pacman -S linux-headers
# Download and build aurman for AUR installations run this section as normal user (NOT sudo)
git clone https://aur.archlinux.org/aurman.git
cd aurman
makepkg -Acs
# Install aurman (version may be different)
sudo pacman -U aurman-2.9.22-1-any.pkg.tar.xz
# Install xorg
sudo pacman -S xorg xorg-server xorg-xrandr
# Install nvidia driver
# May be prompted to select the Repository extra, only one that worked for me was libglvnd
sudo pacman -S nvidia
# I'm going with the budgie desktop, install whatever you want here
sudo pacman -S budgie-desktop
# aurman to install budgie-extras
aurman -S budgie-extras
# install lightdm
sudo pacman -S lightdm lightdm-gtk-greeter
# enable lightdm service
sudo systemctl enable lightdm.service
# start lightdm service
sudo systemctl start lightdm.service
# install tilix, nautilus, gnome-control-center and python-nautilus
sudo pacman -S nautilus python-nautilus tilix gnome-control-center
# install bumblebee and enable the service
# https://wiki.archlinux.org/index.php/Bumblebee#Installation
# adding xf86-video-intel to hopefully enable external hdmi monitor
sudo pacman -S bumblebee mesa xf86-video-intel
# add user to bumblebee group
sudo gpasswd -a <user name> bumblebee
# enable bumblebee service
sudo systemctl enable bumblebeed.service
@falkben
Copy link

falkben commented Dec 23, 2018

Thank you so much for posting this. While I didn't really follow this as a guide, it was immensely helpful when I got stuck, specifically the acpi_rev_override=5 trick to actually getting it to boot.

@ecomaikgolf
Copy link

This guide leads me to a grub loop where It shows "GRUB Loading" during boot and instantly it restarts

@ecomaikgolf
Copy link

This guide leads me to a grub loop where It shows "GRUB Loading" during boot and instantly it restarts

If anyone can't install/load the grub (line 99):

Exit chroot enviroment, open cfdisk and change nvme0n1p2 to "BIOS Boot" then unmount /mnt and re-mount it. Now you can grub-install

Using 500MB Boot partition # Hex code 8300 didn't make it show as "BIOS Boot"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment