Public bug reported: # apt-check incorrectly reports ESM Apps security updates when the installed package version is newer than the ESM version
**Affected package:** update-notifier-common **Package version:** 3.207.2 **Source package:** update-notifier **Ubuntu version:** Ubuntu 26.04.1 LTS (resolute), amd64 **Affected file:** /usr/lib/update-notifier/apt-check **Affected function:** has_disabled_esm_security_update() ## Description The login MOTD incorrectly reports that an additional security update is available through ESM Apps, even though the installed package version is newer than the version available in the ESM repository. In this particular case, Caddy is installed from the official Caddy APT repository rather than from the Ubuntu repository. The relevant package versions are: - Installed version: `2.11.9` - Candidate version from the official Caddy repository: `2.11.9` - Version in the Ubuntu ESM Apps security repository: `2.6.2-14ubuntu0.26.04.1~esm1` Running `sudo apt update` confirms that all packages are up to date, and `sudo apt upgrade` reports no available upgrades. However, running: ``` sudo /usr/lib/update-notifier/apt-check --human-readable ``` produces the following output: ``` Expanded Security Maintenance for Applications is not enabled. 0 updates can be applied immediately. 1 additional security update can be applied with ESM Apps. Learn more about enabling ESM Apps service at https://ubuntu.com/esm ``` A comparison of the installed packages against the locally cached ESM package lists confirms that Caddy is the only installed package present in the ESM repositories. The following command was used to establish this: ```bash export LC_ALL=C comm -12 \ <(dpkg-query -W -f='${Package}\n' | sort -u) \ <(sudo grep -h '^Package: ' \ /var/lib/ubuntu-advantage/apt-esm/var/lib/apt/lists/*Packages \ | cut -d' ' -f2 | sort -u) ``` The output is: ``` caddy ``` ## Root cause The problem is in the function `has_disabled_esm_security_update()` in `/usr/lib/update-notifier/apt-check`. The current implementation is: ```python def has_disabled_esm_security_update(esm_cache, pkg, esm_origin): " check if we have a disabled ESM security update " inst_ver = pkg.current_ver if not inst_ver: return False if pkg.name not in esm_cache: return False esm_update = esm_cache[pkg.name] for version in esm_update.version_list: for (file, index) in version.file_list: if file.origin == esm_origin: return True return False ``` The function checks whether a package is installed and whether a version of that package exists in the ESM repository. However, it does not compare the installed version with the ESM version. The variable `inst_ver` is used only to determine whether the package is installed. Consequently, an ESM package version that is older than or equal to the installed version can incorrectly be counted as an available security update. This particularly affects systems where packages are installed from third-party repositories that provide newer versions than those available in the Ubuntu repositories. ## Steps to reproduce 1. Use an Ubuntu LTS system with ESM Apps disabled. 2. Install a package from a third-party APT repository, where the installed version is newer than the corresponding version available in the ESM Apps repository. 3. Run `sudo apt update` to refresh the package metadata. 4. Run `sudo /usr/lib/update-notifier/apt-check --human-readable`. 5. Observe that the package is incorrectly counted as an available ESM Apps security update. ## Expected behaviour An ESM package should only be counted as an available security update if its version is newer than the currently installed version, according to Debian package version comparison rules. An ESM package version that is older than or equal to the installed version should not contribute to the number of available security updates. ## Actual behaviour An ESM security update is reported even when the installed package version is newer than the version available through ESM. This results in a misleading notification in the login MOTD, suggesting that enabling ESM Apps would make an additional security update available. ## Suggested fix Add a version comparison using `apt_pkg.version_compare()` before checking the package origin. The modified function would be: ```python def has_disabled_esm_security_update(esm_cache, pkg, esm_origin): " check if we have a disabled ESM security update " inst_ver = pkg.current_ver if not inst_ver: return False if pkg.name not in esm_cache: return False esm_update = esm_cache[pkg.name] for version in esm_update.version_list: if apt_pkg.version_compare(version.ver_str, inst_ver.ver_str) <= 0: continue for (file, index) in version.file_list: if file.origin == esm_origin: return True return False ``` This should prevent ESM package versions that are older than or equal to the installed version from being incorrectly counted as available security updates. Since the function is shared by the ESM Apps and ESM Infra checks, the proposed correction would address the same potential issue for both services. The proposed correction has not been tested. ProblemType: Bug DistroRelease: Ubuntu 26.04 Package: update-notifier 3.207.2 ProcVersionSignature: Ubuntu 7.0.0-44.44-generic 7.0.14 Uname: Linux 7.0.0-44-generic x86_64 ApportVersion: 2.34.1-0ubuntu0.1 Architecture: amd64 CasperMD5CheckResult: pass Date: Fri Nov 27 15:01:00 2026 InstallationDate: Installed on 2026-09-24 (64 days ago) InstallationMedia: Ubuntu 26.04.1 LTS "Resolute Raccoon" - Release amd64 (20260826) ProcEnviron: LANG=en_US.UTF-8 PATH=(custom, no user) SHELL=/bin/bash TERM=xterm-256color XDG_RUNTIME_DIR=<set> SourcePackage: update-notifier UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: update-notifier (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug resolute -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2178223 Title: apt-check incorrectly reports ESM Apps security updates when the installed package version is newer than the ESM version To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/2178223/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
