Kernel Management
Quick Reference
# Current kernel
uname -r
# Available kernels
pacman -Ss '^linux$'
# Install kernel
sudo pacman -S linux linux-headers
# Install LTS kernel
sudo pacman -S linux-lts linux-lts-headers
# Rebuild initramfs
sudo mkinitcpio -P
# DKMS rebuild
sudo dkms autoinstall
Available Kernels
Official Kernels
| Kernel | Description | Use Case |
|---|---|---|
linux |
Latest stable mainline |
Default, most hardware support |
linux-lts |
Long-term support |
Stability, servers, older hardware |
linux-zen |
Optimized for desktop |
Gaming, multimedia, responsiveness |
linux-hardened |
Security-focused |
Security-sensitive systems |
Install Multiple Kernels
# Install main kernel
sudo pacman -S linux linux-headers
# Install LTS as fallback
sudo pacman -S linux-lts linux-lts-headers
# Install Zen for desktop use
sudo pacman -S linux-zen linux-zen-headers
# Update bootloader entries
# (systemd-boot auto-detects, or create manual entries)
Kernel Information
Current Kernel
# Kernel version
uname -r
# 6.7.1-arch1-1
# Kernel release
uname -a
# Detailed info
cat /proc/version
# Installed kernel packages
pacman -Q | grep -E '^linux(-lts|-zen|-hardened)?(-headers)? '
Kernel Modules
# List loaded modules
lsmod
# Module info
modinfo nvidia
# Load module
sudo modprobe nvidia
# Unload module
sudo modprobe -r nvidia
# Load with options
sudo modprobe nvidia NVreg_PreserveVideoMemoryAllocations=1
Module Configuration
# Create module config file
# /etc/modprobe.d/nvidia.conf
options nvidia NVreg_PreserveVideoMemoryAllocations=1
options nvidia_drm modeset=1
# Blacklist module
# /etc/modprobe.d/blacklist.conf
blacklist nouveau
blacklist pcspkr
# Rebuild initramfs after changes
sudo mkinitcpio -P
DKMS (Dynamic Kernel Module Support)
Understanding DKMS
DKMS automatically rebuilds out-of-tree modules when: * Kernel is upgraded * Module source is updated * Manually triggered
Common DKMS modules: * nvidia * nvidia-open * virtualbox-host-modules * broadcom-wl * zfs
Install DKMS
# Install DKMS
sudo pacman -S dkms
# Most drivers have DKMS variants
sudo pacman -S nvidia-dkms # NVIDIA
sudo pacman -S nvidia-open-dkms # NVIDIA open
DKMS Commands
# List DKMS modules
dkms status
# Build module for kernel
sudo dkms install nvidia/545.29.06 -k 6.7.1-arch1-1
# Remove module
sudo dkms remove nvidia/545.29.06 -k 6.7.1-arch1-1
# Rebuild all modules for current kernel
sudo dkms autoinstall
# Build module manually
sudo dkms build nvidia/545.29.06
Kernel Parameters
Temporary Parameters
# View current parameters
cat /proc/cmdline
# Set at boot time (in bootloader menu)
# Press 'e' to edit entry, add parameters to options line
Permanent Parameters
Common Parameters
| Parameter | Purpose |
|---|---|
quiet |
Suppress most boot messages |
splash |
Show splash screen |
nvidia_drm.modeset=1 |
NVIDIA Wayland support |
amd_iommu=on |
Enable AMD IOMMU (for passthrough) |
intel_iommu=on |
Enable Intel IOMMU |
iommu=pt |
IOMMU passthrough mode |
mitigations=off |
Disable CPU vulnerability mitigations (performance) |
nowatchdog |
Disable watchdog (faster shutdown) |
nmi_watchdog=0 |
Disable NMI watchdog |
mem_sleep_default=deep |
Prefer deep sleep (S3) |
acpi_osi=Linux |
ACPI compatibility |
pcie_aspm=force |
Force PCIe power management |
Sysctl Kernel Tuning
View Parameters
# List all
sysctl -a
# Specific parameter
sysctl vm.swappiness
# Search
sysctl -a | grep dirty
Custom Kernel Compilation
Get Source
# Official PKGBUILD
asp checkout linux
cd linux
# Or download from kernel.org
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.tar.xz
tar xf linux-6.7.tar.xz
cd linux-6.7
Configure
# Copy current config
zcat /proc/config.gz > .config
# Or use Arch's config
cp /usr/src/linux/.config .
# Configure with menuconfig
make menuconfig
# Or just update for new version
make olddefconfig
Build
# Build kernel (parallel jobs = CPU cores)
make -j$(nproc)
# Install modules
sudo make modules_install
# Install kernel
sudo make install
# Or manually:
sudo cp arch/x86/boot/bzImage /boot/vmlinuz-linux-custom
sudo cp System.map /boot/System.map-linux-custom
# Create initramfs
sudo mkinitcpio -k 6.7.0-custom -g /boot/initramfs-linux-custom.img
# Add boot entry
Kernel Module Signing
Check Signing Status
# Module signing enforced?
cat /proc/sys/kernel/module_sig_enforce
# View module signature
modinfo -F sig_hashalgo nvidia
Secure Boot with Custom Modules
# Generate signing key
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -days 36500 -subj "/CN=My Module Signing Key/"
# Enroll key
sudo mokutil --import MOK.der
# Sign module
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 MOK.priv MOK.der /path/to/module.ko
Switching Kernels
Troubleshooting
Kernel Panic
# Boot older kernel from menu
# Check what changed
journalctl -b -1 -p err
# Common causes:
# - Missing modules in initramfs
# - Wrong root= parameter
# - Filesystem corruption
Module Not Loading
# Check if blacklisted
grep module_name /etc/modprobe.d/*
# Check kernel log
dmesg | grep module_name
# Try loading manually
sudo modprobe -v module_name
DKMS Build Failed
# Check kernel headers installed
pacman -Q | grep headers
# Install missing headers
sudo pacman -S linux-headers
# Check build log
cat /var/lib/dkms/module/version/build/make.log
# Rebuild
sudo dkms autoinstall
After Kernel Update
# If system breaks after update
# 1. Boot older kernel from menu
# 2. Check what updated
cat /var/log/pacman.log | tail -50
# 3. Downgrade if needed
sudo pacman -U /var/cache/pacman/pkg/linux-6.6.10...pkg.tar.zst
# 4. Hold package
# /etc/pacman.conf
IgnorePkg = linux linux-headers
Quick Reference
# Kernel info
uname -r # Version
cat /proc/cmdline # Boot parameters
cat /proc/config.gz | zcat # Kernel config
# Install kernels
sudo pacman -S linux linux-headers
sudo pacman -S linux-lts linux-lts-headers
sudo pacman -S linux-zen linux-zen-headers
# DKMS
dkms status
sudo dkms autoinstall
# Modules
lsmod
modinfo module_name
sudo modprobe module_name
sudo modprobe -r module_name
# Rebuild initramfs
sudo mkinitcpio -P
# Sysctl
sysctl -a
sysctl parameter=value
# Permanent: /etc/sysctl.d/99-custom.conf