-
-
Notifications
You must be signed in to change notification settings - Fork 1
Arch Linux Kernel Management
Complete beginner-friendly guide to managing kernels on Arch Linux, including installation, removal, switching, and custom kernels.
- Understanding Kernels
- Available Kernels
- Installing Kernels
- Removing Kernels
- Switching Kernels
- Kernel Parameters
- Custom Kernels
- Troubleshooting
Kernel is the core of the operating system.
Functions:
- Manages hardware
- Handles system resources
- Provides system calls
- Controls processes
Version format:
6.6.0-arch1
│ │ │ └─── Arch build number
│ │ └───── Patch version
│ └─────── Minor version
└───────── Major version
Different kernel types:
- Stable: Latest stable kernel
- LTS: Long-term support
- Hardened: Security-focused
- Zen: Performance-optimized
- Custom: User-compiled
Available in repositories:
- linux: Latest stable kernel
- linux-lts: Long-term support kernel
- linux-hardened: Security-hardened kernel
- linux-zen: Performance-optimized kernel
List installed kernels:
# List installed kernels
pacman -Q | grep linux
# Check running kernel
uname -rExpected output:
linux 6.6.0.arch1-1
linux-headers 6.6.0.arch1-1
linux-firmware 20231215.1b8c0c0-1
Install latest kernel:
# Install kernel
sudo pacman -S linux linux-headers
# For firmware
sudo pacman -S linux-firmwareWhat gets installed:
- Kernel image (
vmlinuz-linux) - Kernel headers (for building modules)
- Kernel modules
Install long-term support:
# Install LTS kernel
sudo pacman -S linux-lts linux-lts-headersWhy LTS:
- More stable
- Longer support
- Better for servers
- Fewer updates
Install both stable and LTS:
# Install both
sudo pacman -S linux linux-lts linux-headers linux-lts-headersBenefits:
- Fallback option
- Test new kernel
- Keep stable option
Security-focused kernel:
# Install hardened kernel
sudo pacman -S linux-hardened linux-hardened-headersFeatures:
- Enhanced security
- Kernel hardening
- Security patches
Performance-optimized:
# Install Zen kernel
sudo pacman -S linux-zen linux-zen-headersFeatures:
- Performance tweaks
- Better desktop responsiveness
- Optimized for gaming
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!
Before removing:
# Check current kernel
uname -r
# List installed kernels
pacman -Q | grep linuxOnly remove kernels you're not using.
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-nameSwitch at boot:
- Reboot system
- Press key when GRUB menu appears
- Select kernel from menu
- Boot into selected kernel
For GRUB:
# Edit GRUB config
sudo vim /etc/default/grubSet default:
GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux-lts"Regenerate:
sudo grub-mkconfig -o /boot/grub/grub.cfgEdit boot entry:
# Edit entry
sudo vim /boot/loader/entries/arch-lts.confChange kernel:
linux /vmlinuz-linux-lts
initrd /initramfs-linux-lts.img
Kernel parameters configure kernel at boot.
Common parameters:
-
quiet: Suppress boot messages -
splash: Show splash screen -
nomodeset: Disable KMS -
acpi=off: Disable ACPI
For GRUB:
# Edit GRUB config
sudo vim /etc/default/grubAdd parameters:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"Regenerate:
sudo grub-mkconfig -o /boot/grub/grub.cfgEdit boot entry:
sudo vim /boot/loader/entries/arch.confAdd to options:
options root=UUID=xxxx-xxxx-xxxx rw quiet splash
Useful parameters:
-
quiet: Less verbose boot -
splash: Boot splash -
nomodeset: Disable KMS (for NVIDIA) -
acpi=off: Disable ACPI -
iommu=on: Enable IOMMU -
mitigations=off: Disable security mitigations (performance)
Reasons:
- Remove unused features
- Add specific features
- Optimize for hardware
- Reduce size
Install build tools:
# Install base-devel
sudo pacman -S base-devel
# Install kernel build tools
sudo pacman -S aspGet 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.xzConfigure kernel:
# Copy config
cp /proc/config.gz .
gunzip config.gz
cp config .config
# Or use default
make defconfig
# Customize
make menuconfigBuild kernel:
# Build kernel
make -j$(nproc)
# Install modules
sudo make modules_install
# Install kernel
sudo make install** Advanced**: Only for experienced users!
If system won't boot:
- Boot from USB
- Chroot into system
- Install different kernel
- Reboot
Rebuild modules:
# Rebuild modules
sudo depmod -a
# Load module
sudo modprobe module-nameReinstall kernel:
# Reinstall kernel
sudo pacman -S linux linux-headers
# Regenerate initramfs
sudo mkinitcpio -PRegenerate initramfs:
# Regenerate for all kernels
sudo mkinitcpio -P
# For specific kernel
sudo mkinitcpio -p linuxThis 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
- 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.