Arch Linux installation on my Razer Stealth 13 (early 2020) laptop

This is a summary of my installation of Arch Linux on my Razer Stealth 13 (early 2020) laptop (model # RZ09-03102W52).

In retrospect I regret buying this computer. Despite slick marketing, its discrete GPU (Nvidia GTX 1650 Ti) is not powerful enough to play games at reasonable settings. Razer’s customer service seems to be very bad. I have heard many accounts of Razer refusing warranty returns for laptop faults. I can understand why their trustpilot score is (currently) 1.4.

This page follows many of the steps I used when I installed Arch Linux on an AMD 5800X3D CPU/RX 7800XT GPU PC system that I built, and so I refer to that page [1] frequently.

This page will add (to the existing Windows partitions) two partitions: one small, unencrypted partition will be mounted as /boot. The second will be a LUKS-encrypted partition occupying the rest of the drive. Inside this will be logical volumes for the rest of the system, eg /, /home, /usr, /var, and swap (/tmp will use a temporary file system tmpfs). I made life easier by swapping out the original 512GB SSD for a 2TB SSD, and copying the old SSD to the new one. (The new partitions can then easily be added.)

Feel free to email me at ルーキー@エボ猫.コム if you have a question, or if I have made an error. David.



Download arch linux, burn to usb stick, initial checks

Follow the steps in [1]#download.


Swap out and partition drive, set up LUKS encryption and LVM

Swap out old SSD for a larger SSD:

The Razer comes with Windows preinstalled on a 512GB SSD (Solid State Storage Technology Corp Lite-On CA5-8D512 512GB PcIe Gen3x4 NVMe M.2 2280).

This is too small to be useful, so I swapped it for a 2TB SSD (Samsung 970 Evo Plus M.2 2TB P/N MZVLB2T0HALB Model MZ-V7S2T0 2021.08 PCIe Gen 3.0x4 NVMe 1.3).

Boot up the Razer using the Arch Linux usb stick created above. Secure boot must be disabled in BIOS:

With the old SSD in an SSD enclosure, plugged into a USB port, copy the old SSD contents to the new SSD:

dd if=/dev/sdX of=/dev/nvme0n1 bs=4M status=progress

where X is the usb device letter (check with eg lsblk -f to list all attached block storage devices).

Reboot, booting again off the Arch Linux usb stick.

Set up partitions:

(This follows [1]#partition closely.)

Run

fdisk /dev/nvme0n1

If for some reason there were a number n other than 5 partitions on the original system, then modify the new partition numbers accordingly (so the new partitions start at n+1).

Create a LUKS container on partition 7:

cryptsetup --cipher aes-xts-plain --key-size 512 --hash sha512 -v luksFormat /dev/nvme0n1p7

(follow instructions, including entering a passphrase).

Open LUKS container and set up LVM:

cryptsetup luksOpen /dev/nvme0n1p7 nvme0n1p7_crypt
pvcreate /dev/mapper/nvme0n1p7_crypt

Set up Volume Group/Logical Volumes:

Fire up bash shell (ie don’t use the default zsh)

bash

vgname=MYVGNAME # volume group name, change as needed
vgcreate $vgname /dev/mapper/nvme0n1p7_crypt

# The LVs to create. `lvs` has elements: <name of lv> <size of lv in GiB>
# (change the logical volumes to be created and their sizes as needed)
lvs=(root 1 swap 16 usr 20 usr_local 10 usr_src 80 var 30 var_tmp 15 home 200 opt 15 games 400 music 60 videos 60)
for ((j=0; j<${#lvs[*]}; j+=2)); do lvcreate -L ${lvs[$j+1]}g $vgname -n ${lvs[$j]}; done

Notes:

Format partitions:

# what will be /boot. "-m 1" specified to reserve 1% for root user on each fs (not default 5%)
mkfs.ext4 -m 1 /dev/nvme0n1p6

# all the remaining (non-swap) filesystems. See above for "-m 1" explanation.
for ((j=0; j<${#lvs[*]}; j+=2)); do if [[ ${lvs[$j]} != swap ]]; then mkfs.ext4 -m 1 /dev/$vgname/${lvs[$j]}; fi; done

# set up the swap partition
mkswap /dev/$vgname/swap

Unlike in [1]#partition /boot will not be a FAT32 partition. It can be an ext4 partition as it will not include the EFI files, which have to go in a FAT32 partition. Partition 2 will hold these files.


Mount filesystems

(with $vgname, $lvs as defined above, and still running under bash)

mount /dev/$vgname/root /mnt

mount --mkdir /dev/nvme0n1p6 /mnt/boot

# "p2" because partition 2 was the EFI System partition listed in "Set up partitions" above
mount --mkdir /dev/nvme0n1p2 /mnt/efi

swapon /dev/$vgname/swap

# mount non-root, non-swap LVM volumes to under /mnt, eg usr->mnt/usr, usr_local to mnt/usr/local (use IFS to "split" volume names on "_", then rejoin with "/")
IFS_bak="$IFS"; for ((j=0; j<${#lvs[*]}; j+=2)); do if [[ ${lvs[$j]} != root && ${lvs[$j]} != swap ]]; then IFS=_ pArray=(${lvs[$j]}); IFS=/ p="${pArray[*]}"; mount --mkdir /dev/$vgname/${lvs[$j]} /mnt/"$p"; fi; done; IFS="$IFS_bak"

Install essential packages

Follow the steps in [1]#essential.


Set up /etc/fstab, chroot to /mnt, and other configuration

Follow the steps in [1]#fstab.


Initramfs (/etc/mkinitcpio.conf)

Follow the steps in [1]#initramfs.


Boot loader (grub)

Follow the steps in [1]#grub.

(Expect $efi_part = /dev/nvme0n1p2 and $efi_d = /efi.)


Add main user, configure sudo, disable root login

Follow the steps in [1]#mainuser.


Set up wifi

Follow the steps in [1]#wifi.


Set up dhcpcd

Follow the steps in [1]#dhcpcd except:

as NetworkManager will be used to control wpa_supplicant and dhcpcd later.


Remaining installation

The rest of the installation follows [1], noting that the Razer has:

Where relevant, expect

$efi_part = /dev/nvme0n1p2
$efi_d = /efi
$efi_disk = /dev/nvme0n1
$efi_p = 2

Notes where needed on individual sections:

Secure Boot

In [1]#secureboot, to enable secure boot in the BIOS:

When enrolling the MOK certificate, it is found in SYSTEM/EFI/GRUB/<hostname>.cer.

Xorg

Follow [1]#xorg, modified as follows:

Install drivers and libs with:

sudo pacman -S xf86-video-intel mesa lib32-mesa vulkan-intel lib32-vulkan-intel
sudo pacman -S nvidia-open nvidia-utils lib32-nvidia-utils

Remove kms from HOOKS array in /etc/mkinitcpio.conf and regenerate the initramfs ([2]#Installation):

sudo sed -i -E -e 's/^(HOOKS=.* )kms /\1/' /etc/mkinitcpio.conf
sudo mkinitcpio -P

Set some nvidia_drm parameters ([2]#DRM_kernel_mode_setting):

sudo sed -i -E -e 's/^(GRUB_CMDLINE_LINUX_DEFAULT="[^"]*)"/\1 nvidia_drm.modeset=1 nvidia_drm.fbdev=1"/' /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg

Reboot.

NetworkManager

NetworkManager was installed on this system.

Gnome

Enabled automatic login.

Other archlinux packages

Packages specific to this device:


Refs