GrepBoard/Manuals
605 manuals ·

How to check unattended-upgrades applied updates (Ubuntu 24.04)

·Tested on Ubuntu 24.04 (Docker) · unattended-upgrades 2.9.1+nmu4ubuntu1 · 2026-10·Test scope ↓·6 steps

After a USN is published, confirm the fix landed using the fixed version, apt-cache policy, a dry run and the logs, including a dry-run message that misleads.

To check that unattended-upgrades applied a security update on Ubuntu 24.04, compare the notice's fixed version with Installed in apt-cache policy, then look for the Unpacking … over … line in unattended-upgrades-dpkg.log. The All upgrades installed message from a dry run does not mean anything was installed.

A security notice (USN) is out and unattended-upgrades is enabled, but that does not prove the package has been fixed on your server. This walkthrough uses USN-8954-1 (zlib, 2026-10-22) as the example. The notice lists 1:1.3.dfsg-3.1ubuntu2.3 as the fixed version for 24.04 (notice).

[1] Check that it is on. 20auto-upgrades decides whether and how often it runs, and 50unattended-upgrades decides which repositories it takes packages from (Ubuntu Server docs). Dump the values apt actually uses instead of reading the files.

console
$ cat /etc/apt/apt.conf.d/20auto-upgrades$ apt-config dump | grep -E "APT::Periodic|Unattended-Upgrade::(Allowed|Automatic-Reboot)"
output
APT::Periodic::Update-Package-Lists "1";APT::Periodic::Unattended-Upgrade "1";APT::Periodic "";APT::Periodic::Update-Package-Lists "1";APT::Periodic::Unattended-Upgrade "1";APT::Periodic::Enable "0";Unattended-Upgrade::Allowed-Origins "";Unattended-Upgrade::Allowed-Origins:: "${distro_id}:${distro_codename}";Unattended-Upgrade::Allowed-Origins:: "${distro_id}:${distro_codename}-security";Unattended-Upgrade::Allowed-Origins:: "${distro_id}ESMApps:${distro_codename}-apps-security";Unattended-Upgrade::Allowed-Origins:: "${distro_id}ESM:${distro_codename}-infra-security";

Unattended-Upgrade "1" means once a day; 0 is off (values are in days). The allowed origins include noble-security but not noble-updates. A package in a security notice is installed on the next scheduled run after it lands in the security pocket (apt-daily.timer and apt-daily-upgrade.timer run once a day with a random delay, so not instantly), while ordinary fixes published only to -updates are not installed automatically. APT::Periodic::Enable "0" appeared in a Docker image that also had a docker-disable-periodic-update file in apt.conf.d; whether a regular server shows the same value was not checked.

[2] Compare the notice's fixed version with what is installed. If Installed sorts below the fixed version, the fix is not applied yet.

console
$ apt-cache policy zlib1g$ dpkg --compare-versions "$(dpkg-query -W -f='${Version}' zlib1g)" lt 1:1.3.dfsg-3.1ubuntu2.3 && echo "installed < USN-8954-1 fixed"
output
zlib1g:  Installed: 1:1.3.dfsg-3.1ubuntu2.2  Candidate: 1:1.3.dfsg-3.1ubuntu2.3  Version table:     1:1.3.dfsg-3.1ubuntu2.3 500        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages *** 1:1.3.dfsg-3.1ubuntu2.2 100        100 /var/lib/dpkg/status     1:1.3.dfsg-3.1ubuntu2 500        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packagesinstalled < USN-8954-1 fixed

Installed is .2 and Candidate is .3. The candidate equals the fixed version and comes from noble-security, so unattended-upgrades will pick it up. If Candidate is still lower, your package lists are stale: run sudo apt update first.

[3] Preview the run. --dry-run -d prints the plan without installing. The output is long, so filter it. Always run it with sudo: as a non-root user it prints only You need to be root to run this application, which the grep below does not match, so the empty output reads like "nothing to do" (confirmed in the container as a regular user).

console
$ sudo unattended-upgrade --dry-run -d 2>&1 | grep -E "Allowed origins|Packages that will be upgraded|Option --dry-run|All upgrades|No packages found"$ dpkg-query -W -f='${Package} ${Version}\n' zlib1g
output
Allowed origins are: o=Ubuntu,a=noble, o=Ubuntu,a=noble-security, o=UbuntuESMApps,a=noble-apps-security, o=UbuntuESM,a=noble-infra-securityOption --dry-run given, *not* performing real actionsPackages that will be upgraded: zlib1gAll upgrades installedzlib1g 1:1.3.dfsg-3.1ubuntu2.2

Packages that will be upgraded: zlib1g is the plan. The trap is the next line: the dry run prints All upgrades installed, yet nothing was installed, and dpkg-query still says .2. Do not read that line as proof.

[4] To apply now, run unattended-upgrade yourself. If the package is a library your services use, plan a restart too, so pick a quiet time (find processes that need a restart).

console
$ sudo unattended-upgrade -d >/dev/null 2>&1; echo rc=$?$ dpkg-query -W -f='${Package} ${Version}\n' zlib1g
output
rc=0zlib1g 1:1.3.dfsg-3.1ubuntu2.3

Rolling back is not recommended. Once the upgrade is done the repositories no longer carry the previous .2 build (only .3 and the release 1:1.3.dfsg-3.1ubuntu2 remain), so sudo apt install zlib1g=1:1.3.dfsg-3.1ubuntu2.2 failed in the container with E: Version '1:1.3.dfsg-3.1ubuntu2.2' for 'zlib1g' was not found (rc=100). It only works if the old .deb is still in /var/cache/apt/archives, and downgrading zlib1g, a library many packages depend on, to a pre-fix build is risky anyway. If something breaks after the upgrade, restart only the affected service and check its logs for the cause.

[5] The history lives in two logs under /var/log/unattended-upgrades/.

console
$ ls /var/log/unattended-upgrades/$ grep -E "Packages that will be upgraded|All upgrades installed|Option --dry-run" /var/log/unattended-upgrades/unattended-upgrades.log | cut -d" " -f1,3-$ grep -E "^(Unpacking|Setting up)" /var/log/unattended-upgrades/unattended-upgrades-dpkg.log
output
unattended-upgrades-dpkg.logunattended-upgrades.log2026-10-25 INFO Option --dry-run given, *not* performing real actions2026-10-25 INFO Packages that will be upgraded: zlib1g2026-10-25 INFO All upgrades installed2026-10-25 INFO Packages that will be upgraded: zlib1g2026-10-25 INFO All upgrades installedUnpacking zlib1g:amd64 (1:1.3.dfsg-3.1ubuntu2.3) over (1:1.3.dfsg-3.1ubuntu2.2) ...Setting up zlib1g:amd64 (1:1.3.dfsg-3.1ubuntu2.3) ...

Dry runs are logged in the same format. The All upgrades installed right under Option --dry-run is the dry run; the following pair is the real run. Whether anything was installed is shown by the Unpacking … over … line in unattended-upgrades-dpkg.log. No such line means no installation.

[6] Finally, confirm nothing is left. The upgradable list should be empty and the dry run should find nothing to do. The first changelog line should be the notice's fixed version.

console
$ apt list --upgradable 2>/dev/null$ sudo unattended-upgrade --dry-run -d 2>&1 | grep -E "No packages found|Packages that will be upgraded"$ zcat /usr/share/doc/zlib1g/changelog.Debian.gz | sed -n 1,3p
output
Listing...No packages found that can be upgraded unattended and no pending auto-removalszlib (1:1.3.dfsg-3.1ubuntu2.3) noble-security; urgency=medium   * SECURITY UPDATE: heap buffer overflow in gz_vacate() during non-blocking

Where checks get confusing

  • The dry run's All upgrades installed is not a completion message. Judge by the installed version and -dpkg.log.
  • If apt list --upgradable still lists a package while the dry run says No packages found…, the package is likely in -updates only or outside the allowed origins. A held package (apt-mark showhold), a Package-Blacklist entry, or an upgrade that needs new packages or removals can look the same, so check those too. No such package turned up in this test, so it was not reproduced.
  • Kernel cleanup, automatic reboot (Unattended-Upgrade::Automatic-Reboot, default false per the official docs) and timer behavior (apt-daily.timer, apt-daily-upgrade.timer) are quoted from the docs and were not tested.

#unattended-upgrades#ubuntu-2404#apt#usn