Package updates take effect when a service restarts, but a new kernel only runs after a reboot. Until then your VPS keeps running the old, possibly vulnerable kernel. This guide shows how to tell when a reboot is due and how to do it safely.
Before you start
- sudo access over SSH and access to your VPS control panel or console.
- Services set to start at boot (
systemctl is-enabled, see systemctl).
Check the running and installed kernels
uname -rdpkg --list | grep linux-imagerpm -q kernelIf the newest installed kernel is newer than uname -r, you need a reboot to use it.
Is a reboot required
On Ubuntu and Debian:
cat /var/run/reboot-required 2>/dev/null
cat /var/run/reboot-required.pkgs 2>/dev/nullOn AlmaLinux and Rocky Linux:
sudo dnf needs-restarting -rTo find services that still run old libraries without rebooting, use sudo needrestart (Ubuntu) or sudo dnf needs-restarting -s.
Reboot safely
- Install all pending updates: see apt, dnf and yum.
- Check
/etc/fstabis valid withsudo findmnt --verify, so the server boots. - Pick a quiet time and warn users if needed.
- Reboot:
sudo reboot. - Reconnect after a minute or two and confirm with
uname -randsystemctl --failed.
Tip: Schedule a reboot for later with sudo shutdown -r 03:00; cancel with sudo shutdown -c.
Automatic reboots
Ubuntu's unattended-upgrades can reboot automatically at a set time. In /etc/apt/apt.conf.d/50unattended-upgrades:
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "04:00";On AlmaLinux and Rocky Linux, dnf-automatic installs updates; reboots are planned separately. See automatic security updates.
Remove old kernels
sudo apt autoremove --purgednf keeps three kernels by default (installonly_limit in /etc/dnf/dnf.conf).
Troubleshooting
- VPS does not come back: open the console from your control panel to see boot errors; a broken fstab line is the most common cause (see mount a disk with fstab). Our team can help through a ticket.
- uname still shows the old kernel: on some virtualisation types the kernel is set by the host; check with support.
- A site is down after reboot: its service was not enabled; run
sudo systemctl enable --now name.
