Installing Arch Linux on Razer Laptop

Documentation of my Arch setup on a new Razer laptop

Arch Install - Razer

Create ISO

Download Etcher

Download latest Arch ISO from Arch Linux

Boot from Media

Use F12 (or whatever key to enter boot menu) to boot from media. You may need to disable secure boot.

Connect to the internet

Connect a newtwork cable or use iwctl to connect.

device list
station wlan0 connect wifissid

Partition Disk


Use the path of your main drive. Mine is nvme0n1.

gdisk /dev/nvme0n1

Delete all existing partition with d.

Create boot partition with n.

  • default number (1)
  • default first sector
  • last sector input +512M
  • input ef00 “EFI System” as the type.

Create root partition with n with default number

  • default first sector
  • default last sector
  • input 8300 “Linux filesystem” as the type

Write Partitions

  • press w to write partitions

Setup Cryptography

cryptsetup luksFormat /dev/nvme0n1p2

Input YES and the new encryption password to encrypt the root partition.

cryptsetup open /dev/nvme0n1p2 root


Format the boot partition.

mkfs.fat -F32 /dev/nvme0n1p1

Format the main partition.

mkfs.ext4 /dev/mapper/root


Mount the root parition.

mount /dev/mapper/root /mnt

Mount the boot partition.

mount --mkdir /dev/nvme0n1p1 /mnt/boot


Get total number of megabytes of RAM. The number is on the Mem row under the ‘total’ column.

free --mebi

Create the swap file. xxxx is the total amount from the previous number multiplied by 1.5.

dd if=/dev/zero of=/mnt/swapfile bs=1M count=xxxx status=progress

Set permissions for swap file.

chmod 600 /mnt/swapfile

Set as the swapfile.

mkswap /mnt/swapfile

Turn on the swap.

swapon /mnt/swapfile

Base Install

Use the following command to install Arch Linux.

pacstrap -K /mnt base base-devel linux linux-firmware neovim

If you have a keyring error use the following command then run the previous.

pacman -Sy
pacman -S archlinux-keyring

Generate fstab

genfstab -U /mnt >> /mnt/etc/fstab

Switch Root

Switch to the newly installed Arch.

arch-chroot /mnt

TZ and Lang

Setup timezone information.

ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime

Synchronize system clock with hardware.

hwclock --systohc

Setup locales.

nvim /etc/locale.gen

Uncomment en_US.UTF-8 UTF-8.

echo 'LANG=en_US.UTF-8' > /etc/locale.conf


Set your hostname. Replace ‘arch’ with the hostname you’d like.

echo 'razer' > /etc/hostname

Edit the hosts file.

nvim /etc/hosts     localhost
::1           localhost     razer.localdomain        razer

Set Root Password


Initial Ramdisk

Add encrypt to ramdisk.

nvim /etc/mkinitcpio.conf

In the HOOKS array, add encrypt between block and filesystems and add resume between filesystems and fsck.

Generate Ramdisk.

mkinitcpio -P

Boot Manager

Install EFI Boot Manager and CPU microcode. Use amd-ucode instead if AMD.

pacman -S efibootmgr intel-ucode

Get UUID of the device.

blkid -s UUID -o value /dev/nvme0n1p2

Get the offset of the swapfile. It is the first number of “physical_offset” of the line ext “0:”.

filefrag -v /swapfile | head -n 4

Replace “xxxx” with the UUID of the nvme0n1p2 device and “yyyy” with the offset of the swapfile to tell the boot manager about our encrypted file system.

efibootmgr --disk /dev/nvme0n1 --part 1 --create --label "Arch Linux" --loader
/vmlinuz-linux --unicode 'cryptdevice=UUID=xxxx:root root=/dev/mapper/root 
resume=/dev/mapper/root resume_offset=yyyy rw initrd=\intel-ucode.img 
initrd=\initramfs-linux.img' --verbose

NOTE: On an NVidia system I ran into a kernel bug that required an efistub change

Notice the ibt=off

efibootmgr --disk /dev/nvme0n1 --part 1 --create --label "Arch Linux" --loader
/vmlinuz-linux --unicode 'cryptdevice=UUID=xxxx:root root=/dev/mapper/root 
resume=/dev/mapper/root resume_offset=yyyy rw ibt=off initrd=\intel-ucode.img 
initrd=\initramfs-linux.img' --verbose

Install Network Manager

pacman -S networkmanager
systemctl enable NetworkManager


Remove the install media.


Post-Install Setup

Use nmcli to connect to the internet.

nmcli device wifi list
nmcli device wifi connect WIFI password PASSWORD

Verify System is up-to-date

pacman -Syu

Setup new user

Uncomment %wheel ALL=(ALL) NOPASSWD: ALL to allow members of the wheel group to run privileged commands.

EDITOR=nvim visudo

Add a new user.

useradd --create-home --groups wheel red

Set user password.

passwd red

Exit and login as your new user.

Setup Window Manager

Install Xorg

sudo pacman -S git libx11 libxft xorg-server xorg-xinit terminus-font libxinerama

Install my suckless-st

git clone
cd st
sudo make install

Install my suckless-dwm

git clone
cd dwm
sudo make install

Install suckless-dmenu

git clone git://
cd dmenu
sudo make install

Install slstatus

git clone
cd slstatus
sudo make install

Additional Setup

Yay AUR Helper

cd /opt
sudo git clone
sudo chown -R red:red ./yay-git
cd yay-git
makepkg -si


Install notification helper

yay -S dunst

Setup shell

sudo pacman -S zsh

Change shell to zsh.

chsh -s /bin/zsh

Exit and login again to run the zsh wizard. Read and set every setting.

Install Oh-My-Zsh

yay -S oh-my-zsh-git

Install the PowerLevel10k theme.

yay -S zsh-theme-powerlevel10k-git
echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

Install FiraCode Nerd Fonts

yay -S ttf-firacode-nerd

Configure PowerLevel10k.

p10k configure

Install display manager

Install LightDM Mini Greeter

yay -S lightdm-gtk-greeter lightdm-mini-greeter
sudo nvim /etc/lightdm/lightdm.conf

Add the following configurations to the config under [Seat:*]


Modify the greeter conf and specify username.

sudo nvim /etc/lightdm/lightdm-mini-greeter.conf

Enable lightdm service.

sudo systemctl enable lightdm

Add dwm to startup application

sudo mkdir /usr/share/xsessions
sudo nvim /usr/share/xsessions/dwm.desktop
[Desktop Entry]
Comment=The Dynamic Window Manager

Customize Setup

Start x server

nvim .zprofile
# Autostart X using startx after tty login.
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
    exec startx

Install picom and feh.

yay -S picom feh

Add startup options to .xprofile.

nvim .xprofile
slstatus &
picom -f -b &
feh --no-fehbg --bg-fill '/home/red/Pictures/wallpapers/wallpaper.png'
git clone
ln -s ~/source/config/picom ~/.config/picom 
ln -s ~/source/config/nvim ~/.config/nvim 

Setup neovim

yay -S nvim-packer-git unzip

Open neovim and use the following command.


Run checkhealth and resolve warnings/errors


Install a web browser

yay -S brave-bin

Setup Sound

sudo pacman -S pipewire pipewire-pulse wireplumber

Setup Bluetooth

sudo pacman -S bluez bluez-utils
sudo systemctl enable bluetooth.service --now

Lock Root User

sudo passwd --lock root

Install Firewall

sudo pacman -S nftables
sudo systemctl enable nftables.service --now

Enable Time Synchronization

sudo systemctl enable systemd-timesyncd.service --now

Improve Power Management

sudo pacman -S tlp tlp-rdw
sudo systemctl enable tlp.service --now
sudo systemctl enable NetworkManager-dispatcher.service --now
sudo tlp-stat

Enable Scheduled fstrim

sudo systemctl enable fstrim.timer --now

Enable Scheduled Mirrorlist

sudo pacman -S reflector
sudo systemctl enable reflector.timer --now

Reduce Swappiness

echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-swappiness.conf

Setup Videocard

Install drivers

sudo pacman -S nvidia nvidia-utils nvidia-settings \
xorg-server-devel opencl-nvidia nvidia-prime

Verify nouveau are blacklisted.

cat /usr/lib/modprobe.d/nvidia.conf

Add nvidia to initramfs.

sudo nvim /etc/mkinitcpio.conf
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

Rebuild initramfs

mkinitcpio -P

Setup pacman hook to rebuild initramfs.

sudo mkdir /etc/pacman.d/hooks
sudo nvim /etc/pacman.d/hooks/nvidia.hook

Description=Update NVIDIA module in initcpio
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'

Install optimus-manager and optimus-manager-qt

yay -S optimus-manager optimus-manager-qt

Get the BusID of the nvidia card.

lspci | grep -E "VGA|3D"

Create optimus file.

sudo nvim /etc/X11/xorg.conf.d/optimus.conf
Section "Module"
    Load "modesetting"
Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    Option "AllowEmptyInitialConfiguration"

Nvidia DRM

sudo nvim /etc/modprobe.d/nvidia-drm.conf
options nvidia_drm modeset=1

Add LightDM Script.

sudo nvim /usr/local/bin/
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Make the script executable.

sudo chmod a+rx /usr/local/bin/

Edit the LightDM config.

nvim /etc/lightdm/lightdm.conf

Regenerate initramfs

sudo mkinitcpio -P


Network Manager Applet

yay -S network-manager-applet

Update .xprofile

nvim .xprofile
prime-offload && optimus-manager-qt &
/usr/local/bin/slstatus &
/usr/bin/picom -f -b &
/usr/bin/nm-applet &

Set Dark Mode

Install the package xfce4-settings

sudo pacman -S xfce4-settings

Set your default theme to Adwaita-dark

xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita-dark"
gsettings set org.gnome.desktop.interface color-scheme prefer-dark

Multi Monitor Setup

I have my 1080p gaming monitor setup next to my 1440p laptop. DPI is still an issue in linux so I’ve set my DPI via .Xresources file.

Xft.dpi: 124

Here is my file that I run on login to get my monitor layout to look correct. The idea is to transform the smaller screen to a larger resolution to match the laptop monitor. Then use a DPI that I find readable.

xrandr --output eDP-1-1 --mode 2560x1440 --pos 2496x0 --rotate normal
xrandr --output HDMI-0 --mode 1920x1080 --transform 1.3,0,0,0,1.3,0,0,0,1 --fb 2496x1404

You may need to run it twice.