Update notifier keeps popping up even when there is nothing to do

Bug #2008212 reported by FM33
38
This bug affects 6 people
Affects Status Importance Assigned to Milestone
update-notifier (Ubuntu)
Fix Released
Undecided
Renan Rodrigo
Xenial
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned

Bug Description

[ Impact ]

Update-notifier will trigger unnecessarily on systems where phased updates are considered in the Update Manager GUI but not considered in apt itself (for LTSs, Focal or earlier). If only the phased updates are available to a system, the dialog box will pop up, but it says that the system is up to date.

This happens because a recent SRU unintentionally broke the logic that treated this situations in the code. To avoid showing those packages, update-notifier needs access to the system apt Cache, but global side-effects of the apt + apt_pkg module interaction ended up providing the wrong Cache to verify phasing.

The fix for this is to isolate the esm Cache creation, restoring the default apt_pkg configuration after the instance is created, guaranteeing that any other Cache calls have access to the system data.

[ Test Plan ]

Besides testing the bugfix, it is important to test the functionality which changed this code in the first place, which was implemented to keep visibility to esm updates.

To reproduce the bug:
- Start a Focal machine
- Run `apt update`, verify which packages updates are phased (using apt show, for instance, will show a Phased-Update-Percentage metadata key)
- If there is no phased update happening, downgrade a package and fake phasing by editing the /var/lib/apt/lists file
- Install universe packages which have a esm-apps update (ansible is a good candidate)
- Run `/usr/lib/update-notifier/apt-check --human-readable` and see the esm-apps update(s) listed.
- Run `/usr/lib/update-notifier/apt-check -p` and see the phased packages are listed.

To verify the fix:
- Install a version which contains this patch
- Run `/usr/lib/update-notifier/apt-check --human-readable` and see the esm-apps update(s) listed.
- Run `/usr/lib/update-notifier/apt-check -p` and see the phased packages are not listed.

[ Where problems could occur ]

If the function implemented for the fix has any flaw, then esm-apps updates will not show anymore, as they depend on the esm Cache. It is important to verify the esm-apps updates are exactly the same after the fix is applied, as described in the test plan above.

Any other call to any apt Cache functionality outside of this specific function should use the system defaults, which are restored by erasing the configuration and letting apt_pkg initialize it again, assuming safety.

The only known caveat is that the new function should be the only way to access the esm-cache; future instances should only be creating using the function, and never directly.

[ Original Description ]

Dialog "System is up to date" keeps popping up several times per session, even when there is no updates available and no reboot is required. Started a few weeks ago.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: update-notifier 3.192.30.16
ProcVersionSignature: Ubuntu 5.15.0-60.66~20.04.1-generic 5.15.78
Uname: Linux 5.15.0-60-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.25
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Thu Feb 23 10:09:59 2023
InstallationDate: Installed on 2020-10-24 (851 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=fr_FR.UTF-8
 SHELL=/bin/bash
SourcePackage: update-notifier
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
FM33 (fm33) wrote :
Revision history for this message
Michael Leetz (michael-leetz) wrote :

I can confirm this bug. I also use Ubuntu 20.04. I noticed, that it happens every time, when apt has an update, that isn't visible through the graphical frontend updater. If this is the case, the update notifier pops up with the message "System is up to date". If I than do "sudo apt update", apt shows me, that there is an update available. If I install this "invisible" update, the update notifier is calm again, e.g. the message "System is up to date" disappears.
This problem started after the introduction of Ubuntu Pro. It must have something to do with it.
Please, fix this bug.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in update-notifier (Ubuntu):
status: New → Confirmed
Steve Langasek (vorlon)
tags: added: regression-update
Changed in update-notifier (Ubuntu):
assignee: nobody → Renan Rodrigo (renanrodrigo)
Changed in update-notifier (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Renan Rodrigo (renanrodrigo) wrote (last edit ):

This is not directly related to Ubuntu Pro.

Those 'invisible' updates are actually phased updates.
Update notifier is right to poke because there are updates, but it does not show it because those updates are phased for the GUI.
There is logic to prevent that in the code and it was working before, so I can confirm this is a regression.

I am working on it.

Revision history for this message
Michael Leetz (michael-leetz) wrote :

Thank you very much for your answer and your effort, to solve this problem.

description: updated
description: updated
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-notifier - 3.192.63

---------------
update-notifier (3.192.63) lunar; urgency=medium

  * Isolate creation of the esm apt cache in apt-check (LP: #2008212)

 -- Renan Rodrigo Barbosa <email address hidden> Mon, 27 Feb 2023 23:15:02 -0300

Changed in update-notifier (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Kodiak Firesmith (kfiresmith-whoi) wrote :

So this change/fix actually seems to inadvertently fix #2007311. All along I thought it was a problem with upstream cache being broken, but I could definitely see it being plausible that phased updates could cause this same weird behavior.

Anyone who writes anything that depends on apt-check may be in for nasty surprises when apt-check breaks and returns bad data instead of predictably formatted pairs of integers.

Example:
 /usr/lib/update-notifier/apt-check
E: Unknown Error: '<class 'KeyError'>' ("The cache has no package named 'libxmlb2:amd64'")

/usr/lib/update-notifier/apt-check --human-readable
E: Unknown Error: '<class 'KeyError'>' ("The cache has no package named 'libxmlb2:amd64'")

Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

Interesting! It's rare to see a side-effect fix instead of a side-effect bug :|
Thanks for checking it.

There are plans to review all those cache-based scripts across packages in the near future, so this kind of error gets more and more under control.

Revision history for this message
Kodiak Firesmith (kfiresmith-whoi) wrote :

Fantastic - hoping that your minor change to fix apt-check breezes through review and gets released for Focal and Jammy ASAP.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in update-notifier (Ubuntu Bionic):
status: New → Confirmed
Changed in update-notifier (Ubuntu Focal):
status: New → Confirmed
Changed in update-notifier (Ubuntu Jammy):
status: New → Confirmed
Changed in update-notifier (Ubuntu Xenial):
status: New → Confirmed
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello FM33, or anyone else affected,

Accepted update-notifier into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/update-notifier/3.192.54.6 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in update-notifier (Ubuntu Jammy):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-jammy
Changed in update-notifier (Ubuntu Focal):
status: Confirmed → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello FM33, or anyone else affected,

Accepted update-notifier into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/update-notifier/3.192.30.17 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in update-notifier (Ubuntu Bionic):
status: Confirmed → Fix Committed
tags: added: verification-needed-bionic
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello FM33, or anyone else affected,

Accepted update-notifier into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/update-notifier/3.192.1.19 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in update-notifier (Ubuntu Xenial):
status: Confirmed → Fix Committed
tags: added: verification-needed-xenial
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello FM33, or anyone else affected,

Accepted update-notifier into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/update-notifier/3.168.20 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Kodiak Firesmith (kfiresmith-whoi) wrote :

Tested and confirmed on Focal server to fix my issue.

I don't currently have a misbehaving Jammy server to test on but I have no reason to believe that this fix wouldn't work the same way on Jammy, since I was using a local copy from the ubuntu/devel tree earlier this week on a broken Jammy system (which has since been fixed, so I can't re-test...)

Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

Verification for focal:

apt show python3-software-properties 2>&1 | grep Phase
Phased-Update-Percentage: 0

# Currently installed version:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.192.30.16
  Candidate: 3.192.30.17

/usr/lib/update-notifier/apt-check -p 2>&1 | grep python
python3-software-properties

# after upgrade to -proposed:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.192.30.17
  Candidate: 3.192.30.17

/usr/lib/update-notifier/apt-check -p 2>&1 | grep python
#

# phased out python3-software-properties not listed

Behavior consistent with the test plan.

tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

Verification for bionic:

apt-cache policy python3.6
python3.6:
  Installed: 3.6.9-1~18.04ubuntu1.9
  Candidate: 3.6.9-1~18.04ubuntu1.10
  (...)

I've decided to fake "phased updates" for python3.6.

apt show python3.6 2>&1 | grep Phased
Phased-Update-Percentage: 0

/usr/lib/update-notifier/apt-check -p 2>&1 | grep -w python3.6
python3.6
python3.6-minimal

After upgrading to -proposed the Phased-Update-Percentage packages are still listed.

I will be looking into this. Maybe I am doing something incorrectly with "faking" the phased status.

I just added the "Phased-Update-Percentage: 0" line to python3.6 entries in archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-amd64_Packages and security.ubuntu.com_ubuntu_dists_bionic-security_main_binary-amd64_Packages

Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

(reusing the template from above)

Verification for xenial:

apt show ubuntu-advantage-tools 2>&1 | grep Phase
Phased-Update-Percentage: 10

# Currently installed version:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.168.19
  Candidate: 3.168.20

/usr/lib/update-notifier/apt-check -p 2>&1 | grep advantage
ubuntu-advantage-tools

# after upgrade to -proposed:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.168.20
  Candidate: 3.168.20

/usr/lib/update-notifier/apt-check -p 2>&1 | grep advantage
#

# phased out ubuntu-advantage-tools not listed

Behavior consistent with the test plan.

tags: added: verification-done-xenial
removed: verification-needed-xenial
Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

I am observing behavior similar to bionic on jammy. I am looking into the whole "faking" process to compare if it's consistent with what I observed on focal with actual phased updates.

Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

I tried the same here - it seems just a matter of choice of package;
python3.6 is a security update, and those are never phased, so even forcing it won't work.

I simulated it with `parted` (from proposed) and I see it works on Bionic.

Verification for bionic:

apt show parted 2>&1 | grep Phase
Phased-Update-Percentage: 0

# Currently installed version:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.192.1.18
  Candidate: 3.192.1.19

/usr/lib/update-notifier/apt-check -p 2>&1 | grep parted
libparted2
parted

# after upgrade to -proposed:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.192.1.19
  Candidate: 3.192.1.19

/usr/lib/update-notifier/apt-check -p 2>&1 | grep advantage
libparted2
#

# phased out parted not listed

Behavior consistent with the test plan.

tags: added: verification-done-bionic
removed: verification-needed-bionic
Revision history for this message
Renan Rodrigo (renanrodrigo) wrote :

Verification for jammy:
As mentioned in the bug description, this bug happens on focal and earlier.
On Jammt, apt already has the phasing implemented, and update-notifier will not fail even with the bug being present.

apt show apt 2>&1 | grep Phase
# nothing faked yet

/usr/lib/update-notifier/apt-check -p 2>&1 | grep apt
apt
libapt-pkg6.0
apt-utils

(Faking phasing on -proposed apt package)

apt show apt 2>&1 | grep Phase
Phased-Update-Percentage: 0

# Currently installed version:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.192.54.5
  Candidate: 3.192.54.6

/usr/lib/update-notifier/apt-check -p 2>&1 | grep apt
libapt-pkg6.0

# after upgrade to -proposed:
apt-cache policy update-notifier-common | head -n 3
update-notifier-common:
  Installed: 3.192.54.6
  Candidate: 3.192.54.6

/usr/lib/update-notifier/apt-check -p 2>&1 | grep apt
libapt-pkg6.0
#

# same behavior, was respecting the phasing even before.

tags: added: verification-done verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

Thanks for explaining Renan, it makes sense and I can confirm results as expected after switching to a package outside of -security.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-notifier - 3.192.54.6

---------------
update-notifier (3.192.54.6) jammy; urgency=medium

  * Isolate creation of the esm apt cache in apt-check (LP: #2008212)

 -- Renan Rodrigo Barbosa <email address hidden> Mon, 27 Feb 2023 23:15:02 -0300

Changed in update-notifier (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for update-notifier has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-notifier - 3.192.30.17

---------------
update-notifier (3.192.30.17) focal; urgency=medium

  * Isolate creation of the esm apt cache in apt-check (LP: #2008212)

 -- Renan Rodrigo Barbosa <email address hidden> Mon, 27 Feb 2023 23:15:02 -0300

Changed in update-notifier (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-notifier - 3.192.1.19

---------------
update-notifier (3.192.1.19) bionic; urgency=medium

  * Isolate creation of the esm apt cache in apt-check (LP: #2008212)

 -- Renan Rodrigo Barbosa <email address hidden> Mon, 27 Feb 2023 23:15:02 -0300

Changed in update-notifier (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-notifier - 3.168.20

---------------
update-notifier (3.168.20) xenial; urgency=medium

  * Isolate creation of the esm apt cache in apt-check (LP: #2008212)

 -- Renan Rodrigo Barbosa <email address hidden> Mon, 27 Feb 2023 23:15:02 -0300

Changed in update-notifier (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.