Updated: 28 September 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9
This article explains how to go back to an older kernel when a new one causes problems, and how to test kernels safely. CentOS 6 is obsolete; the steps are for Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.
Boot an older kernel now
At the GRUB menu, choose the older kernel (on Ubuntu/Debian under Advanced options). To reach the menu on a VPS, open the VNC console in the VPS dashboard before restarting. Or, from a running system:
grubby --info=ALL | grep -E "^(index|kernel)" # AlmaLinux / Rocky grub2-reboot 1 && reboot # boot entry 1 once
Make the older kernel the default
grubby --set-default /boot/vmlinuz-5.14.0-570.el9.x86_64 # AlmaLinux / Rocky (use your version) grubby --default-kernel
On Ubuntu/Debian set GRUB_DEFAULT=saved in /etc/default/grub, run update-grub, then grub-set-default with the menu entry name.
Remove the faulty kernel
dnf remove kernel-core-<version> # AlmaLinux / Rocky apt remove linux-image-<version>-generic # Ubuntu
Never remove the kernel you are running (uname -r).
How it works
GRUB boots the saved default entry. You tell GRUB to try a new kernel once. If it works, you make it the default. If it hangs or panics, the next restart boots the old default again.
AlmaLinux / Rocky Linux 9
- List the kernels and their index numbers:
grubby --info=ALL | grep -E "^(index|kernel)" - Make sure the current, working kernel is the default:
grubby --default-kernel - Let a kernel panic restart the server automatically after 10 seconds:
grubby --update-kernel=ALL --args="panic=10" - Boot the new kernel once (index 0 in this example):
grub2-reboot 0 && reboot - If the server comes back on the new kernel (
uname -r), make it the default:grubby --set-default /boot/vmlinuz-<new-version>. If it did not boot, restart it (on a Ucartz VPS: Stop and Start in the VPS dashboard) and it starts the old kernel.
Ubuntu 24.04 / Debian 12
- In
/etc/default/grubsetGRUB_DEFAULT=savedand addpanic=10toGRUB_CMDLINE_LINUX, then runupdate-grub. - Save the working kernel as default:
grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-45-generic"(use the names fromgrep -E "menuentry|submenu" /boot/grub/grub.cfg). - Try the new kernel once:
grub-reboot "Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-50-generic" && reboot.