Security updates without downtime: restarts, reboots and live patches
apt upgrade replaces files on disk. A process that started before the update keeps running the old code from memory: the old OpenSSL in nginx, the old glibc in every daemon, the old kernel until the next boot. Until those restart, the CVE stays exploitable, and scanners that check the running kernel keep reporting it.
What needs what
| Updated | Takes effect after |
|---|---|
| a program (sshd, nginx, postgres) | restarting that service |
| a shared library (OpenSSL, glibc, zlib) | restarting every process that loaded it |
| the kernel | a reboot, or a live patch for selected fixes |
| a container image | recreating the container from the new image |
| CPU microcode | a reboot (or a late load, depending on the platform) |
Find what still runs old code
Debian and Ubuntu: needrestart
needrestart checks which processes map deleted or replaced files and whether a newer kernel is installed:
sudo apt install needrestart
sudo needrestart -r l # list services that need a restart, change nothing
sudo needrestart -r a # restart them
sudo needrestart -b -k # machine-readable kernel status
In batch mode, NEEDRESTART-KSTA: 1 means the running kernel is the newest installed, 2 an ABI-compatible upgrade is pending, 3 a version upgrade; 0 means needrestart could not tell. needrestart also runs after each apt operation and asks or acts according to /etc/needrestart/needrestart.conf.
RHEL, Rocky, Alma: dnf needs-restarting
The command is in the package dnf-plugins-core:
sudo dnf needs-restarting -s # systemd services to restart
sudo dnf needs-restarting -r # is a reboot needed? exit code 1 if yes
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.
Any system: processes with deleted files mapped
sudo grep -l -E '\(deleted\)' /proc/[0-9]*/maps 2>/dev/null | cut -d/ -f3 | sort -u | paste -sd, | xargs -r ps -o pid,comm -p
Restart services gracefully
| Service | How |
|---|---|
| nginx | systemctl reload nginx starts new workers with the new configuration and lets old workers finish their requests. A reload does not load a new nginx binary. After an nginx package update, run systemctl restart nginx, which drops open connections for a moment, or replace the binary on the fly with the USR2 signal as the nginx documentation describes. |
| sshd | systemctl restart ssh (Debian, Ubuntu) or sshd (RHEL) restarts the listener. Existing SSH sessions keep running in their own processes. |
| PHP-FPM, Gunicorn, uWSGI, Puma | A reload starts new workers and lets old ones finish. Check that your service unit maps reload to the graceful signal of the server. |
| Databases | A restart closes all connections. Applications with a connection pool usually reconnect; restart in a quiet hour, or switch to a replica first. |
With more than one instance behind a load balancer or reverse proxy, restart one at a time: take it out of the pool, wait until its connections finish, restart, check health, put it back.
Containers
A restarted container runs the same image. To get fixes, pull or rebuild the image and recreate the container:
docker compose pull && docker compose up -d
Compose recreates only the services whose image changed. For zero downtime, run two replicas behind a proxy that health-checks them, and update one at a time.
Reboots
A fixed window
For servers that can take a minute of downtime, pick a window, for example once a week at night, and let the system reboot itself only when an update needs it:
# Debian, Ubuntu: /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "03:30";
# RHEL family: /etc/dnf/automatic.conf
[commands]
reboot = when-needed
Both are off by default: "false" on Debian 12, never on Rocky Linux 9.
Rolling reboots
Reboot several servers one at a time, each after the previous one is healthy again.
Live patching
Ubuntu Livepatch (part of Ubuntu Pro, free for up to five machines) and kpatch on RHEL apply fixes for selected kernel CVEs to the running kernel; Red Hat ships live patches for Critical and Important CVEs. Other kernel fixes still need a reboot.
After a reboot
Check that the new kernel runs (uname -r), that services came back (systemctl --failed) and that the application answers.
Track it
- Check daily whether a reboot is pending, and since when. A kernel fix that waited 40 days for a reboot protected nobody for those 40 days.
- Count the services with old libraries after each update run.
- In your tracking, a fix that is installed but not active is still open.
Sources
- needrestart and its batch mode description (kernel status values 0 to 3) and Debian wiki: UnattendedUpgrades
- dnf-plugins-core: needs-restarting and dnf-automatic (
reboot = when-needed) - nginx: controlling nginx (reload and graceful worker shutdown)
- Ubuntu USN-6859-1 (Ubuntu Pro free for up to five machines)
- needrestart 3.6 tested in
debian:bookworm-20261027-slim;dnf needs-restarting, dnf-automatic defaults andrebootoptions read inrockylinux/rockylinux:9.9.20261112.0, on 2026-11-26
Check your servers every day
The Vulnpocalypse collector reports the packages and settings of a server once a day, and the digest lists what to fix, most urgent first.
Vulnpocalypse