Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

unattended-upgrades not installing updates: find out why packages stay pending

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

If a Debian or Ubuntu server shows pending updates that automatic updates never install, the tool may be running but ignoring the packages. Six causes to check are the periodic switches set to 0, the apt timers not enabled, the package's repository missing from the allowed origins, a blacklist match, a package kept back because it needs a new dependency, or another apt or dpkg process holding the lock. The log in /var/log/unattended-upgrades/ and a dry run (unattended-upgrade -v --dry-run) show which one applies.

What the symptom means

The unattended-upgrade(8) manual page describes the program as one that can "download and install security upgrades automatically and unattended, taking care to only install packages from the configured APT source". It is "the backend for the APT::Periodic::Unattended-Upgrade option" and is "designed to be run periodically by APT's systemd service (apt-daily-upgrade.service) or from cron". It logs to /var/log/unattended-upgrades/unattended-upgrades.log, and the dpkg output goes to /var/log/unattended-upgrades/unattended-upgrades-dpkg.log.

Ubuntu's documentation says unattended upgrades "performs the equivalent of apt update and apt upgrade". Two steps are controlled separately in /etc/apt/apt.conf.d/20auto-upgrades: APT::Periodic::Update-Package-Lists refreshes the package lists, and APT::Periodic::Unattended-Upgrade runs the upgrade. Systemd timers, apt-daily.timer and apt-daily-upgrade.timer, trigger these actions at a scheduled time with a random delay.

Only packages from allowed repositories are upgraded. Ubuntu's documentation warns: "Just adding another package repository to an Ubuntu system WILL NOT make unattended-upgrades consider it for updates!" By default it ships with official Ubuntu repositories only. The comments in the upstream Debian template file (tag 2.9.1, the release in Debian bookworm) say the same in different words: the values in a package's metadata must match "all the supplied keywords in a line".

Finally, apt-get upgrade never installs packages that are not already installed. The apt-get manual says "New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version." Those packages stay pending at their current version, which is what the heading "Kept-back packages" below means.

Likely causes

Cause What you see How to confirm
Periodic switches are 0 or missing No log entries at all, or the log is old apt-config dump shows APT::Periodic::Unattended-Upgrade as 0 or absent
apt timers not enabled or not scheduled No run since the last reboot systemctl list-timers 'apt-daily*' shows no next run; systemctl is-enabled does not print enabled
Repository not in the allowed origins Updates from a vendor or PPA repository stay pending while security updates install The dry-run log line "Allowed origins are:" lacks the repository's Origin
Package matches the blacklist One package or a family such as linux- never updates A Package-Blacklist entry matches; the dry-run log shows an initial blacklist
Package kept back The package is upgradable by hand only with extra packages apt-get --simulate upgrade leaves it at its current version; apt-mark showhold is empty or lists it
Another apt or dpkg process holds the lock The log reports a lock problem Follow "Could not get lock /var/lib/dpkg/lock-frontend": find the process holding it

Prove the cause before changing anything

Every command in this section only reads or simulates. Run them as root or with sudo.

1. Are the periodic switches on?

apt-config dump | grep -E 'APT::Periodic|Unattended-Upgrade'

The apt-config manual describes dump as "Just show the contents of the configuration space." A good result shows APT::Periodic::Update-Package-Lists "1" and APT::Periodic::Unattended-Upgrade "1". A bad result shows "0", or no Unattended-Upgrade line at all.

2. Do the timers run?

systemctl list-timers 'apt-daily*'
systemctl is-enabled apt-daily.timer apt-daily-upgrade.timer

The systemctl manual says list-timers shows "the next time the timer will run" and the last time it ran. A good result lists both timers with a next and a last run time. A bad result lists no timer, or is-enabled prints disabled or masked.

3. What did the last run say?

tail -n 60 /var/log/unattended-upgrades/unattended-upgrades.log
journalctl -u apt-daily-upgrade.service

The journalctl manual documents -u to show messages for a systemd unit. Look for "Allowed origins are:", a package list, and any error line.

4. Dry run.

sudo unattended-upgrade -v --dry-run

The manual says --dry-run will "Just simulate installing updates, do not actually do it", and -v shows verbose output. Ubuntu's documentation shows this form and notes that "The list of kept packages can't be calculated in dry-run mode." Read the "Allowed origins are:" and "Packages that will be upgraded:" lines. A repository missing from the first line is cause three.

5. Kept-back packages.

apt-get --simulate upgrade
apt-mark showhold

The apt-get manual describes --simulate as "No action; perform a simulation of events". The apt-mark manual says showhold prints "a list of packages on hold". An upgradable package that the simulation leaves at its current version, and that is absent from showhold, is cause five. A package in showhold has been held deliberately.

6. Read the Origin of the missing repository.

grep -E '^(Origin|Suite|Codename):' /var/lib/apt/lists/*InRelease

Ubuntu's documentation says the correct Origin value is in the repository's InRelease file, found locally in /var/lib/apt/lists/ after apt update. The Debian template adds that apt-cache policy prints the values available on the system.

Fix

Switch the periodic options on

First check whether the file exists:

ls -l /etc/apt/apt.conf.d/20auto-upgrades

If it exists, save it:

cp -p /etc/apt/apt.conf.d/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades.2026-11-22

If ls reports that the file does not exist, there is nothing to save. The edit below then creates the file, and the undo for that case is to delete that one file.

Risk: the next edit turns on automatic package upgrades for the whole server. Updates then install at night without anyone watching, and a package that needs a manual step afterwards, as Ubuntu's documentation notes some applications do, will be upgraded anyway.

Edit (or create) /etc/apt/apt.conf.d/20auto-upgrades so that it contains these two lines, as Ubuntu documents. If the file already has them with another value, set the value to "1", and leave any other lines as they are:

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

To undo it, when you saved a copy: the next command restores the copy only if it exists, then checks the setting.

ls -l /etc/apt/apt.conf.d/20auto-upgrades.2026-11-22 && cp -p /etc/apt/apt.conf.d/20auto-upgrades.2026-11-22 /etc/apt/apt.conf.d/20auto-upgrades
apt-config dump | grep APT::Periodic

To undo it, when the file did not exist before: delete only the file you created, with its own command, then check the setting.

rm /etc/apt/apt.conf.d/20auto-upgrades

Then run apt-config dump | grep APT::Periodic to confirm.

Enable the timers

First save the current state to a file:

systemctl is-enabled apt-daily.timer apt-daily-upgrade.timer > /root/apt-timers-state.2026-11-22

Disruptive step: the next command enables both timers and starts them now, so automatic updates will run at their next scheduled time.

The systemctl manual says enable combined with --now also starts the units. It also says "Using enable on masked units is not supported and results in an error", so if is-enabled printed masked, this command will not fix that case; unmasking is a separate change that is not covered here.

systemctl enable --now apt-daily.timer apt-daily-upgrade.timer

To back out: read /root/apt-timers-state.2026-11-22. Only for a timer whose line says disabled, run systemctl disable --now with that timer's name, which also stops it. For example, if the first line says disabled:

systemctl disable --now apt-daily.timer

A timer saved as enabled that was not running is left running by this undo, because enable --now started it; if you want the old state, stop it with systemctl stop and its name. Then run systemctl is-enabled apt-daily.timer apt-daily-upgrade.timer again and confirm it matches the saved file.

Allow the repository or release the package

First save the current file:

cp -p /etc/apt/apt.conf.d/50unattended-upgrades /etc/apt/apt.conf.d/50unattended-upgrades.2026-11-22

Risk: the next edit lets the server install updates from an extra repository, or from a package you had blocked, without anyone approving each one. A third-party package can restart a service or change its configuration during the night.

Open the file. On Ubuntu, add the repository's Origin and Suite to the Allowed-Origins block in the form "Origin:Suite";, as Ubuntu shows for a PPA. On Debian, the upstream template uses Origins-Pattern lines such as "origin=Debian,codename=${distro_codename},label=Debian-Security";. Every keyword on a line must match. To release a blocked package, remove or comment out the matching line in Package-Blacklist. Entries there are Python regular expressions: "linux-"; blocks every package starting linux-, and "libc6$"; blocks only that name. Then run the dry run again and check that the origin or package now appears:

sudo unattended-upgrade -v --dry-run

To undo it: restore the saved file under its original name, then run the dry run again.

ls -l /etc/apt/apt.conf.d/50unattended-upgrades.2026-11-22 && cp -p /etc/apt/apt.conf.d/50unattended-upgrades.2026-11-22 /etc/apt/apt.conf.d/50unattended-upgrades
sudo unattended-upgrade -v --dry-run

Kept-back packages

The apt-get manual describes the --with-new-pkgs option as one that lets upgrade "install the new dependencies" instead of holding the package back. The upstream template has a related setting, Allow-APT-Mark-Fallback, which tries to adjust related packages' candidates so a package can be upgraded. The template says the fallback is enabled by default except on Debian's sid release, and the line in the file is commented out. A kept-back package changes other packages when it moves, so it needs a change of its own, with the simulated output from check 5 attached for the change owner. No install command for it is given here. If apt-mark showhold listed the package, someone held it on purpose; ask them before it is changed.

Example (illustrative): web01 runs Ubuntu 24.04. Security updates install every night, but the examplesvc package from a vendor repository has been pending for weeks. apt-config dump shows both periodic switches at "1", both timers are listed with a next run, and the log shows a successful run. The dry run prints "Allowed origins are:" with the four official Ubuntu entries and no entry for the vendor. grep on the InRelease file shows Origin: ExampleVendor and Suite: stable. The engineer saves 50unattended-upgrades, adds "ExampleVendor:stable"; to Allowed-Origins, and runs the dry run again. The line now lists the vendor and "Packages that will be upgraded:" includes examplesvc.

Confirm the fix

  1. sudo unattended-upgrade -v --dry-run lists the package under "Packages that will be upgraded:".
  2. After the next scheduled run, /var/log/unattended-upgrades/unattended-upgrades.log shows the package installed and the dpkg log shows no error.
  3. apt-get --simulate upgrade no longer leaves the package at its current version.

What to watch afterwards

  • The template's Unattended-Upgrade::Mail option sends a report to an address. The template says no email is sent if it is empty or unset, and that a package providing mailx must be installed.
  • Ubuntu's documentation gives the default of Automatic-Reboot as false, so a pending reboot waits for you, and its log excerpt shows unattended-upgrades looking for /var/run/reboot-required. Checking that path after updates is our own advice.
  • Re-read the origin lines after every release upgrade. Lines that name a fixed suite can silently match a different release after an upgrade, so read each origin line again; lines that use ${distro_codename} take the installed release's codename. The upstream template says codename matching "will follow the migration of a release" and that suite-based matching "will silently match a different release".

Risks and limits

  • These commands have not been run or lab-tested.
  • Debian and Ubuntu ship different default files, and the upstream template at tag 2.9.1 can differ from the file installed on a given release. Compare the file on the host before copying a line.
  • Ubuntu's page documents Allowed-Origins; the Debian template uses Origins-Pattern. Use the one your file already contains.

Sources

  • unattended-upgrade(8) — Debian Manpages, bookworm, page dated March 1, 2019 (source updated 2022-12-31), accessed 22 November 2026
  • 50unattended-upgrades.Debian (upstream template, tag 2.9.1) — unattended-upgrades project, tag 2.9.1, no date shown, accessed 22 November 2026
  • Automatic updates — Ubuntu Server documentation, Last updated on Jul 15, 2026, accessed 22 November 2026
  • apt-get(8) — Debian Manpages, bookworm, source updated 2023-05-25, accessed 22 November 2026
  • apt-config(8) — Debian Manpages, bookworm, source updated 2023-05-25, accessed 22 November 2026
  • apt-mark(8) — Debian Manpages, bookworm, source updated 2023-05-25, accessed 22 November 2026
  • systemctl(1) — Debian Manpages, bookworm, source updated 2025-03-06, accessed 22 November 2026
  • journalctl(1) — Debian Manpages, bookworm, source updated 2025-03-06, accessed 22 November 2026