unattended-upgrades

Also known as: automatic security updates

On this page 7

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.

ComponentRoleTypical content
20auto-upgradesEnables the periodic jobsUpdate lists and run upgrades daily
50unattended-upgradesMain policy fileOrigins, blacklist, reboot options
apt-daily.timerSchedules list refreshTwice a day with random delay
apt-daily-upgrade.timerSchedules the upgrade runEarly morning with random delay
Log directoryRecords each runInstalled, held and failed packages
Components that control automatic upgrades

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.

OptionEffectTrade-off
Origins-PatternSelects archives to upgrade fromWider scope means more change
Package-BlacklistExcludes named packagesExcluded software stays unpatched
Automatic-RebootRestarts when requiredShort downtime at reboot time
Automatic-Reboot-TimeSets the restart timeMust fit the maintenance window
Remove-Unused-Kernel-PackagesCleans old kernelsFewer fallback kernels in boot menu
MailSends run reportsNeeds a working local mail setup
Frequently changed options

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.

ApproachScopeBest suited to
unattended-upgradesAPT packages from chosen originsDebian and Ubuntu hosts
dnf-automaticDNF packages, security or allFedora and RHEL family hosts
Manual apt upgradeWhatever the operator selectsSystems needing full change control
Central patch managementStaged rollouts across fleetsLarge regulated environments
Kernel live patchingRunning kernel onlyHosts that cannot reboot often
Ways to keep Linux packages current

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 typeRecommended setupReason
Single public web serverSecurity only, reboot at nightFast patching, planned downtime
Database serverSecurity only, engine blacklistedEngine upgrades need testing
Clustered nodesStaggered reboot timesKeeps the service available
Developer workstationSecurity and updates, no auto rebootUser controls restarts
Appliance or kioskSecurity only, automatic rebootNo operator logs in regularly
Recommended settings by system type

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.