Giter Club home page Giter Club logo

g14arch's Introduction

Arch Linux on Asus ROG Zephyrus G14 (G401II)

My own notes installing Arch Linux with btrfs, disc encryption, auto-snapshots, no-noise fan-curves on my Asus ROG Zephyrus G14

desk

[TOC]

Basic Install

Prepare and Booting ISO

Boot into BIOS and change your Harwareclock to UTC. Now booting Arch Linux, using a prepared Usbstick

Change keyboard layout with loadkeys de-latin1-nodeadkeys

Networking

For Network i use wireless, if you need wired please check the Arch WiKi.

Launch iwctl and connect to your AP station wlan0 connect YOURSSID Type exit to leave.

Update System clock with timedatectl set-ntp true

Format Disk

  • My Disk is nvme0n1, check with lsblk

  • Format Disk using gdisk /dev/nvme0n1 with this simple layout:

    • o for new partition table
    • n,1,<ENTER>,+1024M,ef00 for EFI Boot
    • n,2,<ENTER>,<ENTER>,8300 for the linux partition
    • w to save layout

Format the EFI Partition

mkfs.vfat -F 32 -n EFI /dev/nvme0n1p1

Create encrypted filesystem

cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup open /dev/nvme0n1p2 luks

Create and Mount btrfs Subvolumes

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 /mnt Mount root filesystem to /mnt
  • btrfs sub create /mnt/@
  • btrfs sub create /mnt/@home
  • btrfs sub create /mnt/@snapshots
  • btrfs sub create /mnt/@swap

Create a btrfs swapfile and remount subvols

truncate -s 0 /mnt/@swap/swapfile
chattr +C /mnt/@swap/swapfile
btrfs property set /mnt/@swap/swapfile compression none
fallocate -l 16G /mnt/@swap/swapfile
chmod 600 /mnt/@swap/swapfile
mkswap /mnt/@swap/swapfile
mkdir /mnt/@/swap

Just unmount with umount /mnt/ and remount with subvolumes

mount -o noatime,compress=zstd,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,commit=120,subvol=@home /dev/mapper/luks /mnt/home/
mount -o noatime,compress=zstd,commit=120,subvol=@snapshots /dev/mapper/luks /mnt/.snapshots/
mount -o noatime,commit=120,subvol=@swap /dev/mapper/luks /mnt/swap/

mount /dev/nvme0n1p1 /mnt/boot/

mount -o noatime,compress=zstd,commit=120,subvolid=5 /dev/mapper/luks /mnt/btrfs/

Check mountmoints with df -Th

Install the system using pacstrap

pacstrap /mnt base base-devel linux linux-firmware btrfs-progs nano vi 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

Chroot into the new system and change language settings

arch-chroot /mnt
echo {MYHOSTNAME} > /etc/hostname
echo LANG=de_DE.UTF-8 > /etc/locale.conf
echo LANGUAGE=de_DE >> /etc/locale.conf
echo KEYMAP=de-latin1-nodeadkeys > /etc/vconsole.conf
echo FONT=lat9w-16 >> /etc/vconsole.conf
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

Modify nano /etc/hosts with these entries. For static IPs, remove 127.0.1.1

127.0.0.1		localhost
::1				localhost
127.0.1.1		{MYHOSTNAME}.localdomain	{MYHOSTNAME}

nano /etc/locale.gen to uncomment the following lines

de_DE.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE@euro ISO-8859-15
en_US.UTF-8

Execute locale-gen to create the locales now

Add a password for root using passwd root

Add btrfs and encrypt to Initramfs

nano /etc/mkinitcpio.conf and add encrypt btrfs to hooks between block/filesystems

HOOKS="base udev autodetect modconf block encrypt btrfs filesystems keyboard fsck

Also include amdgpu in the MODULES section

create Initramfs using mkinitcpio -p linux

Install Systemd Bootloader

bootctl --path=/boot install installs bootloader

nano /boot/loader/loader.conf delete anything 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

Set nvidia-nouveau onto blacklist

using nano /etc/modprobe.d/blacklist-nvidia-nouveau.conf with these lines

	blacklist nouveau
	options nouveau modeset=0

Leave Chroot and Reboot

Type exit to exit chroot

umount -R /mnt/ to unmount all volumes

Now its time to reboot into the new system!

Finetuning after first Reboot

Enable Networkmanager

Configure WiFi Connection.

systemctl enable --now NetworkManager
nmcli device wifi connect "{YOURSSID}" password "{SSIDPASSWORD}"

Enable NTP Timeservice

systemctl enable --now systemd-timesyncd.service

(You may look at /etc/systemd/timesyncd.conf for default values and change if necessary)

Create a new user

First create a new local user and point it to bash

useradd -m -g users -G wheel,lp,power,audio -s /bin/bash {MYUSERNAME}
passwd {MYUSERNAME}

Execute visudo and uncomment %wheel ALL=(ALL) ALL

Now exit and relogin with the new {MYUSERNAME}

Install some Deamons before we reboot

sudo pacman -Sy acpid dbus
sudo systemctl enable acpid

Setup automatic Snapshots for Pacman

The goal is to have automatic snapshots each time i made changes with pacman. The hook creates a snapshot to ".snapshots\STABLE". So if something goes wrong i can boot from this snapshot and rollback my system.

Create the STABLE snapshot and modify Bootloader

First i create the snapshot and changes by hand to test if anythink is working. After that it will be done automaticly by our hook and script.

sudo -i
btrfs sub snap / /.snapshots/STABLE
cp /boot/vmlinuz-linux /boot/vmlinuz-linux-stable
cp /boot/amd-ucode.img /boot/amd-ucode-stable.img
cp /boot/initramfs-linux.img /boot/initramfs-linux-stable.img
cp /boot/loader/entries/arch.conf /boot/loader/entries/stable.conf

Edit /boot/loader/entries/stable.conf to boot from STABLE snapshot

title   Arch Linux Stable
linux   /vmlinuz-linux-stable
initrd  /amd-ucode-stable.img
initrd  /initramfs-linux-stable.img
options ... rootflags=subvol=@snapshots/STABLE rw

Now edit the /.snapshots/STABLE/etc/fstab to change the root to the new snapshot/STABLE

ˋˋˋ ... LABEL=ROOTFS / btrfs rw,noatime,.....subvol=@snapshots/STABLE ... ˋˋˋ

reboot and test if you can boot from the stable snapshot.

Script for auto-snapshots

Copy the script from my Repo to

/usr/bin/autosnap and make it executable with chmod +x /usr/bin/autosnap

Hook for pacman

Copy the script from my Repo to

/etc/pacman.d/hooks/00-autosnap.hook

Now each time pacman executes, it launches the autosnapscript which takes a snapshot from the current system.

Install Desktop Environment

Get X.Org and Xfce4

Install xorg and xfce4 packages

sudo pacman -Sy xorg xfce4 xfce4-goodies xf86-input-synaptics gvfs xdg-user-dirs ttf-dejavu pulseaudio network-manager-applet firefox-i18n-de git git-lfs curl wget

sudo localectl set-x11-keymap de pc105 deadgraveacute
xdg-user-dirs-update

LightDM Loginmanager

sudo pacman -S lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings
sudo systemctl enable lightdm

Reboot and login to your new Desktop. For Theming i followed this realy nice howto from Linux Scoop channel.

Oh-My-ZSH

I like to use oh-my-zsh with Powerlevel10K theme

sudo pacman -Sy zsh zsh-completions
chsh -s /bin/zsh # (relogin to activate)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
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

Setup Plymouth for nice Password Prompt during Boot

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 using /etc/mkinitcpio.conf, 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 linux

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

Optional: replace LightDM with the plymouth variant

sudo systemctl disable lightdm
sudo systemctl enable lightdm-plymouth

For Plymouth Theming and Options, check Plymouth on Arch Wiki

For XFCE4 Theming you could check this nice Youtube Video from Linux Scoop

Nvidia Driver

Install latest nvidia driver

I'am going to use the nvidia-dkms package, as i will use a custom kernel

sudo pacman -Sy nvidia-dkms nvidia-settings nvidia-prime acpi_call linux-headers

Reboot after install.

Tweaks

Add Custom Repo from Luke Jones and install some tools

Add G14 Repository

sudo bash -c "echo -e '\r[g14]\nSigLevel = DatabaseNever Optional TrustAll\nServer = https://arch.asus-linux.org\n' >> /etc/pacman.conf"

sudo pacman -Sy asusctl supergfxctl
sudo systemctl enable --now power-profiles-daemon.service
sudo systemctl enable --now supergfxd

Install custom Kernel and change bootloader

sudo pacman -Sy linux-g14 linux-g14-headers
sudo sed -i 's/vmlinuz-linux/vmlinuz-linux-g14/' /boot/loader/entries/arch.conf
sudo sed -i 's/initramfs-linux/initramfs-linux-g14/' /boot/loader/entries/arch.conf

Reboot now!

After reboot you can check available features with asusctl -s . Fan curves, profiles should be possible with custom kernel.

Modify profiles for asusctl

You can use my file from etc/asusd/profiles.conf. But its better to delete the existing file, after reboot its regenerated with default and read-out values, The file is self -descriptive.

Activate DBUS Messaging for the new asus deamon

systemctl --user enable asus-notify
systemctl --user start asus-notify

For more fine-tuning read the asusctl Manual

Setup Bluetooth

Install required bluetooth modules and add your user to the group lp

sudo pacman -Sy bluez bluez-utils blueman
sudo systemctl enable --now bluethooth.service

Enable Autologin

Since iam running full disc encryption, i would like to enable autologin to my X-Session. Open /etc/lightdm/lightdm.conf and add theese under [Seat:*]

pam-service=lightdm
pam-autologin-service=lightdm-autologin
autologin-user={MYUSERNAME}
autologin-user-timeout=0
session-wrapper=/etc/lightdm/Xsession
greeter-session=lightdm-greeter

Now create the group autologin and add your user

sudo groupadd -r autologin
sudo gpasswd -a {MYUSERNAME} autologin

g14arch's People

Contributors

unim8trix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

g14arch's Issues

Add linux-headers to installation

Hi, first of all, thank you for this guide. I was successfully able to install arch on my g14 with this, with the only difference being that I am using KDE instead of XFCE and using the linux-g14 kernel. The guide does not mention installation of linux-headers (or linux-g14-headers for me), without which trying to use the dGPU always results in black screen, at least with SDDM. Please add the following points to the guide:

  • Install linux headers at some point: sudo pacman -S linux-headers
  • Install nvidia packages: sudo pacman -S nvidia-dkms nvidia-settings nvidia-prime
  • Can also optionally install bbswitch from AUR: sudo pamac install bbswitch-g14-dkms-git
  • Install Optimus Manager from AUR: sudo pamac install optimus-manager-qt to be able to switch GPU. (requires restarting X, or logout and relogin)

Battery life

First of all thanks a lot for the extensive readme. Will certainly be helpful.

I'm considering to buy one of those.

Can you share your experiences with the battery life using Arch?
How does it compare to using windows with it's power management (as well as ROG's proprietary software)?

Restoring from stable snapshot

Hi! Thank you for your guide! It helped me a lot during arch installation on my G14. As my Linux experience is average and I’m still learning, I don't really know how to restore system from stable snapshot. Please can you help me with this?

BackFlap Animation?

Hi Thanks for Nice notes, Just got my G14 some days back, I love this machine and Linux on this machine is Love in the heaven.

Just wanted to know Are you able to run Backlight LED Animations in linux?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.