motd not updating

Bug #766827 reported by Graham Crumb
142
This bug affects 27 people
Affects Status Importance Assigned to Milestone
update-motd (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Following recent updates, the /var/run/motd file is being updated properly, but the data contained within is not. This refers specifically to the data udpated by the following scripts:

/usr/lib/update-notifier/update-motd-cpu-checker
/usr/lib/update-notifier/update-motd-reboot-required
/usr/lib/update-notifier/update-motd-updates-available

I have verified this behaviour on several of our machines, all of which are running Ubuntu Server 10.04.

I've manually run /usr/lib/update-notifier/apt-check --human-readable (called from /usr/lib/update-notifier/update-motd-updates-available) and it outputs accurate data:

it@milpat:~$ /usr/lib/update-notifier/apt-check --human-readable
0 packages can be updated.
0 updates are security updates.

Running the /usr/lib/update-notifier/update-motd-updates-available script itself returns the appropriate data:

it@milpat:~$ sudo /usr/lib/update-notifier/update-motd-updates-available
0 packages can be updated.
0 updates are security updates.
it@milpat:~$

But even after running the script manually, the motd file does not contain the new data:

dmcgarry@emigre:~/devel/goofalicious/src/Goofalicious$ ssh milpat
Linux milpat 2.6.32-4-pve #1 SMP Thu Oct 21 09:35:29 CEST 2010 x86_64 GNU/Linux

Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

8 packages can be updated.
2 updates are security updates.

You have mail.
Last login: Wed Apr 20 16:13:14 2011 from xxx.xxx.xxx.xxx
it@milpat:~$

REFERENCE SYSTEM INFO:
it@milpat:~$ lsb_release -rd
Description: Ubuntu 10.04.2 LTS
Release: 10.04

Tags: patch lucid
Revision history for this message
Graham Crumb (gcrumb) wrote :

Verification that /var/run/motd is actually being regenerated with outdated information:

it@milpat:~$ sudo rm /var/run/motd
it@milpat:~$ logout
Connection to milpat closed.
dmcgarry@emigre:~/devel/goofalicious/src/Goofalicious$ ssh milpat
Linux milpat 2.6.32-4-pve #1 SMP Thu Oct 21 09:35:29 CEST 2010 x86_64 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

8 packages can be updated.
2 updates are security updates.

You have mail.
Last login: Wed Apr 20 16:29:28 2011 from 144.120.16.112
it@milpat:~$

Revision history for this message
Donovan Long (donovan-long) wrote :

Exact same thing also happening on Ubuntu 10.04 LTS for me as well.

Revision history for this message
Richard Bentley (richard-bentley) wrote :

This problem is mentioned in https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/545398

The work-around is to delete the file /etc/motd.tail which contains the old/stale updates information. It is this old information that is being displayed at login.

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

10.04 here too. /etc/motd didn't update after the 19th's updates and then when it did it has two copies, with the old being stale and coming from /etc/motd.tail. What puts the current motd into motd.tail?

Changed in pam (Ubuntu):
status: New → Confirmed
Revision history for this message
wdeurholt (wdeurholt) wrote :

I have the exact same problem on Ubuntu Server 10.04.1 LTS.
Since April 19 it always says:

1 package can be updated.
1 update is a security update.

But when I check it, this information is incorrect.

Revision history for this message
Brian (briguy48) wrote :

I am also affected here.

Ubuntu Server 10.04.2 LTS logged into via ssh.

In addition, the count for users logged in is incorrect, always showing 0 regardless of actual logins, and the following does not update:

System information as of Fri Apr 22 19:28:36 MDT 2011

and it is now April 26. As a bit more information, Webmin does report these items correctly.

Revision history for this message
Renne (renne) wrote :

Same here on Ubuntu 10.04.2 LTS:

---------------------------------------------------------------------- snip ----------------------------------------------------------------------------------

<me>@<mypc>:~$ ssh root@<mydomain>
Linux www 2.6.32-31-generic-pae #61-Ubuntu SMP Fri Apr 8 20:00:13 UTC 2011 i686 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

  System information as of Sat Apr 30 22:44:57 CEST 2011

  System load: 0.0 Users logged in: 0
  Usage of /: 17.2% of 53.99GB IP address for eth0: <xxx>.<xxx>.<xxx>.20
  Memory usage: 13% IP address for eth0:0: <xxx>.<xxx>.<xxx>.102
  Swap usage: 0% IP address for tun0: 192.168.176.1
  Processes: 193

  Graph this data and manage this system at https://landscape.canonical.com/

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

Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

 System information disabled due to load higher than 1

21 packages can be updated.
10 updates are security updates.

You have new mail.
Last login: Thu Apr 28 23:58:51 2011 from <my-dsl>

-------------------------------------------------------------- snap -----------------------------------------------------------------------------------------

wdeurholt (wdeurholt)
description: updated
Revision history for this message
jontaa (jontaa) wrote :

I can also confirm it with Ubuntu 10.04.2
I choose "no automatic update" in the installation.

Revision history for this message
Tony Whitmore (tonywhitmore) wrote :

The information appears to be being generated twice - two sets of motd headers are created. If one removes the contents of /etc/motd, saves, logs out and logs back into the system via SSH the contents of /etc/motd are regenerated.

Linux azal 2.6.32-27-generic-pae #49-Ubuntu SMP Thu Dec 2 00:07:52 UTC 2010 i686 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

  System information as of Fri May 27 22:19:26 BST 2011

  System load: 0.23 Processes: 147
  Usage of /home: 45.7% of 2.69TB Users logged in: 0
  Memory usage: 19% IP address for eth0: 192.168.1.68
  Swap usage: 0%

  Graph this data and manage this system at https://landscape.canonical.com/

*** System restart required ***
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

  System information as of Wed Apr 20 08:15:04 BST 2011

  System load: 0.0 Processes: 149
  Usage of /home: 41.8% of 2.69TB Users logged in: 0
  Memory usage: 18% IP address for eth0: 192.168.1.68
  Swap usage: 0%

  Graph this data and manage this system at https://landscape.canonical.com/

*** System restart required ***

Revision history for this message
tavasti (tavasti) wrote :

This is not duplicate of bug #659738.

This is about old, outdated information on login. Looks like this appears on machines where logins are ssh only.
#659738 is about information shown twice.

Revision history for this message
Steve Langasek (vorlon) wrote :

Ok, thanks for the note. In that case this is also not a bug in pam, but somewhere in update-motd itself; reassigning.

affects: pam (Ubuntu) → update-motd (Ubuntu)
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

I've reproduced the problem here.

In /etc/update-motd.d/99-footer, we have:
#!/bin/sh
# motd.tail is reserved for the admin to append static
# trailing information to a dynamically generated
# /etc/motd.
#
# To add dynamic information, add a numbered
# script to /etc/update-motd.d/
[ -f /etc/motd.tail ] && cat /etc/motd.tail || true

Which is fine and dandy... motd.tail is reserved for the local sysadmin to append pertinent data.

But cat /etc/motd.tail says:
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

  System information as of Sat Apr 30 10:00:01 CDT 2011

  System load: 0.5 Processes: 172
  Usage of /: 68.5% of 458.45GB Users logged in: 1
  Memory usage: 23% IP address for br0: 192.168.1.133
  Swap usage: 0% IP address for virbr0: 192.168.122.1
  Temperature: 40 C

  Graph this data and manage this system at https://landscape.canonical.com/

61 packages can be updated.
32 updates are security updates.

Note the date... April 30th. (I just catted that today, June 17th).

Some package that got updated between April 20th and April 30th looks to have statically written into /etc/motd.tail. I'm investigating now....

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

And triaging the problem down, it is, in fact a duplicate of Bug #659738, which just recently landed in lucid-updates. I've traced the code and confirmed the fix here on the system that I reproduced this on.

Thanks!

Revision history for this message
Thue Janus Kristensen (thuejk) wrote :

It is not the same problem as bug #659738.

The problem here is that /usr/lib/update-notifier/update-motd-updates-available does

    if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -newer "$stamp" -print -quit)" ]; then
        NEED_UPDATE_CHECK=yes
    fi

So it checks in /var/lib/apt/lists if there are any files more newly updated than /var/lib/update-notifier/updates-available , and if there are it generates a new /var/lib/update-notifier/updates-available .

However, the timestamps on the files in /var/lib/apt/lists are kept in sync with the timestamps on the mirrors, and do not indicate when an "apt-get update" was last run. So the following can happen:

1) A new package appears on the mirrors, and the timestamp on the mirrors is updates
2) A new /var/lib/update-notifier/updates-available is generated on my computer
3) I run "apt-get update" on my computer

In that case, /usr/lib/update-notifier/update-motd-updates-available will see /var/lib/update-notifier/updates-available as having a newer timestamp than the package lists, and will therefore not update /var/lib/update-notifier/updates-available.

The simplest fix is to have update-motd-updates-available just store the package list directory listing with full time stamps. I have attached a patch.

Revision history for this message
Thue Janus Kristensen (thuejk) wrote :

Patch attached.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "766827.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Thue Janus Kristensen (thuejk) wrote :

We also need to add additional functionality on top to detect when the pending packages have actually been installed. For example by checking the timestamp of /var/log/dpkg.log

And perhaps on top of that, make sure that the message is updated at least once a week, so that any desyncronizations are eventually self-correcting.

Mathew Hodson (mhodson)
Changed in update-motd (Ubuntu):
importance: Undecided → Medium
tags: added: lucid
Revision history for this message
Brian Murray (brian-murray) wrote :

Sorry about the terrible delay in getting to this. I've tried recreating this on Trusty and been unsuccessful. Here are the steps:

$ ssh bizarro
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-74-generic x86_64)

 * Documentation: https://help.ubuntu.com/

37 packages can be updated.
30 updates are security updates.

You have new mail.

bdmurray@bizarro:/mnt/unmirrored/bug-attachments$ /usr/lib/update-notifier/apt-check --human-readable
42 packages can be updated.
30 updates are security updates.

 $ ssh bizarro
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-74-generic x86_64)

 * Documentation: https://help.ubuntu.com/

42 packages can be updated.
30 updates are security updates.

You have new mail.

Is this an issue on a release other than lucid?

Changed in update-motd (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Thue Janus Kristensen (thuejk) wrote :

Did you read my analysis of the problem in #14? Your test does not seem to cover the problem I found.

Revision history for this message
Brian Murray (brian-murray) wrote :

Re-reading the problem in #14 I think a recent change to the xenial version of the package fixes the issue.

  * debian/99update-notifier:
    - Now additionally triggers the an asynchronous background update of the
      cached info via update-motd-updates-available hooking into
      APT::Update::Post-Invoke-Success.

debian/99update-notifier now contains the following line:

APT::Update::Post-Invoke-Success {"/usr/lib/update-notifier/update-motd-updates-available 2>/dev/null || true";};

so once 'apt-get update' is run we'll generate a new stamp file.

Revision history for this message
Thue Janus Kristensen (thuejk) wrote :

That sounds fine to me, for xenial at least.

Revision history for this message
Thue Janus Kristensen (thuejk) wrote :

Erm, on second though that is not fine. /usr/lib/update-notifier/update-motd-updates-available will still only set NEED_UPDATE_CHECK=yes if the timestamps align, and my example in #14 can still happen.

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

[Expired for update-motd (Ubuntu) because there has been no activity for 60 days.]

Changed in update-motd (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Michel Jacobs (majacobs) wrote :

Please Reassign. I login to a server (ssh) running xenial and I still have this problem!

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

Other bug subscribers

Remote bug watches

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