update-notifier updates-available does not reset after dpkg run

Bug #1563854 reported by Stefan Bader on 2016-03-30
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu on IBM z Systems
Low
Unassigned
update-notifier (Ubuntu)
High
Unassigned

Bug Description

From /etc/apt/apt.conf.d/99update-notifier the script /usr/lib/update-notifier/update-motd-updates-available is started on a successful "apt-get update" run. It will update /var/lib/update-notifier/updates-available with the number of new packages that are installable (and this is inserted into the dynamic motd which is shown on every login).

In the past /var/lib/update-notifier/updates-available was replaced by an empty line from the Dpkg::post-invoke hook. This is missing in Xenial, so motd will incorrectly claim to have installable packages until there are again new ones after a updating the apt cache.

Delta in /etc/apt/apt.conf.d/99update-notifier:
-DPkg::Post-Invoke {"if [ -d /var/lib/update-notifier ]; then touch /var/lib/update-notifier/dpkg-run-stamp; fi; if [ -e /var/lib/update-notifier/updates-available ]; then echo > /var/lib/update-notifier/updates-available; fi "; };
+DPkg::Post-Invoke {"if [ -d /var/lib/update-notifier ]; then touch /var/lib/update-notifier/dpkg-run-stamp; fi";};
+APT::Update::Post-Invoke-Success {"/usr/lib/update-notifier/update-motd-updates-available 2>/dev/null || true";};

It looks like before the file was re-created by update-motd on every login. And maybe while moving this to post-apt-get-update the reset was dropped.

Related branches

Launchpad Janitor (janitor) wrote :

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

Changed in update-notifier (Ubuntu):
status: New → Confirmed
Changed in update-notifier (Ubuntu):
importance: Undecided → High
Launchpad Janitor (janitor) wrote :

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

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

  * Use mktemp -p in the target directory to avoid a cross-filesystem move.
  * Also update motd if the dpkg status database has changed (LP: #1563854)

 -- Adam Conrad <email address hidden> Mon, 04 Apr 2016 15:22:20 -0600

Changed in update-notifier (Ubuntu):
status: Confirmed → Fix Released
Stefan Bader (smb) wrote :

Hm, I would call it half-fixed. While doing a dist-upgrade does not reset it, its at least reset now when doing another apt-get update after upgrading.

dann frazier (dannf) on 2016-04-08
Changed in ubuntu-z-systems:
status: New → Fix Released
importance: Undecided → Low
Dimitri John Ledkov (xnox) wrote :

I think we need the below patch too. Hopefully this will not stall $ apt dist-upgrade, and still accurately show e.g. that 99 updates left after only one package was installed, which also happens to be part of 100 updates.

no!chance (ralf-fehlau) wrote :

This bug exists in Ubuntu 16.04, too!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers