unattended-upgrades is a package for Debian, Ubuntu and their derivatives that downloads and installs package updates automatically, by default only those from the security archive. In Linux security it is the standard way to provide automatic security updates on APT-based systems, so that known vulnerabilities are patched within hours of a fix being published rather than whenever an administrator next logs in.
The tool runs as a scheduled job, applies updates according to allowed origins defined in its configuration, records every action in a log and can reboot the machine at a chosen time when a kernel or core library update requires it. It reduces exposure to known vulnerabilities, but it does not replace testing, monitoring or a planned upgrade process.
How unattended-upgrades runs on a schedule
unattended-upgrades is triggered by the APT periodic mechanism. On systemd-based releases two timers, apt-daily.timer and apt-daily-upgrade.timer, start the work: the first refreshes package lists and may pre-download packages, the second runs the upgrade itself. Both timers include a randomized delay, which spreads load on mirrors when thousands of machines check at the same moment.
During a run the tool calculates which upgradable packages come from an allowed origin, checks that their dependencies can be satisfied without removing other packages, and installs them in small groups. Packages that would require interactive configuration prompts or conflicting changes are skipped and reported. The outcome is written to /var/log/unattended-upgrades/, and the dpkg actions appear in the usual APT history.
The table below shows the files and units that control this process and what each one decides.
| Component | Role | Typical content |
|---|---|---|
20auto-upgrades | Enables the periodic jobs | Update lists and run upgrades daily |
50unattended-upgrades | Main policy file | Origins, blacklist, reboot options |
apt-daily.timer | Schedules list refresh | Twice a day with random delay |
apt-daily-upgrade.timer | Schedules the upgrade run | Early morning with random delay |
| Log directory | Records each run | Installed, held and failed packages |
Key configuration options and their trade-offs
Most behavior is set in /etc/apt/apt.conf.d/50unattended-upgrades. The central setting is Allowed-Origins or its newer form Origins-Pattern, which restricts updates to named archives such as the distribution security pocket. Widening this list to include regular updates or third-party repositories increases coverage but also the risk of regressions.
Further options decide what happens around the upgrade. A package blacklist excludes software that must be upgraded by hand, such as a database engine. Automatic reboot settings determine whether and when the host restarts after updates that need it, and mail options send a report to an administrator.
| Option | Effect | Trade-off |
|---|---|---|
| Origins-Pattern | Selects archives to upgrade from | Wider scope means more change |
| Package-Blacklist | Excludes named packages | Excluded software stays unpatched |
| Automatic-Reboot | Restarts when required | Short downtime at reboot time |
| Automatic-Reboot-Time | Sets the restart time | Must fit the maintenance window |
| Remove-Unused-Kernel-Packages | Cleans old kernels | Fewer fallback kernels in boot menu |
| Sends run reports | Needs a working local mail setup |
unattended-upgrades compared with other update approaches
unattended-upgrades is one of several ways to keep Linux systems patched, and it fits best on APT-based servers and desktops that are managed individually or in small groups. Red Hat family systems use dnf-automatic for the same purpose, and large estates often rely on central tools that stage updates through test rings before production.
The comparison shows where each approach is strongest. A key difference is whether the running kernel is patched without a reboot, which only live patching services address.
| Approach | Scope | Best suited to |
|---|---|---|
| unattended-upgrades | APT packages from chosen origins | Debian and Ubuntu hosts |
| dnf-automatic | DNF packages, security or all | Fedora and RHEL family hosts |
| Manual apt upgrade | Whatever the operator selects | Systems needing full change control |
| Central patch management | Staged rollouts across fleets | Large regulated environments |
| Kernel live patching | Running kernel only | Hosts that cannot reboot often |
Deploying automatic security updates safely
A sound deployment starts with the default security-only scope, which gives the largest risk reduction for the smallest chance of breaking behavior. Security updates in stable Debian and Ubuntu releases are backported fixes, not new upstream versions, so functional changes are rare. Administrators can verify the configuration with unattended-upgrade --dry-run --debug before relying on it.
Reboot handling deserves an explicit decision. Without restarts, an updated kernel or C library stays on disk while the old vulnerable code keeps running. Tools such as needrestart show which services still use outdated libraries, and the file /var/run/reboot-required signals a pending restart.
| System type | Recommended setup | Reason |
|---|---|---|
| Single public web server | Security only, reboot at night | Fast patching, planned downtime |
| Database server | Security only, engine blacklisted | Engine upgrades need testing |
| Clustered nodes | Staggered reboot times | Keeps the service available |
| Developer workstation | Security and updates, no auto reboot | User controls restarts |
| Appliance or kiosk | Security only, automatic reboot | No operator logs in regularly |
Limitations and common mistakes
unattended-upgrades protects only against vulnerabilities that already have a packaged fix, and only for software installed through APT. Applications installed from source, language package managers, container images and snaps follow separate update paths and remain outside its reach. It complements controls such as AppArmor and Fail2ban rather than replacing them.
- Assuming it is enabled: minimal images and some cloud templates ship with the periodic jobs turned off.
- Ignoring held packages: updates blocked by dependency conflicts are logged but not installed.
- Never rebooting: patched kernels have no effect until the system restarts.
- Overly broad origins: adding third-party repositories can introduce untested major versions.
- No monitoring of logs: silent failures leave a host unpatched for months.
The short version
unattended-upgrades works like an automatic lock replacement service for a building. Whenever the manufacturer reports a flaw in a lock, the service quietly fits the improved version overnight, without waiting for the owner to notice.
The computer therefore stays protected against known problems even when nobody looks after it every day. It still needs an occasional restart for some fixes to take effect, and it only handles software that came from the official catalog.
Where it makes a difference
A small company runs three Ubuntu servers for its website, mail and internal file sharing, maintained by one part-time administrator. A serious flaw in the OpenSSH server is disclosed on a Tuesday, and the distribution publishes a patched package the same afternoon.
Because unattended-upgrades is configured with the security-only scope, all three servers install the fix during their next scheduled run that evening, and the log records the new package version. The administrator, who only checks the systems on Fridays, finds that the exposure lasted hours instead of days. Kernel updates on the same servers are applied with automatic reboots at 03:30, staggered by fifteen minutes, so users never notice the restarts.