Skip to content

Instantly share code, notes, and snippets.

@Luv2C0d3
Last active November 3, 2019 09:40
Show Gist options
  • Save Luv2C0d3/f076e4130666a88e2a5afd8c54a040ac to your computer and use it in GitHub Desktop.
Save Luv2C0d3/f076e4130666a88e2a5afd8c54a040ac to your computer and use it in GitHub Desktop.
EFI Dual boot Windows + Arch Linux on Dell XPS 13 9370
# References:
# Install Arch Linux on XPS 13 9370: https://gist.github.com/android10/3b36eb4bbb7e990a414ec4126e7f6b3f
# Install Arch Linux + EFI + Gnome in VMWare player VM: https://gist.github.com/Coffee-fan/05a2f33509998993336ccbbba0d92ce6
# How to install Google Chrome on Arch Linux: https://linuxhint.com/install-google-chrome-on-arch-linux/
# Enter BIOS with F2 and configure:
# - "System Configuration" > "SATA Operation": "AHCI"
# - "Secure Boot" > "Secure Boot Enable": "Disabled"
# - Make sure you disable legacy boot, otherwise EFI vars will not be present below.
#
# 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
# Note: Windows or other partitions omitted. Adjust as needed.
# 1 1024MB EFI partition
# Block size 2147484
# Hex code ef00
# Label boot
# 5 16396MB Swap partition
# Block size 34359739
# Hex code 8200
# Label swap
# 6 100% Linux partition (to be encrypted)
# Hex code 8300
# Label root
# DO NOT format EFI partition.
#
# Format swap and mount
#
mkswap /dev/nvme0n1p5
swapon /dev/nvme0n1p5
#
# Main btrfs partition
#
mkfs.btrfs /dev/nvme0n1p6
# Create btrfs subvolumes
mount -t btrfs /dev/nvme0n1p6 /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/nvme0n1p6 /mnt
mkdir /mnt/{var,home,.snapshots}
mount -o subvol=@var /dev/nvme0n1p6 /mnt/var
mount -o subvol=@home /dev/nvme0n1p6 /mnt/home
mount -o subvol=@snapshots /dev/nvme0n1p6 /mnt/.snapshots
# Mount EFI partition
mkdir -p /mnt/boot/EFI
mount /dev/nvme0n1p1 /mnt/boot/EFI
# Change pacman mirror priority, move closer mirror to the top
vi /etc/pacman.d/mirrorlist
# Install the base system plus packages.
pacstrap /mnt base base-devel sudo linux
# Generate fstab
genfstab -L /mnt >> /mnt/etc/fstab
# Enter the new system via chroot
arch-chroot /mnt
# setup time
rm -f /etc/localtime
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
echo 'KEYMAP=dvorak' > /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
passwd
pacman -Syu
ln -s /usr/share/zoneinfo/America/Vancouver /etc/localtime
hwclock --systohc --utc
pacman -S vim
vim /etc/locale.gen
locale-gen
pacman -S grub efibootmgr dosfstools os-prober mtools
grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=GRUB --recheck
grub-mkconfig -o /boot/grub/grub.cfg
useradd -m -g users -G wheel -s /bin/bash user1
passwd user1
echo 'user1 ALL=(ALL) ALL' > /etc/sudoers.d/user1
#
# Note: I had to manually copy the atheros firmware from the Arch ISO into
# the hard disk. Need to do this from the ISO disk
# cp -r /usr/lib/firmware/ath10k /mnt/usr/lib/firmware.
#
# This driver howevevr is in package linux-firmware
#
#
# Install wpa_supplicant, which will be needed later on to either manually
# connect to wifi or via NetworkManager service, which in turn uses wpa_supplicant
#
pacman -S wpa_supplicant
wpa_passphrase your-ssid your-pass >> /etc/wpa_supplicant/wpa_supplicant.conf
pacman -S dhclient
#
# Manually connect to the network. As long as you do not setup systemd.NetworkManager
# you'll need to manually issue the two commands below.
#
#wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
#dhclient
pacman -S networkmanager
#
# Configure a wifi connection
nmtui
#
# Set the interface such that it auto boots from systemd
# Replace wlp2s0 by the wifi device you get from 'ip l' or 'iw l'
# See: http://www.linuxfromscratch.org/lfs/view/8.0-systemd/chapter07/network.html
# https://wiki.archlinux.org/index.php/NetworkManager
#
cat > /etc/systemd/network/10-wlp2s0-dhcp.network <<eof
[Match]
Name=wlp2s0
[Network]
DHCP=ipv4
eof
#
# Need to reboot at this point as systemctl needs
# systemd running which does not happen in chrooted
# environment
#
reboot
systemctl enable --now NetworkManager
#
# Let's add ssh
#
pacman -S openssh
systemctl enable sshd
pacman -S gnome
systemctl enable gdm.service
#
# Firefox
#
pacman -S firefox
#
# Requirements for AUR packages
#
pacman -S --needed base-devel
pacman -S git
#
# Google chrome is in the AUR repository.
#
git clone https://aur.archlinux.org/google-chrome.git
cd google-chrome/
makepkg -si
pacman -U google-chrome-78.0.3904.70-1-x86_64.pkg.tar.xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment