Kernel live patching allows you to apply critical security patches to the Linux kernel without rebooting the server. This is invaluable for production servers where uptime is critical.
Installing kpatch
# On Ubuntu/Debian
sudo apt install -y kpatch kpatch-build
# On RHEL/CentOS (built-in as kpatch)
sudo yum install kpatch
# Check current kernel
uname -r
Applying Live Patches
# List available patches
kpatch list
# Apply a patch
sudo kpatch load /path/to/patch.ko
# Verify patch is applied
kpatch list
dmesg | tail -5
Canonical Livepatch (Ubuntu)
Ubuntu offers the Livepatch service for automatic kernel patching:
sudo snap install canonical-livepatch
sudo canonical-livepatch enable YOUR_TOKEN
canonical-livepatch status --verbose
Summary
Kernel live patching is a powerful tool for maintaining security without downtime. For production VPS instances, consider enabling automatic live patching to stay protected against kernel vulnerabilities.