How to Set Up Automated Headless Debian Upgrades with Unattended-Upgrades

What unattended-upgrades does on a headless Debian server

unattended-upgrades is Debian's package for automatically downloading and installing selected APT updates without an interactive login. On a headless server, that makes it useful for security maintenance when no desktop session is available and nobody is expected to run apt upgrade every day.

As of October 2026, Debian 13 "trixie" is the stable Debian release, and the stable unattended-upgrades package is version 2.12. The package is meant for normal package updates, especially security and stable updates. It is not a substitute for the separate, planned process of upgrading from one major Debian release to another.

The practical model is simple: APT's periodic machinery refreshes package indexes, apt-daily-upgrade.service invokes the unattended-upgrade backend on schedule, and your policy decides which package origins are allowed. Debian logs the result under /var/log/unattended-upgrades/.

Quick setup checklist

GoalRecommended action
Install the updatersudo apt update && sudo apt install unattended-upgrades
Enable daily periodic workSet APT::Periodic::Update-Package-Lists "1"; and APT::Periodic::Unattended-Upgrade "1";
Keep local policy maintainablePut overrides in a later file such as 52unattended-upgrades-local
Test before relying on itsudo unattended-upgrade --debug --dry-run
Confirm schedulingInspect apt-daily.timer and apt-daily-upgrade.timer
Watch resultsReview /var/log/unattended-upgrades/ and your monitoring alerts

1. Install unattended-upgrades

Run the installation from an administrative shell:

sudo apt update
sudo apt install unattended-upgrades

Installing the package is safe to repeat: APT will simply report that it is already installed if the host already has it. Debian describes the package as an automatic installer for security upgrades and other updates selected by policy.

Debian terminal showing apt update followed by installation of the unattended-upgrades package
Example terminal view for installing unattended-upgrades. Repository names and package counts vary by Debian release and host.

For a fleet, do not assume every image has the same default state. Some Debian installations already include unattended upgrades; others do not, and an existing configuration may have been disabled. After installation, inspect the effective configuration instead of assuming that package presence means the policy you want is active.

2. Enable periodic package-list refreshes and unattended runs

Debian's upstream README says a manual setup needs these two APT periodic values:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

The value "1" means the activity is eligible to run daily. A practical local fragment is:

sudo nano /etc/apt/apt.conf.d/20auto-upgrades

Then add the two lines above. You can inspect the merged APT configuration with:

apt-config dump | grep -E 'APT::Periodic::(Update-Package-Lists|Unattended-Upgrade)'
Nano editor showing APT periodic settings for daily package-list updates and unattended upgrades
APT periodic settings that request daily package-list refreshes and unattended upgrade runs.

Do not read this as a promise that a job will start at exactly midnight every day. On systemd-based Debian systems, APT uses timer units and randomized scheduling behavior. For operations work, verify the actual timer state and next trigger on the host rather than designing monitoring around a guessed clock time.

3. Define which repositories may upgrade packages automatically

The key policy lives under Unattended-Upgrade::Origins-Pattern or the older Allowed-Origins form. Debian's 2.12 documentation recommends creating a local APT fragment that sorts after the packaged 50unattended-upgrades file, for example:

sudo nano /etc/apt/apt.conf.d/52unattended-upgrades-local

This is preferable to permanently editing the shipped file because package upgrades can replace or conflict with vendor-managed configuration. Before writing patterns, inspect the release metadata APT actually sees:

apt-cache policy

For most headless servers, a conservative policy is to keep automatic updates limited to Debian's normal stable and security channels. The exact patterns can differ with your repository layout, mirrors, third-party vendors, and pinning rules, so treat apt-cache policy as the source of truth on each environment.

Nano editor showing an unattended-upgrades origins policy and automatic reboot disabled
Example policy editor view. Match origins to the repositories reported by apt-cache policy on your server rather than copying labels blindly.

Optional controls worth knowing

The 2.12 configuration supports package blacklists and whitelists, automatic reboots, mail reports, removal of unused dependencies, bandwidth limits, update-day restrictions, and syslog output. A few options are especially relevant on remote servers:

Unattended-Upgrade::Automatic-Reboot "false";
Unattended-Upgrade::MailReport "only-on-error";
Unattended-Upgrade::SyslogEnable "true";

Only configure mail if the machine has a working mail transport. If you enable automatic rebooting, Debian's default behavior is significant: when Automatic-Reboot is true and /var/run/reboot-required exists, the host can reboot without confirmation. You can set Unattended-Upgrade::Automatic-Reboot-Time to schedule that reboot for a maintenance window.

For many production systems, leaving automatic reboot disabled is safer unless the service is redundant, maintenance windows are defined, and post-reboot health checks are automated.

4. Verify the systemd timers and run a dry test

On a normal systemd-based Debian installation, check the APT timers rather than looking for a made-up unattended-upgrades.timer unit:

systemctl status apt-daily.timer apt-daily-upgrade.timer
systemctl list-timers apt-daily.timer apt-daily-upgrade.timer

apt-daily.timer is associated with routine package download/index activity, while apt-daily-upgrade.timer triggers the upgrade/cleanup service path used by unattended upgrades.

Systemd terminal status for apt-daily.timer and apt-daily-upgrade.timer showing both active and waiting
Systemd timer status for APT daily work. The dates shown are illustrative; use systemctl list-timers for the actual next run on your host.

Next, test the policy without changing packages:

sudo unattended-upgrade --debug --dry-run

This is the most useful preflight check because it evaluates the real APT configuration and records debug details. Review the output for packages that would be selected or held back, unexpected third-party origins, dependency problems, and configuration-file prompts.

If the dry run selects nothing, that can be perfectly normal when the server is current. Confirm there are actually pending updates with apt list --upgradable, then compare their origins and policy against your configured patterns.

5. Monitor unattended upgrades and handle reboots deliberately

The package writes its main activity log and dpkg output under:

/var/log/unattended-upgrades/unattended-upgrades.log
/var/log/unattended-upgrades/unattended-upgrades-dpkg.log

Useful checks include:

sudo tail -n 100 /var/log/unattended-upgrades/unattended-upgrades.log
sudo journalctl -u apt-daily-upgrade.service --since "7 days ago"
test -f /var/run/reboot-required && cat /var/run/reboot-required

For a single home lab machine, reviewing logs periodically may be enough. For business systems, send failures to central monitoring or syslog so a silent repository error, full filesystem, broken dependency, or interrupted dpkg state does not persist unnoticed.

Reference settings for common server policies

ScenarioPolicyOperational note
Security-focused serverAllow Debian security and stable updates; keep reboot manualGood default when an outage is more costly than a delayed reboot
Stateless or redundant nodeAllow updates and scheduled automatic rebootPair with health checks and load-balancer draining
Kernel-sensitive applianceUse a package blacklist only with a documented exception processBlacklisting can leave known vulnerabilities unpatched
Server with vendor repositoryDo not allow the vendor origin until its update policy is reviewedCheck signing, support policy, and rollback expectations first

Troubleshooting quick reference

The timer is active but no packages are installed

Check whether there are pending upgrades, whether their repository origin matches your allowed policy, and whether a blacklist or dependency constraint is preventing selection. Run sudo unattended-upgrade --debug --dry-run for evidence rather than changing the policy at random.

The server waits on package configuration

unattended-upgrades is designed to avoid upgrades that would require unresolved dpkg configuration prompts. If a package is repeatedly held back, inspect the log and decide whether the configuration-file decision should be handled manually.

Updates never run after cloning a VM image

Confirm the timers are enabled and active, then inspect apt-config dump. Golden images often carry local APT fragments, masking, or policy overrides that differ from the package defaults.

You need to stop automatic upgrades

Use Debian's supported reconfiguration path:

sudo dpkg-reconfigure -plow unattended-upgrades

Disabling the package does not replace normal patch management; it simply returns responsibility to your manual or external orchestration process.

Final validation checklist

  • unattended-upgrades is installed from a trusted Debian repository.
  • APT periodic package-list refresh and unattended upgrade values are enabled.
  • Local policy is stored in a later override file such as 52unattended-upgrades-local.
  • Allowed origins were checked against apt-cache policy.
  • apt-daily.timer and apt-daily-upgrade.timer are active.
  • sudo unattended-upgrade --debug --dry-run completes without unexpected selections or errors.
  • Logs are monitored, and the reboot policy matches your maintenance model.
  • Major Debian release upgrades remain a separate planned procedure.

Official references

Use Debian's own documentation when validating behavior on a specific release:

Leave a Comment

How to Record Speaker Output on Linux with Audacity

How to Record Speaker Output on Linux with Audacity

Capture Linux desktop audio in Audacity by routing its recording stream to your output device’s monitor source. Follow PulseAudio and PipeWire steps, export tips, and fixes for silent tracks.

How to Use Dropbox on Linux: Install and Sync Your Files

How to Use Dropbox on Linux: Install and Sync Your Files

Install Dropbox on Linux from the official package, sign in, sync a local folder, manage selective sync, and check status from the command line.

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

Install Inkscape from your Linux distribution’s repositories, the Ubuntu stable PPA, Snap, or Flathub, with current commands and notes for choosing a package source.

How to Find and Remove Duplicate Files on Linux With FSlint

How to Find and Remove Duplicate Files on Linux With FSlint

Use FSlint to scan selected Linux folders, review duplicate groups, and safely delete redundant files or learn when hard-link merging is appropriate.

How to Install SABnzbd on Linux and Configure It

How to Install SABnzbd on Linux and Configure It

Install SABnzbd on Ubuntu or Debian, or run it in Docker on another Linux host. Then open the web interface and configure your provider and download folders.

How to Install the Paper GTK Theme on Linux

How to Install the Paper GTK Theme on Linux

Install the Paper GTK theme from supported Linux repositories, enable it for GTK apps in GNOME Tweaks, and see what the legacy theme can and cannot change.

How to Install and Set Up Plex on OpenMediaVault with Compose

How to Install and Set Up Plex on OpenMediaVault with Compose

The old OpenMediaVault Plex plugin is archived. Set up Plex on OMV 8 with OMV-Extras, the Compose plugin, persistent storage, and Plex’s official container.

How to Clean and Speed Up Ubuntu Safely

How to Clean and Speed Up Ubuntu Safely

Clean and speed up Ubuntu with safe APT cleanup, storage checks, and startup controls that help free space and troubleshoot a sluggish desktop.

How to Install the Hiri Email Client on Linux

How to Install the Hiri Email Client on Linux

Install Hiri on Linux with its Snap package or official tarball, add a desktop launcher, and check supported accounts plus a warning about Hiri’s old Snap release.

How to Get System Specifications for a Linux PC

How to Get System Specifications for a Linux PC

Use Fastfetch and built-in Linux commands to check your distro, kernel, CPU, memory, graphics, storage, and connected devices, then save a clear report.