Skip to content

Instantly share code, notes, and snippets.

@pkvk
Last active April 21, 2023 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkvk/64f2b24c38cde67e0118bf1b3f844f6c to your computer and use it in GitHub Desktop.
Save pkvk/64f2b24c38cde67e0118bf1b3f844f6c to your computer and use it in GitHub Desktop.
Install Arch Linux on XPS 13 9370
# Disable the Nvidia GPU on the XPS 15
# Install intel graphics driver
sudo pacman -S xf86-video-intel
# Blacklist nvidia/nouveau drivers
---
/etc/modprobe.d/nvidia.conf
---
blacklist nvidia
blacklist nouveau
---
# Install acpi_call:
pacaur -S acpi_call-dkms linux-headers
# Follow the docu to "power down discrete GPU":
# https://wiki.archlinux.org/index.php/hybrid_graphics
sudo modprobe acpi_call
sudo /usr/share/acpi_call/examples/turn_off_gpu.sh 2>/dev/null | grep works
# Installation on Dell XPS
# Please also consult official documentation:
# https://wiki.archlinux.org/index.php/Installation_Guide
# https://wiki.archlinux.org/index.php/Dell_XPS_13_(9360)
# https://wiki.archlinux.org/index.php/Dell_XPS_15_(9550)
# Enter BIOS with F2 and configure:
# - "System Configuration" > "SATA Operation": "AHCI"
# - "Secure Boot" > "Secure Boot Enable": "Disabled"
# Enter boot menu with F12, and boot the Arch USB medium
# Set desired keymap
loadkeys us
# Set large font
setfont latarcyrheb-sun32
# Connect to Internet
wifi-menu
# Sync clock
timedatectl set-ntp true
# Create three partitions:
cgdisk /dev/nvme0n1
# 1 1024MB EFI partition
# Block size 2147484
# Hex code ef00
# Label boot
# 2 16396MB Swap partition
# Block size 34359739
# Hex code 8200
# Label swap
# 3 100% Linux partition (to be encrypted)
# Hex code 8300
# Label root
# Formatting and encryption
mkfs.fat -F32 /dev/nvme0n1p1
cryptsetup luksFormat /dev/nvme0n1p3
cryptsetup open /dev/nvme0n1p3 luks
mkfs.btrfs -L luks /dev/mapper/luks
mkswap /dev/nvme0n1p2
# Create btrfs subvolumes
mount -t btrfs /dev/mapper/luks /mnt
btrfs subvolume create /mnt/@root
btrfs subvolume create /mnt/@var
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots
# Mount btrfs subvolumes
umount /mnt
mount -o subvol=@root /dev/mapper/luks /mnt
mkdir /mnt/{var,home,.snapshots}
mount -o subvol=@var /dev/mapper/luks /mnt/var
mount -o subvol=@home /dev/mapper/luks /mnt/home
mount -o subvol=@snapshots /dev/mapper/luks /mnt/.snapshots
# Mount EFI partition
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
# Change pacman mirror priority, move closer mirror to the top
vi /etc/pacman.d/mirrorlist
# Install the base system plus a few packages
pacstrap /mnt base sudo
# Generate fstab
genfstab -L /mnt >> /mnt/etc/fstab
# Verify and adjust /mnt/etc/fstab
# For all btrfs filesystems consider:
# - Change "relatime" to "noatime" to reduce wear on SSD
# - Adding "discard" to enable continuous TRIM for SSD
# - Adding "autodefrag" to enable online defragmentation
# Enter the new system
arch-chroot /mnt
# Setup time
rm /ect/localtime
ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
hwclock --systohc
# Generate required locales
vi /etc/locale.gen # Uncomment desired locales, e.g. "en_US.UTF-8", "de_CH.UTF-8"
locale-gen
# Set desired locale
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
# Set desired keymap and font
echo 'KEYMAP=us' > /etc/vconsole.conf
echo 'FONT=latarcyrheb-sun32' >> /etc/vconsole.conf
# Set the hostname
echo '<hostname>' > /etc/hostname
# Add to hosts
echo '127.0.0.1 localhost' >> /etc/hosts
echo '::1 localhost' >> /etc/hosts
echo '127.0.1.1 <hostname>.localdomain <hostname>' >> /etc/hosts
# Set password for root
passwd
# Add real user
useradd -m -g users -G wheel -s /bin/bash <username>
passwd <username>
echo '<username> ALL=(ALL) ALL' > /etc/sudoers.d/<username>
# Configure mkinitcpio with modules needed for the initrd image
vi /etc/mkinitcpio.conf
# Change: HOOKS="base systemd autodetect modconf block keyboard sd-vconsole sd-encrypt filesystems"
# Regenerate initrd image
mkinitcpio -p linux
# Setup systemd-boot
bootctl --path=/boot install
# Enable Intel microcode updates
pacman -S intel-ucode
# Create bootloader entry
# Get luks-uuid with: `cryptsetup luksUUID /dev/nvme0n1p2`
---
/boot/loader/entries/arch.conf
---
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options rw luks.uuid=<uuid> luks.name=<uuid>=luks root=/dev/mapper/luks rootflags=subvol=@root
---
# Set default bootloader entry
---
/boot/loader/loader.conf
---
default arch
---
# Exit and reboot
exit
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment