duplicate "N packages can be updated." messages in motd

Bug #1146170 reported by Marius Gedminas on 2013-03-05
This bug affects 4 people
Affects Status Importance Assigned to Milestone
update-notifier (Ubuntu)

Bug Description

Lately I've been noticing that as I ssh into one particular server, I get duplicate messages about updates. Digging a bit deeper I see they come from /usr/lib/update-notifier/update-motd-updates-available:

    mg@fridge: ~ $ /usr/lib/update-notifier/update-motd-updates-available

    0 packages can be updated.
    0 updates are security updates.

    0 packages can be updated.
    0 updates are security updates.

    0 packages can be updated.
    0 updates are security updates.

Once I saw three messages with slightly different spacing (no blank line between 1st and 2nd, two blank lines between 2nd and 3rd). Yesterday I also saw a similar issue (two messages instead of one) on a different server (running Ubuntu 10.04).

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: update-notifier-common 0.119ubuntu8.6
ProcVersionSignature: Ubuntu 3.2.0-35.55-generic 3.2.34
Uname: Linux 3.2.0-35-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.1
Architecture: amd64
Date: Tue Mar 5 08:31:28 2013
MarkForUpload: True
PackageArchitecture: all
SourcePackage: update-notifier
UpgradeStatus: Upgraded to precise on 2012-07-31 (216 days ago)

Related branches

Marius Gedminas (mgedmin) wrote :
Marius Gedminas (mgedmin) wrote :

I looked at the script. It appears to be a simple race in case of simultaneous logins. Changing

    echo "" > $stamp
    /usr/lib/update-notifier/apt-check --human-readable >> $stamp
    echo "" >> $stamp


    { echo ""; /usr/lib/update-notifier/apt-check --human-readable; echo ""; } > $stamp

might be enough to make it go away.

Marius Gedminas (mgedmin) wrote :

I can easily reproduce this with

    rm /var/lib/update-notifier/updates-available; /usr/lib/update-notifier/update-motd-updates-available & /usr/lib/update-notifier/update-motd-updates-available

Marius Gedminas (mgedmin) wrote :

I'm not sure anybody noticed that I attached a bzr branch that fixes this.

(It's only been three days. No rush, but some acknowledgment would be nice.)

Marc Deslauriers (mdeslaur) wrote :

I'm subscribing ubuntu-sponsors to this bug so the patch gets sponsored.

Changed in update-notifier (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Marius Gedminas (mgedmin) wrote :

BTW 1240549 is a very similar bug in a different update-notifier's update-motd script. I can prepare a patch for it too, if you'd like it.

Iain Lane (laney) wrote :

Looks good to me, thanks. Merging & updating debian/changelog. It'll be in the next upload.

Sorry for the delay; next time, please subscribe ubuntu-sponsors to the bug to get more speedy attention. :-)

And yes, please feel free to patch the other bug. I'll not release this to trusty until that's done (or the next person can do so)

Changed in update-notifier (Ubuntu):
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

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

update-notifier (0.148) trusty; urgency=low

  [ Iain Lane ]
  * data/update-motd-updates-available: Update the stamp file atomically.
    Thanks to Marius Gedminas! (LP: #1146170)

  [ Brian Murray ]
  * In the upstart crash notification job fix the path for watershed.
  * debian/update-notifier-crash.conf: check that we have read permission on
    the crash file before launching apport-gtk, additionally just launch
    apport-gtk or system-crash-notification as they will check for new crashes
    and start bug filing for each one (LP: #1193509)
  * data/update-motd-fsck-at-reboot: Update the stamp file atomically.
    Thanks to Marius Gedminas! (LP: #1240549)
 -- Brian Murray <email address hidden> Fri, 08 Nov 2013 15:32:25 -0800

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

Other bug subscribers