i recently got a system76 gazelle laptop preinstalled with ubuntu. i wanted to use arch, which i’ve used and enjoyed before. here is documentation of every step i took and command i ran to get it into a working state. this is both to help other people and to document my own process in case i ever need to do some or all of it again.

some of these steps are very specific to me, especially toward the end. i’ve tried to keep each task modular.

i’m intentionally documenting every warning-like log line and strange message i encountered. so that if you’re reading this you can know that it’s normal and things will turn out fine (probably).

0 general thoughts

first, i want to say that after about 2 months of use i’m incredibly happy with this laptop. everything has been in line with what i read in reviews. the quality is quite high overall, although the built-in speakers are not great as other reviewers noted. battery life is a bit on the low side, but i don’t travel much with it so that doesn’t present a problem for me. considering my previous laptop was a 2015 macbook pro with 256 GB storage, this feels like a huge upgrade!

1 download iso

first, download an iso of arch linux and write it to an external hard drive at /dev/sdc. double check that that’s the right location with a command like lsblk (compare the output before and after you plug in your HD).

dd if=~/Downloads/arch-linux.2020.01.01.iso of=/dev/sdc

2 boot from iso

next, reboot the computer while holding F2, the BIOS key. go to “Boot Manager”, press enter, select “EFI USB Device”, and press enter. quickly, press the down key to stop autoloading. put the cursor over “Arch Linux archiso x86_64 UEFI CD” and press ‘e’ to edit the kernel boot command line. add nouveau.modeset=0 to the parameters and press enter. if you don’t do this, booting will fail with endless messages that look like

nouveau 0000:01:00.0: fifo: SCHED_ERROR 08 []

if that happens, just do a hard reset.

i found this answer here.

3 setup wireless network

one the live install boots, get a wireless network up. since i have an AT&T WPA-secured WiFi network, i did this:

# get interface name: ip link
ip link set wlan0 up
# my output:
#   iwlwifi 0000:00:14.3: BIOS contains WGDS but no WRDS
# confirm: ip link (should be "UP")
wpa_passphrase ATTSB73hfi >>/etc/wpa_supplicant.conf # now type your WiFi passkey and press enter
wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf
# my output:
#   Successfully initialized wpa_supplicant
#   ioctl[SIOCSIWENCODEEXT]: Invalid argument
#   ioctl[SIOCSIWENCODEEXT]: Invalid argument
# confirm: iw wlan0 link
dhclient wlan0
# confirm: ip addr show wlan0
# confirm: ping example.org

i found this answer here.

the following messages also seem to be logged unprovoked after about 200 seconds:

ucsi_ccg 7-0008: failed to reset PPM!
usci_ccg 7-0008: PPM init failed (-110)

4 partitioning

next i formatted my disk. i have 2 SSD hard drives and only put my linux install on the first one, /dev/sda. i think if you want to boot from an NVMe drive you may need to do something special based on this article, since i don’t have one i didn’t research this though, sorry.

fdisk -l # to list devices and partitions
fdisk /dev/sda

i wanted the following:

  • EFI system partition (ESP) for booting (i am using GRUB)
  • Swap partition
  • Root partition (I am the only user here)

the commands to do that were (i am writing for a carriage return here):

g<CR> # create new GPT
n<CR><CR><CR>+512M<CR> # create new partition at start of disk for EFI
Y<CR> # confirm that i want to overwrite existing signature (i had already tried some of this before)
n<CR><CR><CR>+1G<CR> # create new partition for swap
Y<CR> # confirm remove signature
n<CR><CR><CR><CR> # create root partition to end of disk
t<CR>1<CR>1<CR> # make 1st partition EFI System
t<CR>2<CR>19<CR> # make 2nd partition swap
t<CR>3<CR>24<CR> # make 3rd partition linux root
p # confirm
# my output:
#   Device        Start       End   Sectors   Size Type
#   /dev/sda1      2048   1050623   1048576   512M EFI System
#   /dev/sda2   1050624   3147775   2097152     1G Linux swap
#   /dev/sda3   3147776 976773134 973625359 464.3G Linux root (x86-64)
w # write

5 filesystems

then configured filesystems and mounted them:

mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2
swapon
mkfs.ext4 /dev/sda3
mount /dev/sda3 /mnt
mkdir -p /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
# confirm: df -h

the EFI partition needs to be mounted at /boot/efi according to this article.

6 install kernel

vim /etc/pacman.d/mirrorlist
# edit to put mirrors of your choice at the top
pacstrap /mnt base linux linux-firmware
# wait for a long time for everything to install
genfstab -U /mnt >>/mnt/etc/fstab
# confirm: cat /mnt/etc/fstab
arch-chroot /mnt

7 install GRUB and configure boot loader

pacman -Syuu grub efibootmgr vim
vim /etc/default/grub
# set: GRUB_TIMEOUT=0
# set: GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet nowatchdog ec_sys.write_support=1 resume=/dev/sda2 acpi_os_name=Linux acpi_osi="
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

i got those linux cmd line args from this article.

the “acpi_os_name=Linux acpi_osi=” part i got from a post on the arch linux forum.

8 install networking packages

so similar network setup works without live install

pacman -S wpa_supplicant dhclient

9 reboot

you may want to restart your machine now so that you can confirm everything is ok up to this point.

exit
umount -R /mnt
reboot # immediately remove installation media after the screen goes dark

the machine should boot up fine and take you to an ‘archlinux login:’ prompt.

10 basic system config

after logging in as root, do all the things the arch linux install guide says to do:

# set keyboard
loadkeys us
# set timezone
ln -sf /usr/share/zoneinfo/US/Central /etc/localtime
timedatectl set-ntp true
# set hw clock
hwclock --systohc
vim /etc/locale.gen
# uncomment en_US.UTF-8 UTF-8
locale-gen
echo LANG=en_US.UTF-8 >/etc/locale.conf
echo KEYMAP=us >/etc/vconsole.conf
vim /etc/hosts
# add 127.0.0.1 and ::1 mapped to localhost
# set root password
passwd

11 network configuration

vim /etc/systemd/network/home-wireless.network
# add:
# [Match]
# Name=wlp0s20f3
# [Network]
# DHCP=ipv4

i don’t know why the wireless interface name changes like that.

use systemd-networkd to autoconnect to an interface

wpa_passphrase ATTSB73hfi >>/etc/wpa_supplicant/wpa_supplicant-wlp0s20f3.conf
# enter passkey
systemctl start systemd-networkd
systemctl start wpa_supplicant@wlp0s20f3
systemctl start systemd-resolved

# my DNS servers were bad initially, so i added a custom resolv.conf file and added cloudflare and openDNS:
rm /etc/resolv.conf
vim /etc/resolv.conf
# contents:
#   nameserver 1.1.1.1
#   nameserver 1.0.0.1
#   nameserver 2606:4700:4700::1111
#   nameserver 2606:4700:4700::1001
#   nameserver 208.67.222.222
#   nameserver 208.67.220.220
#   nameserver 2620:119:35::35
#   nameserver 2620:119:53::53

# confirm: ip addr show wlp0s20f3
# confirm: ping 8.8.8.8
# confirm: ping example.org

# if that works, enable them on startup
systemctl enable systemd-networkd
systemctl enable wpa_supplicant@wlp0s20f3
systemctl enable systemd-resolved

you may want to reboot now to confirm it works

12 user config

pacman -S sudo
useradd -m bheim
passwd bheim # add password
EDITOR=vim visudo
# edit to add under "root"..:
#   bheim ALL=(ALL) ALL

13 system76 firmware packages

now that we’ve established a minimally functional installation, we add system76 firmware packages. much of the information here comes from these two articles (arch linux wiki, francisco soto blog post) and my own experimentation.

reboot and login as my user

sudo pacman -Syuu
sudo pacman -S base-devel git linux-headers
# linux-headers needed for at least system76-dkms, possibly others
mkdir code
cd code
git clone https://aur.archlinux.org/system76-dkms.git
git clone https://aur.archlinux.org/system76-io-dkms.git
git clone https://aur.archlinux.org/system76-firmware-daemon.git
git clone https://aur.archlinux.org/system76-acpi-dkms.git
# takes awhile
git clone https://aur.archlinux.org/system76-power.git

# build each one
cd system76-dkms
makepkg -sci
sudo modprobe system76 # my keyboard lights turned off when i ran this
cd ..

cd system76-io-dkms
makepkg -sci
sudo modprobe system76-io
cd ..

cd system76-firmware-daemon
makepkg -sci
sudo systemctl enable --now system76-firmware-daemon.service
cd ..

cd system76-acpi-dkms
makepkg -sci
sudo modprobe system76-acpi
cd ..

cd system76-power
makepkg -sci
sudo systemctl enable --now system76-power.service
cd ..

you can also install the system76-driver package if you want too, but it requires a lot of extra stuff and is mainly for older hardware.

clean up

rm -r system76-*

14 graphics card management

pacman -S bumblebee primus nvidia nvidia-settings mesa-demos
# mesa-demos is needed for the glxinfo executable
sudo gpasswd -a bheim bumblebee
sudo systemctl enable --now bumblebeed.service
sudo system76-power graphics intel

reboot

turning the graphics card on and off:

# ON
sudo system76-power graphics nvidia
sudo system76-power graphics power on
sudo modprobe nvidia-drm nvidia-modeset nvidia

# OFF
sudo rmmod nvidia-drm nvidia-modeset nvidia
sudo system76-power graphics power off
sudo system76-power graphics intel

can run this later in i3 for settings

optirun -b none nvidia-settings -c :8

15 various packages

install other things i want, i3 for config

pacman -S pkgfile i3 xorg xorg-xinit xorg-server dmenu xterm firefox

echo "exec i3" >> ~/.xinitrc
startx

vim ~/.config/i3/config
# change jkl; to hjkl, including in resize commands
# change horizontal split to mod+;

# after a reboot, i needed to run
systemctl edit --full systemd-logind.service
# and remove lines starting with DeviceAllow=
# found this information in this arch linux forum thread: https://bbs.archlinux.org/viewtopic.php?id=250684.

sudo pkgfile --update

16 steam

sudo vim /etc/pacman.conf
# and uncomment the multilib lines
sudo pacman -Sy
sudo pacman -S steam lib32-nvidia-utils

without lib32-nvidia-utils, steam will crash on startup with:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Steam: An X Error occurred
X Error of failed request: GLXBadContext
Major opcode of failed request: 151
Serial number of failed request: 50
...
~/.local/share/Steam/steam.sh: line 722: 115064 Segmentation fault ...

i figured this out from an arch linux forum post.

17 nvidia-xrun

switch to nvidia-xrun (better performance than bumblebee)

cd code
git clone https://aur.archlinux.org/nvidia-xrun-git.git
# use -git version because last package release was >3 yrs ago.
cd nvidia-xrun-git
makepkg -sci

systemctl disable bumblebeed
systemctl stop bumblebeed
systemctl enable nvidia-xrun-pm
reboot

nvidia-xrun i3

18 other development and system tools

pacman -S cmake clang qt5 ed nano emacs ninja boost ripgrep htop hub

19 installing swift

cd code
git clone https://aur.archlinux.org/swift-language.git
git clone https://aur.archlinux.org/libblocksruntime.git
git clone https://aur.archlinux.org/libbsd-git.git
cd libbsd-git
makepkg -sci
cd ..
cd libblocksruntime
makepkg -sci
cd ..
cd swift-language
makepkg -sci

20 installing pulseaudio for steam

sudo pacman -S pulseaudio-alsa lib32-libpulse lib32-alsa-plugins

21 building supercollider

sudo pacman -S fftw
cd code
git clone https://github.com/supercollider/supercollider
cd supercollider
git submodule update --init --recursive
mkdir buildterminal
cd build
cmake .. -DSUPERNOVA=1 -DCMAKE_BUILD_TYPE=Release -DSC_EL=0 -DSC_ED=0 -GNinja
ninja
sudo ninja install

22 audio things

sudo pacman -S jack2 realtime-privileges
sudo usermod bheim -G realtime
# and remove jack
# log out and back in

23 set caps lock to escape

# console configuration
su
mkdir /usr/share/kbd/keymaps/personal
cp /usr/share/kbd/keymaps/i386/qwerty/us.map.gz /usr/share/kbd/keymaps/personal/personal.map.gz
vim /usr/share/kbd/keymaps/personal/personal.map.gz
# set code 58 = Escape, not Caps_Lock
localectl set-keymap --no-convert personal
exit

# X configuration
vim ~/.xinitrc
# and add to the start:
#   xmodmap -e 'clear Lock' -e 'keysym Caps_Lock = Escape'

24 add my dotfiles (bash, vim, git configs)

# install pathogen -- NOTE: i use vundle now!
mkdir -p ~/.vim/autoload
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

# install ctags
sudo pacman -S ctags

cd ~/.vim
git clone https://github.com/brianlheim/vimbundle bundle
cd bundle
git submodule update --init --recursive

cd ~
git clone https://github.com/brianlheim/dotfiles
cd dotfiles
mv .[a-z]* ..
cd ..
rm -r dotfiles
git checkout arch

25 urxvt

installing and configuring urxvt with my color scheme

sudo pacman -S rxvt-unicode xorg-xrdb ttf-dejavu
vim ~/.xinitrc
# add:
#   [[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources

i found that xinitrc line on the arch linux wiki.

color scheme and font configuration in ~/.Xresources:

URxvt*color0: #2e2e2d
URxvt*color1: #ae2323
URxvt*color2: #057400
URxvt*color3: #c2bf1a
URxvt*color4: #1565c0
URxvt*color5: #aa2391
URxvt*color6: #008080
URxvt*color7: #f8f9fb

URxvt*color8: #545454
URxvt*color9: #db2c38
URxvt*color10: #07ad00
URxvt*color11: #e58234
URxvt*color12: #1a7ff1
URxvt*color13: #ec34c0
URxvt*color14: #00afaf
URxvt*color15: #a37aed

URxvt*foreground: #2e2e2d
URxvt*background: #fffff8
URxvt*highlightColor: #cdcdcd

URxvt*font: xft:DejaVu Sans Mono:pixelsize=13:antialias=true:hinting=true

EPILOGUE

remaining tasks:

  • HDMI input doesn’t seem to work, may be related to nvidia drivers and bumblebee…
  • chinese character input
  • compile vim myself to get xterm clipboard support(?)
  • get extended character sets in i3
  • pro audio stuff
  • freenode client?
  • linux-rt/linux-rt-lts

that’s all for now. feel free to contact me with any issues/concerns/improvements/questions!