Module Progress
Module 7 of 10 • 7 min read
70%
Complete
Beginner to Mastery: A Step-by-Step Curriculum to Arch Linux

Module 6: Advanced Customization and Optimization

Module 7 of 10 7 min read

Learning Objectives:

  • Master advanced window manager configurations for minimal, efficient desktop environments
  • Implement comprehensive system performance optimizations and tuning
  • Develop custom kernel configurations and hardware-specific optimizations
  • Create personalized automation and workflow enhancement systems

Window managers provide the foundation for highly customized, efficient desktop environments. Unlike full desktop environments, window managers focus solely on window placement and management, allowing maximum customization and minimal resource usage.

Understanding Window Manager Types: Choose the right window manager architecture for your workflow:

Tiling Window Managers: Automatically arrange windows in non-overlapping layouts:

  • i3: User-friendly tiling with excellent documentation
  • dwm: Suckless philosophy, configured through source code
  • awesome: Lua-scriptable with dynamic layouts
  • bspwm: Binary space partitioning with external configuration

Floating Window Managers: Traditional overlapping window management:

  • openbox: Lightweight with extensive theming
  • fluxbox: Fast and minimalist
  • cwm: Calm window manager from OpenBSD

i3 Window Manager Configuration: Master the most popular tiling window manager:

Installing and Configuring i3:

# Install i3 and essential tools
sudo pacman -S i3-wm i3status i3lock dmenu

# Install additional utilities
sudo pacman -S rofi feh picom alacritty

# Copy default configuration
mkdir -p ~/.config/i3
cp /etc/i3/config ~/.config/i3/config

Essential i3 Configuration: Customize your i3 setup for optimal workflow:

# Edit i3 configuration
nano ~/.config/i3/config

Key configuration sections:

# Set modifier key (Mod4 = Super/Windows key)
set $mod Mod4

# Define workspaces
set $ws1 "1:term"
set $ws2 "2:web"
set $ws3 "3:code"
set $ws4 "4:files"

# Application launcher
bindsym $mod+d exec rofi -show run

# Terminal
bindsym $mod+Return exec alacritty

# Window management
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right

# Workspace switching
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2

# Auto-start applications
exec --no-startup-id picom
exec --no-startup-id feh --bg-scale ~/wallpaper.jpg
exec --no-startup-id nm-applet

Advanced i3 Features: Implement sophisticated window management:

# Floating window rules
for_window [class="Calculator"] floating enable
for_window [class="Pavucontrol"] floating enable

# Workspace assignments
assign [class="Firefox"] $ws2
assign [class="Code"] $ws3

# Custom modes for system operations
mode "system" {
    bindsym l exec i3lock, mode "default"
    bindsym s exec systemctl suspend, mode "default"
    bindsym r exec systemctl reboot, mode "default"
    bindsym p exec systemctl poweroff, mode "default"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+Shift+e mode "system"

dwm Configuration: Experience the suckless philosophy with dwm:

# Install dwm from AUR
yay -S dwm

# Clone dwm source for customization
git clone https://git.suckless.org/dwm
cd dwm

# Edit config.h for customization
cp config.def.h config.h
nano config.h

# Compile and install
sudo make clean install

Polybar Status Bar: Create sophisticated status bars:

# Install polybar
sudo pacman -S polybar

# Create polybar configuration
mkdir -p ~/.config/polybar
nano ~/.config/polybar/config

Example polybar configuration:

[bar/main]
width = 100%
height = 30
background = #1e1e1e
foreground = #ffffff

modules-left = i3
modules-center = date
modules-right = cpu memory battery

[module/i3]
type = internal/i3
format = <label-state>

[module/cpu]
type = internal/cpu
interval = 2
format = <label> <ramp-coreload>
label = CPU %percentage%%

[module/memory]
type = internal/memory
interval = 2
format = <label>
label = RAM %percentage_used%%

System performance optimization transforms your Arch Linux installation into a highly responsive, efficient system tailored to your hardware and usage patterns.

Boot Time Optimization: Reduce system startup time through strategic service management and configuration:

Analyzing Boot Performance:

# Analyze boot time
systemd-analyze

# Show service startup times
systemd-analyze blame

# Generate boot chart
systemd-analyze plot > boot-analysis.svg

# Show critical chain
systemd-analyze critical-chain

Boot Optimization Strategies:

# Disable unnecessary services
sudo systemctl disable bluetooth.service
sudo systemctl disable cups.service  # If not printing
sudo systemctl disable NetworkManager-wait-online.service

# Enable parallel startup
sudo systemctl edit getty@tty1

Add to override file:

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM

Kernel Parameter Optimization: Fine-tune kernel behavior for your hardware:

# Edit GRUB configuration
sudo nano /etc/default/grub

Add performance-oriented kernel parameters:

GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog nmi_watchdog=0 audit=0 mce=off processor.max_cstate=1 intel_idle.max_cstate=0"

Memory Management Optimization: Optimize memory usage and swap behavior:

# Configure swappiness (0-100, lower = less swap usage)
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf

# Configure dirty page writeback
echo 'vm.dirty_ratio=15' | sudo tee -a /etc/sysctl.conf
echo 'vm.dirty_background_ratio=5' | sudo tee -a /etc/sysctl.conf

# Optimize file system cache
echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf

# Apply changes
sudo sysctl -p

I/O Scheduler Optimization: Configure optimal I/O scheduling for your storage:

# Check current I/O scheduler
cat /sys/block/sda/queue/scheduler

# Set I/O scheduler for SSD
echo 'ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"' | sudo tee /etc/udev/rules.d/60-ioschedulers.rules

# Set I/O scheduler for HDD
echo 'ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"' | sudo tee -a /etc/udev/rules.d/60-ioschedulers.rules

CPU Performance Tuning: Optimize CPU performance and power management:

# Install CPU frequency utilities
sudo pacman -S cpupower

# Set CPU governor for performance
sudo cpupower frequency-set -g performance

# Make permanent
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpupower
sudo systemctl enable cpupower.service

# For laptops, use ondemand for battery life
sudo cpupower frequency-set -g ondemand

Advanced kernel management allows you to optimize your system for specific hardware and use cases, from gaming to server workloads.

Custom Kernel Compilation: Build optimized kernels for your specific hardware:

Preparing for Kernel Compilation:

# Install kernel compilation tools
sudo pacman -S base-devel bc kmod libelf pahole cpio perl tar xz

# Download kernel source
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.tar.xz
tar -xf linux-6.6.tar.xz
cd linux-6.6

Kernel Configuration:

# Copy current kernel configuration
zcat /proc/config.gz > .config

# Configure kernel interactively
make menuconfig

# Optimize for your CPU
make localmodconfig  # Only include modules for current hardware

Compilation and Installation:

# Compile kernel (use all CPU cores)
make -j$(nproc)

# Install modules and kernel
sudo make modules_install
sudo make install

# Update bootloader
sudo grub-mkconfig -o /boot/grub/grub.cfg

Hardware-Specific Optimizations: Optimize for your specific hardware configuration:

Graphics Performance:

# NVIDIA optimizations
sudo nvidia-settings  # GUI configuration tool

# AMD optimizations
echo 'RADV_PERFTEST=aco' | sudo tee -a /etc/environment

# Intel optimizations
echo 'i915.enable_guc=2' | sudo tee -a /etc/modprobe.d/i915.conf

Audio Latency Optimization:

# Install real-time kernel for audio work
sudo pacman -S linux-rt linux-rt-headers

# Configure audio group permissions
sudo usermod -aG audio $USER

# Optimize PulseAudio for low latency
mkdir -p ~/.pulse
echo 'default-sample-rate = 48000' >> ~/.pulse/daemon.conf
echo 'default-fragments = 2' >> ~/.pulse/daemon.conf
echo 'default-fragment-size-msec = 4' >> ~/.pulse/daemon.conf

Storage Performance:

# SSD optimization
sudo systemctl enable fstrim.timer

# Configure mount options for performance
sudo nano /etc/fstab
# Add: /dev/sda1 / ext4 defaults,noatime,discard 0 1

# RAID configuration for performance
sudo mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
  1. Window Manager Exploration: Install and configure at least two different window managers. Compare their resource usage, customization options, and workflow efficiency.

  2. Performance Benchmarking: Establish baseline performance metrics using tools like sysbench, hdparm, and stress. Apply optimizations and measure improvements.

  3. Custom Kernel Building: Compile a custom kernel optimized for your hardware. Document the configuration choices and performance differences.

  4. Automation Development: Create custom scripts and configurations to automate repetitive tasks and system maintenance procedures.

  5. Resource Monitoring: Set up comprehensive system monitoring to track the effectiveness of your optimizations over time.

You've now mastered advanced customization and optimization techniques that transform Arch Linux into a highly personalized, efficient system. These skills represent the pinnacle of Linux system administration, allowing you to extract maximum performance from your hardware.

The combination of minimal window managers, performance optimizations, and custom kernel configurations creates a system that's both powerful and efficient. Your understanding of hardware-specific optimizations enables you to adapt these techniques to any system configuration.

In the next module, we'll focus on troubleshooting and problem-solving skills, ensuring you can diagnose and resolve complex system issues with confidence.

Contents

0%
0 of 10 completed