Skip to content

Instantly share code, notes, and snippets.

@njam
Last active July 13, 2023 06:54
Show Gist options
  • Star 60 You must be signed in to star a gist
  • Fork 20 You must be signed in to fork a gist
  • Save njam/85ab2771b40ccc7ddcef878eb82a0fe9 to your computer and use it in GitHub Desktop.
Save njam/85ab2771b40ccc7ddcef878eb82a0fe9 to your computer and use it in GitHub Desktop.
Install Arch Linux on XPS 13 9360
# 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 de_CH-latin1
# Set large font
setfont latarcyrheb-sun32
# Connect to Internet
wifi-menu
# Sync clock
timedatectl set-ntp true
# Create two partitions:
# 1 1000MB EFI partition # Hex code ef00
# 2 100% Linux partiton (to be encrypted) # Hex code 8300
cgdisk /dev/nvme0n1
# Formatting and encyption
mkfs.fat -F32 /dev/nvme0n1p1
cryptsetup luksFormat --type=luks2 /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 luks
mkfs.btrfs -L luks /dev/mapper/luks
# 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
vim /etc/pacman.d/mirrorlist
# Install the base system plus a few packages
pacstrap /mnt base linux linux-firmware btrfs-progs zsh vim git sudo efibootmgr wpa_supplicant dialog iw
# 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 "autodefrag" to enable online defragmentation
# Enter the new system
arch-chroot /mnt
# Setup time
rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
hwclock --systohc
# Generate required locales
vim /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 hostname to /etc/hosts:
---
/etc/hosts
---
127.0.0.1 localhost
::1 localhost
127.0.1.1 <hostname>.localdomain <hostname>
---
# Set password for root
passwd
# Add real user
useradd -m -g users -G wheel -s /bin/zsh <username>
passwd <username>
echo '<username> ALL=(ALL) ALL' > /etc/sudoers.d/<username>
# Configure mkinitcpio with modules needed for the initrd image
vim /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
# 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
@a2nt
Copy link

a2nt commented Feb 28, 2020

What do you mean as minimalistic? @a2nt

Following the official guide, you will arrive to the minimal arch installation that doesn't even have packages to connect via wi-fi

Here: https://wiki.archlinux.org/index.php/Installation_guide

I have meant configuration with useless at Dell XPS 9360 kernel modules disabled like:
Compiled into kernel: ext4 fs, wifi, power management and etc
Loaded as a module on demand: different kinds of USB devices, memory sticks and etc.
Excluded: CPU and memory hot-plug, AMD drivers, other platform drivers and etc.

Made a configuration on my own including desktop fork patch - hope it will be useful for some other person.

Patch reference:
https://gitlab.com/post-factum/pf-kernel/-/wikis/README

Kernel configuration file with short instruction: https://gist.github.com/a2nt/8cd3a02cb33cd9901e06aad3eba256ec
P.S. I have included memory stick drivers into kernel and USB Realtek 8152 cuz I use memory stick card as second drive to store rarely used user files and Realtek 8152 LAN card that I use at the USB-C dock station.

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