Skip to content

Instantly share code, notes, and snippets.

@mhamrah
Created September 22, 2019 02:20
Show Gist options
  • Save mhamrah/a56edd49dc34c3fe7abf3ebaf7850a65 to your computer and use it in GitHub Desktop.
Save mhamrah/a56edd49dc34c3fe7abf3ebaf7850a65 to your computer and use it in GitHub Desktop.
Minimal instructions for installing arch linux on a DELL XPS 13 9360 - UEFI, Toshiba 512GB NVMe SSD, with full system encryption using dm-crypt and luks
# Reference:
# https://wiki.archlinux.org/index.php/installation_guide
# https://github.com/variadico/xpslinux
# https://gist.github.com/njam/85ab2771b40ccc7ddcef878eb82a0fe9
# https://gist.github.com/brammitch/281e9a2f3aca57ae4a333fc63732f602
# https://wiki.archlinux.org/index.php/Dell_XPS_13_(9360)
# http://www.bhartiya.io/always-updated-arch-linux-tutorial/30411
# Set a bigger font size on the arch usb bootup shell
# Setfont sun12x22
setfont latarcyrheb-sun32
# Setup Wifi if a wired connection isn't available
wifi-menu
# Test connection
ping -c 3 www.google.com
# Prepare to install on NVME disk
lsblk
# Create partitions on the NVME disk
# Create two partions (EFI and Linux/data)
# 1. 512 MB EFI //Hex code ef00
# 2. 100% Linux/data partition //Hex code 8300 (to be encrypted)
cgdisk /dev/nvme0n1
# Create EFI partition
mkfs.vfat -F32 /dev/nvme0n1p1
# Setup the encryption of the system
cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 luks
# Create encrypted partitions - Encrypted Linux (Root + Home) & Swap 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
# /mnt is the installed system
mount /dev/mapper/vg0-root /mnt
# Test SWAP - Not needed but a good thing to test
swapon /dev/mapper/vg0-swap
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
# Install the base system
# edit mirror list file
# Now use the arrow key and select the mirror closest to you, I chose the US server. Then use Alt+6 to copy that URL and move the cursor on the very top of the list and paste it there (Ctrl+U). Then save and close the file (Ctrl+x).
nano /etc/pacman.d/mirrorlist
# 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. Dialog is needed by wifi-menu
pacstrap -i /mnt base base-devel zsh vim git sudo efibootmgr dialog iw wpa_supplicant
# 'install' fstab
genfstab -pU /mnt >> /mnt/etc/fstab
# Verify and adjust /mnt/etc/fstab
# Change relatime on all non-boot partitions to noatime (reduces wear if using an SSD)
# Enter the new system
arch-chroot /mnt /bin/bash
# Set up locale and clock
# Here you will see the list of languages. I have a trick that will save you a lot of scrolling: US English is listed on top of the list as an example, just uncomment it there: “en_US.UTF-8”
# Save (Ctrl+O) and close (Ctrl+X) the file and then run the following commands:
nano /etc/locale.gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
echo LC_ALL= >> /etc/locale.conf
locale-gen
# Set-up the time zone
tzselect
# create a symlink to set it as localtime
ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc --utc
# Set keyboard layout and font
# echo 'KEYMAP=de_CH-latin1' > /etc/vconsole.conf
echo 'FONT=latarcyrheb-sun32' >> /etc/vconsole.conf
# Set the hostname
echo '<hostname>' > /etc/hostname
# Add to 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/zsh <username>
passwd <username>
echo '<username> ALL=(ALL) ALL' > /etc/sudoers.d/<username>
EDITOR=nano visudo
# Configure mkinitcpio with modules needed for the initrd image
nano /etc/mkinitcpio.conf
# Add/updated as follows:
MODULES="i915 ext4 nvme intel_agp"
BINARIES=""
FILES="/etc/modprobe.d/modprobe.conf"
HOOKS="systemd autodetect modconf block keymap sd-encrypt sd-lvm2 filesystems keyboard"
# Regenerate initrd image
mkinitcpio -p linux
# Setup systembootd (grub will not work on nvme at this moment)
bootctl --path=/boot install
# Enable Intel microcode updates
pacman -S intel-ucode
# Create bootloader entry
# Get luks-uuid with: `cryptsetup luksUUID /dev/nvme0n1p2`
# OR Use the command below to find the <UUID> the raw encrypted device (/dev/nvme0n1p2)
# blkid -s PARTUUID -o value /dev/nvme0n1p2
cryptsetup luksUUID /dev/nvme0n1p2
# Add the following content to arch.conf
# replace <UUID> with the raw numbers of the drive
# Set the nvme_core parameter for a Toshiba 512 GB SSD - allows it to enable all PS States (powersaving)
nano /boot/loader/entries/arch.conf
# Add the following lines:
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options luks.uuid=<UUID> luks.name=<UUID>=luks root=/dev/mapper/vg0-root resume=/dev/mapper/vg0-swap rw nvme_core.default_ps_max_latency_us=170000
# Create loader.conf
nano /boot/loader/loader.conf
# And make sure only these lines are there:
default arch
timeout 0
editor 0
# Intel GPU and powersaving options needed for tear free operation, and battery life
# CREATE a i915 modprobe file (Intel graphics powersaving options)
nano /etc/modprobe.d/i915.conf
# add the following line:
options i915 enable_rc6=1 enable_fbc=1 semaphores=1 modeset=1 enable_guc_loading=1 enable_guc_submission=1 enable_huc=1 disable_power_well=0 enable_psr=1
nano /etc/X11/xorg.conf.d/20-intel.conf
# Add the following lines:
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod"
EndSection
# Update bootloader
bootctl update
# INSTALL DESKTOP ENVIRONMENT AND OTHER TOOLS
pacman -S gnome gdm
# To be able to manage the network from the GUI (we have been using command line tools so far), we need to install some packages that are not part of GNOME:
pacman -S network-manager-applet networkmanager
# We will also install support for the touchpad:
pacman -S xf86-input-libinput
# Install intel graphics driver
pacman -S xf86-video-intel mesa-libgl vulkan-intel libva-intel-driver
# Now tell systemd to start GNOME Display Manager and networking at the boot time:
systemctl enable NetworkManager.service
systemctl enable gdm.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
# Check if NVME (Toshiba) SSD has powersaving mode enabled
sudo nvme get-feature -f 0x0c -H /dev/nvme0
# Ensure Intel Video drivers are used, and relevant kernel parameters are applied
sudo lspci -s 00:02 -vk
nano /etc/modprobe.d/i915.conf
# Add the following line to the i915.conf file
options i915 modeset=1 enable_rc6=1 enable_fbc=1
# run the following command to ensure that the Intel i915 video driver is in use
sudo lspci -s 00:02 -vk
# -----------------------------------------------
# POST INSTALL/BOOT SETUP of minimum applications
# -----------------------------------------------
sudo pacman -Syu terminator gnome-tweak-tool systemd-swap util-linux dosfstools lshw
# Set up libraries needed for enabling printing
sudo pacman -Syu cups cups-pdf gtk3-print-backends
# Install dmidecode if needed: dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS)
# table contents in a human-readable format.
sudo pacman -Syu dmidecode
# Install Bluetooth packages
sudo pacman -Syu bluez bluez-utils bluez-libs bluez-firmware
# Load the generic bluetooth driver
sudo modprobe btusb
sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service
# autopower on bluetooth post reboot
sudo nano /etc/bluetooth/main.conf
# SET AutoEnable=True under the [Policy] Section
# Set up printing service / CUPS
sudo pacman -Syu cups gtk3-print-backends cups-pdf
sudo systemctl start org.cups.cupsd.service
sudo systemctl enable org.cups.cupsd.service
# enable SWAP Services
sudo systemctl enable systemd-swap.service
# enable SSD TRIM
sudo systemctl enable fstrim.timer
# ------------------------------------------------
# PREPARE TO INSTALL PACAUR - to get access to AUR
# ------------------------------------------------
sudo pacman -Syu
# Install pacaur
su - <username>
mkdir aur
cd aur
git clone https://aur.archlinux.org/cower.git
cd cower
makepkg -si --skipinteg
cd ..
git clone https://aur.archlinux.org/pacaur.git
cd pacaur
makepkg -si
# Alternative instructions to install Pacaur
# Create a tmp-working-dir and navigate into it
# mkdir -p /tmp/pacaur_install
# cd /tmp/pacaur_install
# # Install pacaur dependencies from arch repos
# sudo pacman -S expac yajl git --noconfirm --needed
# # Install "cower" from AUR
# curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower
# makepkg PKGBUILD --skippgpcheck --install --needed
# # Install "pacaur" from AUR
# curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur
# makepkg PKGBUILD --install --needed
# # Clean up...
# cd ~
# sudo rm -r /tmp/pacaur_install
# ------------------------------------------------------------
# Install other tools from AUR (Remove any that aren't needed)
# ------------------------------------------------------------
# Install key applications I use, including a GUI for AUR packages called Pamac
pacaur -Syu pamac-aur
corebird
rambox-bin
etcher
shutter
neofetch
steam
visual-studio-code
vlc qt4
google-chrome
firefox
skypeforlinux-bin
flatpak
nextcloud-client
spotify
ufw
ffmpeg
pulseaudio-alsa
pulseaudio-bluetooth
alsa-utils
# Install for AUR Gestures
pacaur -Syu xdotool wmctrl
# Install themes and fonts
pacaur -Syu ttf-google-fonts-git
ttf-ms-fonts
adobe-source-code-pro-fonts
adobe-source-han-sans-cn-fonts
adobe-source-han-sans-jp-fonts
adobe-source-han-sans-kr-fonts
adobe-source-han-sans-otc-fonts
adobe-source-han-sans-tw-fonts
adobe-source-sans-pro-fonts
noto-fonts-emoji
otf-ipafont
ttf-dejavu
ttf-hanazono
ttf-inconsolata
ttf-liberation
ttf-roboto
ttf-ubuntu-font-family
numix-gtk-theme-git
numix-icons-theme-pack
numix-cursor-theme-git
# Install other applications available in the official Arch repositories
sudo pacman -Syu gnome-clocks
gnome-software
gnome-boxes
gnome-calendar
gnome-maps
gnome-bluetooth
gnome-user-share
evolution
file-roller
gnome-characters
gnome-color-manager
gnome-documents
gnome-logs
gnome-music
gnome-photos
gnome-todo
seahorse
# Hide icons for services that clutter the Gnome menu
# https://bbs.archlinux.org/viewtopic.php?id=190279
# Create a script called "hide-icon.sh"
# -------------- SCRIPT CODE BELOW -------------
#!/bin/sh
APPLICATION_PATH="/usr/share/applications"
USER_APPLICATION_PATH="${HOME}/.local/share/applications"
for FILE in `cat $1`; do
if [ -e "${APPLICATION_PATH}/${FILE}" ]; then
echo "Creating file ${USER_APPLICATION_PATH}/${FILE}"
echo "NoDisplay=true" > "${USER_APPLICATION_PATH}/${FILE}"
elif [ ! -e "${APPLICATION_PATH}/${FILE}" ] && [ -e "${USER_APPLICATION_PATH}/${FILE}" ]; then
echo "Deleting unnecessary file ${USER_APPLICATION_PATH}/${FILE}"
rm "${USER_APPLICATION_PATH}/${FILE}"
fi
done
# ----------------------
# Create a file with the list of icons to hide: list_of_desktop_file_names.txt
assistant-qt4.desktop
avahi-discover.desktop
bssh.desktop
bvnc.desktop
CMake.desktop
designer-qt4.desktop
ipython-qtconsole.desktop
jconsole.desktop
linguist-qt4.desktop
policytool.desktop
qdbusviewer-qt4.desktop
qtconfig-qt4.desktop
qv4l2.desktop
gda-control-center-5.0.desktop
gda-browser-5.0.desktop
nvidia-settings.desktop
hplip.desktop
ipython.desktop
zenmap.desktop
zenmap-root.desktop
designer.desktop
qdbusviewer.desktop
assistant.desktop
linguist.desktop
# ---------------
# run the following command:
chmod +x hide-icon.sh
./hide-icon.sh list_of_desktop_file_names.txt
# -----------------
# Best cursor theme - BREEZE (KDE)
# -----------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment