UnderHost
Knowledgebase Docs

Linux Kernel Updates and Security Patches

Update Linux kernel safely: understand kernel versioning, check for updates, apply patches, handle reboots, verify security.

On this page

The Linux kernel is your VPS's core—it manages CPU, memory, network, storage. Kernel vulnerabilities can compromise entire systems. Regular kernel updates patch security holes, fix bugs, and improve performance. Keeping your kernel current is non-negotiable for security.

Why Kernel Updates Matter

  • Security vulnerabilities: Attackers exploit known kernel bugs. Updates patch them
  • Performance: Updates improve CPU scheduling, memory management, I/O speed
  • Stability: Fixes rare crashes, hangs, data corruption
  • Hardware support: New drivers for newer hardware
  • Compliance: Some certifications require current kernels

Kernel Version Numbering

Format: X.Y.Z (e.g., 5.15.32)

  • X (Major): Major release (5 = Linux 5.x series)
  • Y (Minor): Feature releases within major (15 = 5.15 series)
  • Z (Patch): Security/bug fix releases (32 = patch level)

Example: 5.15.32 → 5.16.0

  • 5.15 → 5.16: Minor version bump (new features, possible compatibility changes)
  • 5.15.32 → 5.15.33: Patch level (safe, just security/bug fixes)

Check Current Kernel

uname -a
# Output: Linux server 5.15.32-1-generic #... x86_64 GNU/Linux

uname -r
# Output: 5.15.32-1-generic

cat /etc/os-release
# Shows OS details including kernel info

Check for Available Updates

# Debian/Ubuntu
apt update
apt list --upgradable | grep linux
# Shows available kernel updates

# CentOS/RHEL
yum check-update kernel
dnf check-update kernel

Update Kernel

Debian/Ubuntu:

sudo apt update
sudo apt install linux-image-generic linux-headers-generic
# Or specific version:
sudo apt install linux-image-5.16.0

CentOS/RHEL:

sudo yum update kernel
# Or
sudo dnf update kernel

⚠️ Important:** Update process doesn't remove old kernels. Your system keeps old ones as fallback if new kernel fails.

Safe Reboot Procedure

Kernel changes require reboot:

  1. Backup important data (though rare, kernel bugs can cause issues)
  2. Warn users: "VPS rebooting for maintenance, ~2 minute downtime"
  3. Run: sudo reboot or sudo shutdown -r now
  4. VPS restarts automatically after shutdown
  5. New kernel loads on boot

Scheduled reboot for off-peak hours:

# Reboot at 2:00 AM tonight
echo "sudo reboot" | at 2:00 AM

Verify Update Success

After reboot, verify new kernel loaded:

uname -r
# Should show new version, e.g., 5.16.0 (instead of 5.15.32)

Check system stability:

dmesg | tail -20          # Check boot messages for errors
journalctl -b            # View boot session logs
uptime                   # Should show recent boot time
free -h                  # Check memory is recognized correctly

Security Best Practices

  • Update regularly: Don't wait months between kernel updates
  • Test first: Update staging VPS before production
  • Automate updates: Use unattended-upgrades on Debian/Ubuntu
  • Monitor for failures: Check logs after reboot for errors
  • Keep old kernels: System keeps them automatically for fallback
  • Remove old kernels: After confirmed stability, clean old versions
  • Plan maintenance windows: Reboot during low-traffic periods

Enable automatic updates:

apt install unattended-upgrades
# Configure for automatic kernel updates
dpkg-reconfigure -plow unattended-upgrades
Kernel updates require reboot—plan accordingly

Unlike application updates, kernel updates need a system reboot. Schedule these during maintenance windows. Contact UnderHost support if you need assistance rebooting.

Related: Package management | Security hardening | VPS management

Was this article helpful?

Need server management?

Let UnderHost help with server hardening, updates, troubleshooting, monitoring, and ongoing Linux administration.

Related articles

Back to Server Management