-
Notifications
You must be signed in to change notification settings - Fork 35
03: System
To ensure compatibility with kernel modules and drivers, Architect installs the correct headers for all detected kernels.
for kernel in /boot/vmlinuz-*; do
[ -e "${kernel}" ] || continue
kernel_headers+=("$(basename "${kernel}" | sed -e 's/vmlinuz-//')-headers")
done
sudo pacman -S --needed "${kernel_headers[@]}"- Purpose: Required to build modules and ensure kernel compatibility.
Architect applies a range of kernel tweaks to improve system responsiveness and memory management for desktop usage. From cachyos-settings
sudo tee /etc/sysctl.d/70-architect-kernel.conf > /dev/null << 'EOF'
# Kernel performance and memory tuning for desktop systems
# The sysctl swappiness parameter determines the kernel's preference for pushing anonymous pages or page cache to disk in memory-starved situations.
# A low value causes the kernel to prefer freeing up open files (page cache), a high value causes the kernel to try to use swap space,
# and a value of 100 means IO cost is assumed to be equal.
vm.swappiness = 100
# The value controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects (VFS cache).
# Lowering it from the default value of 100 makes the kernel less inclined to reclaim VFS cache (do not set it to 0, this may produce out-of-memory conditions)
vm.vfs_cache_pressure = 50
# Contains, as bytes, the number of pages at which a process which is
# generating disk writes will itself start writing out dirty data.
vm.dirty_bytes = 268435456
# page-cluster controls the number of pages up to which consecutive pages are read in from swap in a single attempt.
# This is the swap counterpart to page cache readahead. The mentioned consecutivity is not in terms of virtual/physical addresses,
# but consecutive on swap space - that means they were swapped out together. (Default is 3)
# increase this value to 1 or 2 if you are using physical swap (1 if ssd, 2 if hdd)
vm.page-cluster = 0
# Contains, as bytes, the number of pages at which the background kernel
# flusher threads will start writing out dirty data.
vm.dirty_background_bytes = 67108864
# The kernel flusher threads will periodically wake up and write old data out to disk. This
# tunable expresses the interval between those wakeups, in 100'ths of a second (Default is 500).
vm.dirty_writeback_centisecs = 1500
# This action will speed up your boot and shutdown, because one less module is loaded. Additionally disabling watchdog timers increases performance and lowers power consumption
# Disable NMI watchdog
kernel.nmi_watchdog = 0
# Enable the sysctl setting kernel.unprivileged_userns_clone to allow normal users to run unprivileged containers.
kernel.unprivileged_userns_clone = 1
# To hide any kernel messages from the console
kernel.printk = 3 3 3 3
# Restricting access to kernel pointers in the proc filesystem
kernel.kptr_restrict = 2
# Disable Kexec, which allows replacing the current running kernel.
kernel.kexec_load_disabled = 1
# Increase netdev receive queue
# May help prevent losing packets
net.core.netdev_max_backlog = 4096
# Set size of file handles and inode cache
fs.file-max = 2097152
# Increase writeback interval for xfs
fs.xfs.xfssyncd_centisecs = 10000
# Disable split lock : https://www.phoronix.com/news/Linux-Splitlock-Hurts-Gaming
kernel.split_lock_mitigate = 0
EOF
sudo sysctl --system- Tweaks target swap behavior, file caching, logging verbosity, and performance-critical subsystems.
Architect pre-defines helpful script for system maintenance and recovery:
sudo tee /usr/bin/fix-key << 'EOF'
#!/bin/bash
sudo rm /var/lib/pacman/sync/*
sudo rm -rf /etc/pacman.d/gnupg/*
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman -Sy --noconfirm archlinux-keyring
sudo pacman --noconfirm -Su
EOF
sudo tee /usr/bin/update-arch << 'EOF'
#!/bin/bash
yay -Syu --noconfirm
EOF
sudo tee /usr/bin/update-grub << 'EOF'
#!/bin/bash
sudo grub-mkconfig -o /boot/grub/grub.cfg
EOF
sudo tee /usr/bin/install-all-pkg << 'EOF'
#!/bin/bash
sudo pacman -S $(pacman -Qnq) --overwrite='*'
EOF
sudo tee /usr/bin/clean-arch << 'EOF'
#!/bin/bash
yay -Sc --noconfirm && yay -Yc --noconfirm
EOF
sudo chmod +x /usr/bin/{fix-key,update-arch,update-grub,install-all-pkg,clean-arch}- fix-key: Repairs broken keyrings and updates packages.
-
update-arch: Uses the selected AUR helper (
yayorparu). - update-grub: Regenerates the GRUB config.
- reinstall-all-pkg: Reinstalls all installed packages.
Architect adds the aliases to the shell config based on your default shell.
-
.bashrcfor Bash -
.zshrcfor Zsh -
~/.config/fish/config.fishfor Fish
for i in "${alias[@]}"; do
if ! grep -q "${i}" "${HOME}/.bashrc"; then
echo "${i}" >>"${HOME}/.bashrc"
fi
doneArchitect allows the user to select and configure the default shell environment.
touch ~/.bashrcsudo pacman -S --needed zsh zsh-completions
chsh -s /usr/bin/zshOptionally install Oh My Zsh:
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrcsudo pacman -S --needed fish
chsh -s /usr/bin/fish
fish -c 'fish_update_completions'
fish -c 'set -U fish_greeting'
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fishAliases are added to the appropriate config file depending on shell.
Architect offers optional Bluetooth support:
sudo pacman -S --needed \
bluez \
bluez-utils \
bluez-plugins \
bluez-hid2hci \
bluez-libs
sudo systemctl enable --now bluetooth.servicePackage breakdown
- bluez: Core Bluetooth stack
-
bluez-utils: CLI tools (including
bluetoothctl) - bluez-plugins: Additional Bluetooth plugins
- bluez-hid2hci: Tools to switch HID devices into HCI (Host Controller Interface) mode
- bluez-libs: Common libraries needed by BlueZ and its associated applications
if command -v grub-mkconfig >/dev/null; then
echo "GRUB is installed."
else
echo "GRUB is not installed. Please install it."
fisudo mkdir -p /etc/pacman.d/hooks
sudo tee /etc/pacman.d/hooks/grub.hook > /dev/null << 'EOF'
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Operation = Remove
Target = usr/lib/modules/*/vmlinuz
[Action]
Description = Updating GRUB configuration ...
When = PostTransaction
Exec = /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
EOFsudo pacman -S os-prober
sudo sed -i 's/#\s*GRUB_DISABLE_OS_PROBER=false/GRUB_DISABLE_OS_PROBER=false/' /etc/default/grub
sudo os-prober
sudo grub-mkconfig -o /boot/grub/grub.cfgIf using Btrfs, Architect installs grub-btrfs and timeshift.
sudo pacman -S timeshift grub-btrfs timeshift-autosnap
sudo systemctl enable cronie.service
sudo systemctl enable grub-btrfsd
sudo sed -i 's|ExecStart=/usr/bin/grub-btrfsd --syslog /.snapshots|ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto|' /etc/systemd/system/multi-user.target.wants/grub-btrfsd.serviceThis ensures snapshots are detected and shown in the GRUB menu at boot.
Architect provides an optimized ZRAM configuration to improve system responsiveness, reduce memory pressure, and completely avoid disk-based swap, especially on desktop and gaming systems.
β¨ Why ZRAM?
- Uses compressed RAM as swap (much faster than SSD swap)
- Reduces the risk of Out Of Memory (OOM) situations
- Improves system responsiveness under load (gaming, compilation, multitasking)
- Particularly effective on systems with large amounts of RAM
π¦ Installation
Architect automatically installs the required package:
zram-generatorβοΈ zram-generator Configuration
The script generates the following configuration:
[zram0]
compression-algorithm = zstd
zram-size = ram
swap-priority = 100
fs-type = swapTechnical details
-
Compression:
zstd(excellent performance / compression ratio) -
Size:
ramβ 100% of total system RAM -
Swap priority:
100(preferred over any disk-based swap) - Type: native swap device
π This ensures ZRAM is always used before any physical swap.
π§ Memory tuning & compatibility
Architect applies a udev rule to tune memory behavior when ZRAM is initialized:
ACTION=="change", KERNEL=="zram0", ATTR{initstate}=="1", SYSCTL{vm.swappiness}="150", \
RUN+="/bin/sh -c 'echo N > /sys/module/zswap/parameters/enabled'"
Effects
-
vm.swappiness = 150- Strongly prioritizes ZRAM usage
- Reduces pressure on physical RAM
-
Zswap disabled
- Prevents conflicts (ZRAM and Zswap should not be used together)
- More predictable and stable behavior
βΉοΈ The global
vm.swappinessvalue defined viasysctlmay be lower (e.g. 100), but this rule guarantees maximum priority specifically for ZRAM.
π Activation
Changes are applied automatically:
sudo systemctl daemon-reload
sudo systemctl start /dev/zram0ZRAM becomes active immediately, without requiring a reboot.