Arch Linux Kernel Management - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Arch Linux Kernel Management Guide
Complete beginner-friendly guide to managing kernels on Arch Linux, including installation, removal, switching, and custom kernels.
Table of Contents
- Understanding Kernels
- Available Kernels
- Installing Kernels
- Removing Kernels
- Switching Kernels
- Kernel Parameters
- Custom Kernels
- Troubleshooting
Understanding Kernels
What is a Kernel?
Kernel is the core of the operating system.
Functions:
- Manages hardware
- Handles system resources
- Provides system calls
- Controls processes
Kernel Versions
Version format:
6.6.0-arch1
│ │ │ └─── Arch build number
│ │ └───── Patch version
│ └─────── Minor version
└───────── Major version
Kernel Types
Different kernel types:
- Stable: Latest stable kernel
- LTS: Long-term support
- Hardened: Security-focused
- Zen: Performance-optimized
- Custom: User-compiled
Available Kernels
Official Kernels
Available in repositories:
- linux: Latest stable kernel
- linux-lts: Long-term support kernel
- linux-hardened: Security-hardened kernel
- linux-zen: Performance-optimized kernel
Check Installed Kernels
List installed kernels:
# List installed kernels
pacman -Q | grep linux
# Check running kernel
uname -r
Expected output:
linux 6.6.0.arch1-1
linux-headers 6.6.0.arch1-1
linux-firmware 20231215.1b8c0c0-1
Installing Kernels
Install Stable Kernel
Install latest kernel:
# Install kernel
sudo pacman -S linux linux-headers
# For firmware
sudo pacman -S linux-firmware
What gets installed:
- Kernel image (
vmlinuz-linux) - Kernel headers (for building modules)
- Kernel modules
Install LTS Kernel
Install long-term support:
# Install LTS kernel
sudo pacman -S linux-lts linux-lts-headers
Why LTS:
- More stable
- Longer support
- Better for servers
- Fewer updates
Install Multiple Kernels
Install both stable and LTS:
# Install both
sudo pacman -S linux linux-lts linux-headers linux-lts-headers
Benefits:
- Fallback option
- Test new kernel
- Keep stable option
Install Hardened Kernel
Security-focused kernel:
# Install hardened kernel
sudo pacman -S linux-hardened linux-hardened-headers
Features:
- Enhanced security
- Kernel hardening
- Security patches
Install Zen Kernel
Performance-optimized:
# Install Zen kernel
sudo pacman -S linux-zen linux-zen-headers
Features:
- Performance tweaks
- Better desktop responsiveness
- Optimized for gaming
Removing Kernels
Remove Kernel
Remove specific kernel:
# Remove kernel
sudo pacman -R linux
# Remove with headers
sudo pacman -R linux linux-headers
** Warning**: Don't remove the kernel you're currently using!
Check Running Kernel
Before removing:
# Check current kernel
uname -r
# List installed kernels
pacman -Q | grep linux
Only remove kernels you're not using.
Clean Old Kernels
Remove old kernel versions:
# List old kernels
pacman -Q | grep linux | grep -v $(uname -r)
# Remove old kernels (be careful!)
sudo pacman -R old-kernel-name
Switching Kernels
GRUB Boot Menu
Switch at boot:
- Reboot system
- Press key when GRUB menu appears
- Select kernel from menu
- Boot into selected kernel
Set Default Kernel
For GRUB:
# Edit GRUB config
sudo vim /etc/default/grub
Set default:
GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux-lts"
Regenerate:
sudo grub-mkconfig -o /boot/grub/grub.cfg
systemd-boot
Edit boot entry:
# Edit entry
sudo vim /boot/loader/entries/arch-lts.conf
Change kernel:
linux /vmlinuz-linux-lts
initrd /initramfs-linux-lts.img
Kernel Parameters
What are Kernel Parameters?
Kernel parameters configure kernel at boot.
Common parameters:
quiet: Suppress boot messagessplash: Show splash screennomodeset: Disable KMSacpi=off: Disable ACPI
Adding Parameters
For GRUB:
# Edit GRUB config
sudo vim /etc/default/grub
Add parameters:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
Regenerate:
sudo grub-mkconfig -o /boot/grub/grub.cfg
For systemd-boot
Edit boot entry:
sudo vim /boot/loader/entries/arch.conf
Add to options:
options root=UUID=xxxx-xxxx-xxxx rw quiet splash
Common Parameters
Useful parameters:
quiet: Less verbose bootsplash: Boot splashnomodeset: Disable KMS (for NVIDIA)acpi=off: Disable ACPIiommu=on: Enable IOMMUmitigations=off: Disable security mitigations (performance)
Custom Kernels
Why Custom Kernel?
Reasons:
- Remove unused features
- Add specific features
- Optimize for hardware
- Reduce size
Building Custom Kernel
Install build tools:
# Install base-devel
sudo pacman -S base-devel
# Install kernel build tools
sudo pacman -S asp
Get kernel source:
# Get kernel package
asp checkout linux
# Or download from kernel.org
wget https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.6.tar.xz
Configure kernel:
# Copy config
cp /proc/config.gz .
gunzip config.gz
cp config .config
# Or use default
make defconfig
# Customize
make menuconfig
Build kernel:
# Build kernel
make -j$(nproc)
# Install modules
sudo make modules_install
# Install kernel
sudo make install
** Advanced**: Only for experienced users!
Troubleshooting
Kernel Panic
If system won't boot:
- Boot from USB
- Chroot into system
- Install different kernel
- Reboot
Module Issues
Rebuild modules:
# Rebuild modules
sudo depmod -a
# Load module
sudo modprobe module-name
Kernel Not Found
Reinstall kernel:
# Reinstall kernel
sudo pacman -S linux linux-headers
# Regenerate initramfs
sudo mkinitcpio -P
Boot Issues
Regenerate initramfs:
# Regenerate for all kernels
sudo mkinitcpio -P
# For specific kernel
sudo mkinitcpio -p linux
Summary
This guide covered:
- Kernel basics - What kernels do
- Available kernels - Types of kernels
- Installing - How to install kernels
- Removing - How to remove kernels
- Switching - Change kernels
- Parameters - Kernel boot options
- Custom kernels - Building kernels
- Troubleshooting - Common issues
Key Takeaways:
- Multiple kernels can coexist
- LTS is more stable
- Don't remove running kernel
- Kernel parameters customize boot
- Custom kernels are advanced
Next Steps
- Arch Linux Bootloader Configuration - Bootloader setup
- Arch Linux System Configuration - System setup
- ArchWiki Kernel: https://wiki.archlinux.org/title/Kernel
This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.