- Table of contents
- Arch Linux on Asus ROG Zephyrus G14 (G401II)
- Basic Install
- Prepare and Booting ISO
- Networking
- Format Disk
- Create encrypted filesystem
- Create and Mount btrfs Subvolumes
- Create a btrfs swapfile and remount subvols
- Install the system using pacstrap
- Chroot into the new system and change language settings
- Add btrfs and encrypt to Initramfs
- Install Systemd Bootloader
- Set nvidia-nouveau onto blacklist
- Leave Chroot and Reboot
- Finetuning after first Reboot
- Install Desktop Environment
- Nvidia
- Useful Customizations
- KDE Tweaks
- Fixing Audio on Linux
- Miscellaneous
Guide to install Arch Linux with btrfs, disc encryption, auto-snapshots, no-noise fan-curves on Asus ROG Zephyrus G14. Credits to Unim8rix, this guide is a fork of their guide with some variation.
Boot Arch Linux using a prepared USB stick. Rufus can be used on windows, Etcher can be used on Windows or Linux.
For Network i use wireless, if you need wired please check the Arch WiKi.
Launch iwctl and connect to your AP like this:
station wlan0 scanstation wlan0 get-networksstation wlan0 connect YOURSSID
Type exit to leave.
Update System clock with timedatectl set-ntp true
-
My Disk is
nvme0n1, check withlsblk -
Format Disk using
cfdisk /dev/nvme0n1with this simple layout:Mount Point Partition Partition type Size /mnt/boot /dev/boot_partition EFI system partition At least 300MB (Would suggest more if planning to run multiple kernels) /mnt /dev/root_partition Linux Filesystem Remainder of device
After partitioning, run lsblk to identify your partitions:
Sample lsblk output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 300M 0 part // This is our EFI partition
└─nvme0n1p2 259:2 0 476.6G 0 part // This is our Home partition
Identify your EFI partition, in this case /dev/nvme0n1p1, and format it like this:
mkfs.vfat -F 32 -n EFI /dev/nvme0n1p1
Note: This step is optional. If you do not want to use encryption, you can skip this step. Just remember that you need to replace any lines that contain /dev/mapper/luks with your "Linux Filesystem" partition (/dev/nvme0n1p2 in this case).
cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 luks
mkfs.btrfs -f -L ROOTFS /dev/mapper/luks btrfs filesystem for root partition
Mount Partitions und create Subvol for btrfs. I dont want home, etc in my snapshots, so create subvol for them.
mount -t btrfs LABEL=ROOTFS /mntMount root filesystem to /mntbtrfs sub create /mnt/@btrfs sub create /mnt/@homebtrfs sub create /mnt/@snapshotsbtrfs sub create /mnt/@swap
truncate -s 0 /mnt/@swap/swapfile
chattr +C /mnt/@swap/swapfile
btrfs property set /mnt/@swap/swapfile compression none
fallocate -l ${SWAP_SIZE} /mnt/@swap/swapfile
chmod 600 /mnt/@swap/swapfile
mkswap /mnt/@swap/swapfile
mkdir /mnt/@/swap
Replace ${SWAP_SIZE} with the amount of swap space you want. Typically you should have the same amount of swap as RAM. So if you have 16GB of ram, you should have 16GB of swap space. For example, a 16GB swap would be created like this:
fallocate -l 16G /mnt/@swap/swapfile. Notice that the size in GB is denoted with a G as a suffix and NOT GB.
Just unmount with umount /mnt/ and remount with subvolumes
mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/luks /mnt
mkdir -p /mnt/boot
mkdir -p /mnt/home
mkdir -p /mnt/.snapshots
mkdir -p /mnt/btrfs
mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@home /dev/mapper/luks /mnt/home/
mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@snapshots /dev/mapper/luks /mnt/.snapshots/
mount -o noatime,space_cache,commit=120,subvol=@swap /dev/mapper/luks /mnt/swap/
mount /dev/nvme0n1p1 /mnt/boot/
mount -o noatime,compress=zstd,space_cache,commit=120,subvolid=5 /dev/mapper/luks /mnt/btrfs/
Check mountpoints with df -Th
pacstrap /mnt base base-devel linux linux-firmware btrfs-progs nano networkmanager amd-ucode
After this, generate the filesystem table using
genfstab -Lp /mnt >> /mnt/etc/fstab
Add swapfile
echo "/swap/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
You can use a hostname of your choice, I have gone with zephyrus-g14.
arch-chroot /mnt
echo zephyrus-g14 > /etc/hostname
echo LANG=en_US.UTF-8 > /etc/locale.conf
echo LANGUAGE=en_US >> /etc/locale.conf
ln -sf /usr/share/zoneinfo/Asia/Karachi /etc/localtime
hwclock --systohc
Modify nano /etc/hosts with these entries. For static IPs, remove 127.0.1.1. Replace zephyrus-g14 with your hostname.
127.0.0.1 localhost
::1 localhost
127.0.1.1 zephyrus-g14.localdomain zephyrus-g14
nano /etc/locale.gen to uncomment the following line
en_US.UTF-8
Execute locale-gen to create the locales now
Add a password for root using passwd root
nano /etc/mkinitcpio.conf and add encrypt btrfs to hooks between block/filesystems. NOTE: If you chose to not encrypt your home partition, do not add encrypt to HOOKS.
HOOKS="base udev autodetect modconf block encrypt btrfs filesystems keyboard fsck
Also include amdgpu in the MODULES section
create Initramfs using mkinitcpio -P
bootctl --path=/boot install installs bootloader
nano /boot/loader/loader.conf delete everything and add these few lines and save
default arch.conf
timeout 3
editor 0
nano /boot/loader/entries/arch.conf with these lines and save.
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
copy boot-options with
echo "options cryptdevice=UUID=$(blkid -s UUID -o value /dev/nvme0n1p2):luks root=/dev/mapper/luks rootflags=subvol=@ rw" >> /boot/loader/entries/arch.conf
NOTE: If you chose to not encrypt your home partition, use this command:
ROOT_PARTITION=<!!!YOUR_ROOT_PARTITION_HERE!!!> && echo "options root=UUID=$(blkid -s UUID -o value ${ROOT_PARTITION}) rootflags=subvol=@ rw" >> /boot/loader/entries/arch.conf
using nano /etc/modprobe.d/blacklist-nvidia-nouveau.conf with these lines
blacklist nouveau
options nouveau modeset=0
Type exit to exit chroot
umount -R /mnt/ to unmount all volumes
Now its time to reboot into the new system!
Configure WiFi Connection.
systemctl enable NetworkManager
systemctl start NetworkManager
nmcli device wifi connect YOURSSID password SSIDPASSWORD
First create my new local user and point it to zsh
useradd -m -g users -G wheel,power,audio -s /usr/bin/zsh MYUSERNAME
passwd MYUSERNAME
Edit nano /etc/sudoers and uncomment %wheel ALL=(ALL) ALL
Now exit and relogin with the new MYUSERNAME
The first thing you should do after installing is to update your system. Open a commandd line and run:
sudo pacman -Syu
Install some Deamons before we reboot
sudo pacman -S acpid dbus
sudo systemctl enable acpid
To setup automatic snapshots everytime system updates, follow the section from Unim8rix's guide
Install xorg and kde packages
pacman -S xorg
sudo pacman -S plasma kde-applications pulseaudio
SDDM Loginmanager
sudo pacman -S sddm
sudo systemctl enable sddm
Reboot and login to your new Desktop.
kde-applications installs a bunch of packages that I do not need so I removed them. First remove the following groups of applications.
sudo pacman -Rns kdepim kde-games kde-education kde-multimedia
Then, remove some apps from other groups too.
sudo pacman -R kwrite kcharselect yakuake kdebugsettings kfloppy filelight kteatime konqueror konversation kopete
To see what various applications do, check out the kde-applications group on Arch website.
I like to use oh-my-zsh with Powerlevel10K theme
sudo pacman -S git git-lfs curl wget zsh zsh-completions firefox-i18n-de
chsh -s /bin/zsh # (relogin to activate)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
mkdir .local/share/fonts
cd .local/share/fonts
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
fc-cache -v
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc
NOTE: AS OF 2021-10-30, Plymouth-git from AUR is currently broken!!!
Plymouth is in AUR , just clone the Repo and make the Package (i create a subfolder AUR within my homefolder)
cd AUR
git clone https://aur.archlinux.org/plymouth-git.git
makepkg -is
Now modify the Hooks for the Initramfs, Plymouth must be right after "base udev". Delete encrypt hook, it will be replaced by plymouth-encrypt
HOOKS="base udev plymouth plymouth-encrypt autodetect modconf block btrfs filesystems keyboard fsck
Run mkinitcpio -P
Add some kernel-parameters to make boot smooth. Edit /boot/loader/entries/arch.conf and append to options
...rootflags=subvol=@ quiet splash loglevel=3 rd.systemd.show_status=auto rd.udev.log_priority=3 vt.global_cursor_default=0 rw
For Plymouth Theming and Options, check Plymouth on Arch Wiki. Issue the following command to set ROG logo as the plymouth theme.
sudo plymouth-set-default-theme -R bgrt
For KDE Theming you could check this nice Youtube Video from Linux Scoop
Install nvidia package from official repos. Double check to see if linux-headers are installed to avoid blackscreen on reboot. Do NOT run nvidia-xconfig on Arch as it results in black screen. Install the following packages:
sudo pacman -S nvidia-dkms nvidia-settings nvidia-prime acpi_call
Install optimus-manager and optimus-manager-qt. After rebooting, it should work fine.
-
Type C external display HDMI works out of the box, displays can be connected to type C port but require switching to dedicated graphics. Can be done either through asusctl or Optimus Manager QT.
-
Optimus Manager configuration In optimus manager qt, go to optimus tab, and select ACPI call switching method and set PCI reset to No. Enable PCI remove. Startup mode is integrated. In Nvidia, set dynamic power management to fine. Modeset, Pat and overclocking options.
-
Sleep/Shutdown issues System was only going to sleep once and after that got stuck on shutdown and sleep. This happened because I had set switching method to bbswitch in optimus manager. Swithced to acpi_call to fix.
NOTE: asusctl and optimus-manager may conflinct with eachother. If using asusctl, it is recommended to uninstall optimus-manager with sudo pacman -Rns optimus-manager optimus-manager-qt
Add Luke Jones's Repo to pacman.conf
sudo bash -c "echo -e '\r[g14]\nSigLevel = DatabaseNever Optional TrustAll\nServer = https://arch.asus-linux.org\n' >> /etc/pacman.conf"
sudo pacman -S asusctl
Activate DBUS Messaging for the new asus deamon to get asus notifications upon changing fan profile etc.
systemctl --user enable asus-notify
systemctl --user start asus-notify
Run the following commands:
asusctl -c 85 # Sets charge limit to 85% if you do not want this, do not execute this line
asusctl fan-curve -m Quiet -f cpu -e true
asusctl fan-curve -m Quiet -f gpu -e true
asusctl fan-curve -m Performance -f cpu -e true
asusctl fan-curve -m Performance -f gpu -e true
asusctl fan-curve -m Balanced -f cpu -e true
asusctl fan-curve -m Balanced -f gpu -e true
For fine-tuning read the Arch Linux Wiki or the Repository from Luke. asusctl requires kernel 5.15+, which at the time of writing has not been released. Install the ROG kernel instead.
After adding the above repo, install the ROG kernel by running
sudo pacman -S linux-g14 linux-g14-headers
#kernel headers are very important otherwise nvidia module will not load, resulting in black screen.
After installing the kernel, edit /boot/loader/loader.conf and add the following to it:
default arch-g14.conf
timeout 3
editor 0
Then run sudo cp /boot/loader/entries/arch.conf /boot/loader/entries/arch-g14.conf && sudo nano /boot/loader/entries/arch-g14.conf
Replace the lines that start with title, linux, and initrd with this:
title Arch Linux (g14)
linux /vmlinuz-linux-g14
initrd /amd-ucode.img
initrd /initramfs-linux-g14.img
and finally do
sudo mkinitcpio -P
To automatically turn Performance profile on charger connect and Quiet profile on charger disconnect, run the following
echo "#\!/bin/bash\nasusctl profile -P Performance\n" > ~/.local/share/scripts/switch_performance.sh && echo "#\!/bin/bash\nasusctl profile -P Quiet\n" > ~/.local/share/scripts/switch_quiet.sh
Make the scripts executable by running
chmod +x ~/.local/share/scripts/switch_performance.sh ~/.local/share/scripts/switch_quiet.sh
Go to Settings -> Power Management -> Energy Saving -> On AC Power. enable Run Script, select switch_performance script from ~/.local/share/scripts/ using open file dialogue button. Go to On Battery Tab, enable Run Script and select switch_quiet script from ~/.local/.local/share/scripts/ using open file dialogue button. Manually giving path does not appear to work for some reason.
Optional: Enable battery full charge notification. Go to KDE Settings -> Notifications -> Application Settings -> Configure Events. Select Charge Complete and Select Show a message in popup
Go to KDE Settings->Shortcuts->Custom Shortcuts. Click Edit->New->Global Shortcut->Command/URL. Name it NvidiaSettings. Set trigger to ROG Key and set action to nvidia-settings
Go to KDE Settings->Shortcuts->Custom Shortcuts. Click Edit->New->Global Shortcut->Command/URL. Name it ChangeFanProfile, set trigger to fn + f5 and action to asusctl profile -n
Run usb-devices and look for the device that says Product=N-KEY Device. Note the vendor id. For my zephyrus it is 0b05. Run
sudo find /sys -name modalias | xargs grep -i 0b05
Find the line that goes like:
.../input/input18/modalias:input:b0003v0B05p1866e0110-e0...
Copy the part after input:, before the first -e. In my case, it is b0003v0B05p1866e0110. Create a file named /etc/udev/hwdb.d/90-nkey.hwdb and add
/etc/udev/hwdb.d/90-nkey.hwdb
evdev:input:b0003v0B05p1866*
KEYBOARD_KEY_ff31007c=f20 # x11 mic-mute, space in start is important in this line
After that, update hwdb.
sudo systemd-hwdb update
sudo udevadm trigger
I prefer the apps to open in windowed mode, in the center of the screen with 1280 * 720 resolution. To do this, add Window Rule, name it Window Size. Set the following rules
- Window Class: Unimportant
- Match whole window class: No
- Window Types: Normal window (deselect all others)
- Size: Apply Initially, 1280x720
- Ignore Requested Geometry: Force, Yes.
To make brave launch in 1280x720, do the following:
- Edit
/usr/share/applications/brave-browser.desktop - line 111: change
Exec=brave %UtoExec=brave %U --window-size="1280,720" - Repeat for line 111 and 223
In display and monitor -> gamma, change gamma to 0.9 for better colors
Use fusuma to get touchpad gestures. Create ~/.local/share/scripts/fusuma.sh and add
#!/bin/bash
fusuma -d #for running in daemon mode
Add this scrpit to autostart in KDE settings. For macOS like gestures use this config. 4 finger gestures are not working. My config is in the repo.
A better magic lamp effect. In latest plasma versions, exclude "disable unsupported effects" next to the search bar in settings for the effect to appear.
In Kwin scripts, install "kwin-maximize-to-new-desktop" and run:
mkdir -p ~/.local/share/kservices5
ln -s ~/.local/share/kwin/scripts/max2NewVirtualDesktop/metadata.desktop ~/.local/share/kservices5/max2NewVirtualDesktop.desktop
Then install kdesignerplugin through pacman -S kdesignerplugin. Logout and login again after configuration changes. My config:
Trigger: Maximize only
Position: Next to current
(git)
Audio was exceptionally low on linux. To fix, first remove everything pulseaudio related by running:
sudo pacman -Rdd pulseaudio pulseaudio-alsa pulseaudio-bluetooth pulseaudio-ctl pulseaudio-equalizer pulseaudio-jack pulseaudio-lirc pulseaudio-rtp pulseaudio-zeroconf pulseaudio-equalizer-ladspa
Most of this may not be installed already so remove it from the command. Then, install pipewire and its related packages.
sudo pacman -S pipewire pipewire-pulse gst-plugin-pipewire pipewire-alsa pipewire-media-session
Install bluetooth related packages
sudo pacman -S bluez bluez-utils
sudo systemctl enable bluetooth.service
sudo systemctl start bluetooth.service
Install easyeffects
sudo pacman -S easyeffects
Run easyeffects and close. This will create the necessary directories. Install easyeffects-presets.
bash -c "$(curl -fsSL https://raw.githubusercontent.com/JackHack96/PulseEffects-Presets/master/install.sh)"
Launch easyeffects again, click presets on top left, select Advanced Auto Gain. Close easyeffects, run it as daemon using
easyeffects --gapplication-service &
It automatically adds itself to autostart, and runs as a service on reboot. No other config needed. Source
After installing and enabling zsh and oh-my-zsh with powerlevel10k, create file ~/.zshenv and do the following:
- Install fastfetch-git from pamac.
- Add
fastfetch --load-config paleofetchin~/.zshenv
Reduce key input delay to 250 ms for a better keyboard experience.
You can install paru, an AUR helper like this:
cd ~ && mkdir paru && git clone https://aur.archlinux.org/paru.git && cd paru && makepkg -sci && cd ~ && rm -r paru/
After installing paru, you can use it like pacman to install AUR packages.
Examples:
- paru -S <package>
- paru -Syu
- paru -Rns <package>
Do not run paru as root. It will ask for permission when it needs to.
Alternatively, you can use pamac, which also has a gui.
