Which tool for which distribution
Package versions in the official repositories, checked on November 13, 2026:
AlmaLinux 10 and Rocky Linux 10 still ship dnf 4, so the configuration below applies to both generations.
Before enabling reboots: take a snapshot
An automatic reboot is a reboot nobody is watching. Take a snapshot from the console before turning it on. If the first reboot goes wrong, you are one click away from a known-good state. Backups remain your baseline protection: a snapshot is a restore point, not a backup.Set up unattended-upgrades on Debian and Ubuntu
Install and enable
Ubuntu installsunattended-upgrades by default. On Debian, install it. Running the command on either is harmless:
/etc/apt/apt.conf.d/20auto-upgrades. Each value is a number of days: 1 for daily, 0 to disable.
Restrict it to security updates
That is already the default, with one nuance per distribution.- Ubuntu:
Allowed-Originscovers the base release, the-securitypocket and the ESM repositories when present.-updates,-proposedand-backportsare commented out. - Debian:
Origins-PatterncoversDebian-Securityand your release’s own archive (the one that receives stable point releases). Backports and-updatesare commented out.
50unattended-upgrades alone: the Debian wiki recommends putting your settings in a separate file, 52unattended-upgrades-local, which is read after it.
On Debian, if you want security advisories strictly, clear the list and declare it again. An APT list cannot be overridden, only cleared with #clear:
The file Ubuntu ships says it plainly: a security fix can depend on a package from the main archive. That is why the main archive is in the default lists. With the strict filter, such a fix waits: the simulation below shows it.
Decide how reboots happen
A patched kernel, C library or systemd only protects you after a reboot. When a package needs one, it creates/var/run/reboot-required. unattended-upgrades reboots only if that file exists and you have allowed it.
Append the settings to the local file (it is created if it does not exist yet):
Automatic-Reboot-Time also accepts now (the default) or +m, a delay in minutes.
The upgrade itself is triggered by apt-daily-upgrade.timer, set by default to 6:00 with a random delay of up to an hour. To have it run before that night’s reboot, move it earlier:
Get an email report
mail command: you need a package that provides it, such as bsd-mailx, and a local mail server that can deliver outside the VPS.
Check it: simulation, timers and logs
list-timers shows a next run within 24 hours.
Configure dnf-automatic on AlmaLinux and Rocky Linux
Install
Security only, reboots and email
Everything is set in/etc/dnf/automatic.conf. Change these lines in their respective sections:
stdio, the report also goes to the systemd journal. With email, dnf-automatic hands the message to the SMTP server named in email_host itself: a local mail server, such as Postfix, must accept it.
Pick the time and enable it
The reboot follows the upgrade by five minutes. Picking the reboot time therefore means picking the timer’s schedule, set by default to 6:00 with a random delay of up to an hour:dnf-automatic-install.timer, which installs regardless of apply_updates, and dnf-automatic-notifyonly.timer, which only notifies. Enable just one.
Check it
If the VPS does not come back
It is rare, and everything can be recovered from the console.Common pitfalls
Services still run the old code. An upgraded package does not replace the process in memory. On Ubuntu 24.04 and later,unattended-upgrades calls needrestart, which restarts the affected services. Elsewhere, list processes using replaced files with sudo dnf needs-restarting on AlmaLinux and Rocky, and restart the services concerned. Our nginx audit routine shows how to spot a process older than its update.
Third-party repositories are not covered. The default origins only target the distribution’s own repositories. PHP from an external repository, Docker, nginx.org: their fixes do not go through this mechanism. Add their origin to Origins-Pattern after reading it from apt-cache policy, or follow their advisories yourself.
A held package stays held. A package marked with apt-mark hold, or listed in Package-Blacklist, is never upgraded automatically. Check with apt-mark showhold.
A manual upgrade waits its turn. While unattended-upgrades is working, it holds the dpkg lock. An apt upgrade started at the same time waits: do not delete the lock.
Containers do not follow the host. Docker images carry their own packages. They are updated by rebuilding or pulling a new image, not by the host.
The report never arrives. No mail command, no local mail server, or a message rejected by the recipient: send a test email before relying on reports.
Going further
- Snapshots: create a restore point before changing the system
- Backups: baseline protection for your data
- KVM console and rescue mode: regain control of a VPS that stopped responding
- SSH keys: the other security setting to make on day one
- Operating systems: available versions and their end-of-support dates
- Enhanced security on a Linux VPS, for the next layers

