3

I upgraded from 12.04 to 14.04 and ever since then, when I log in over SSH, the available updates is incorrect and out of date. This never happened with 12.04.

For example:

  1. Log in and no updates are shown.

  2. Exit and log in again. I now see:

    25 packages can be updated.
    15 updates are security updates.

  3. I do the update and log out. Then log in and it still says:

    25 packages can be updated.
    15 updates are security updates.

  4. Log out and log in and now see

    System reboot required.


The output from today's 1st login was

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

So I exit and log in again and now see:

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

So I run it and the result is:

Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
Get:2 http://security.ubuntu.com trusty-security/main Sources [117 kB]         
Get:3 http://security.ubuntu.com trusty-security/restricted Sources [4,035 B]  
Get:4 http://security.ubuntu.com trusty-security/universe Sources [37.3 kB]    
Get:5 http://security.ubuntu.com trusty-security/multiverse Sources [2,760 B]  
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [485 kB]  
Get:7 http://security.ubuntu.com trusty-security/restricted amd64 Packages [13.0 kB]
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [130 kB]
Get:9 http://security.ubuntu.com trusty-security/multiverse amd64 Packages [4,978 B]
Get:10 http://security.ubuntu.com trusty-security/main i386 Packages [458 kB]  
Get:11 http://security.ubuntu.com trusty-security/restricted i386 Packages [12.7 kB]
Get:12 http://security.ubuntu.com trusty-security/universe i386 Packages [130 kB]
Get:13 http://security.ubuntu.com trusty-security/multiverse i386 Packages [5,168 B]
Hit http://security.ubuntu.com trusty-security/main Translation-en             
Ign http://us.archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/restricted Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:14 http://us.archive.ubuntu.com trusty-updates InRelease [65.9 kB]     
Get:15 http://us.archive.ubuntu.com trusty-backports InRelease [65.9 kB]       
Hit http://us.archive.ubuntu.com trusty Release.gpg                          
Get:16 http://us.archive.ubuntu.com trusty-updates/main Sources [277 kB]
Get:17 http://us.archive.ubuntu.com trusty-updates/restricted Sources [5,352 B]
Get:18 http://us.archive.ubuntu.com trusty-updates/universe Sources [156 kB]
Get:19 http://us.archive.ubuntu.com trusty-updates/multiverse Sources [5,939 B]
Get:20 http://us.archive.ubuntu.com trusty-updates/main amd64 Packages [773 kB]
Get:21 http://us.archive.ubuntu.com trusty-updates/restricted amd64 Packages [15.9 kB]
Get:22 http://us.archive.ubuntu.com trusty-updates/universe amd64 Packages [361 kB]
Get:23 http://us.archive.ubuntu.com trusty-updates/multiverse amd64 Packages [13.2 kB]
Get:24 http://us.archive.ubuntu.com trusty-updates/main i386 Packages [740 kB]
Get:25 http://us.archive.ubuntu.com trusty-updates/restricted i386 Packages [15.6 kB]
Get:26 http://us.archive.ubuntu.com trusty-updates/universe i386 Packages [363 kB]
Get:27 http://us.archive.ubuntu.com trusty-updates/multiverse i386 Packages [13.6 kB]
Hit http://us.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://us.archive.ubuntu.com trusty-updates/multiverse Translation-en   
Hit http://us.archive.ubuntu.com trusty-updates/restricted Translation-en   
Hit http://us.archive.ubuntu.com trusty-updates/universe Translation-en    
Get:28 http://us.archive.ubuntu.com trusty-backports/main Sources [9,551 B]
Get:29 http://us.archive.ubuntu.com trusty-backports/restricted Sources [28 B]
Get:30 http://us.archive.ubuntu.com trusty-backports/universe Sources [35.2 kB]
Get:31 http://us.archive.ubuntu.com trusty-backports/multiverse Sources [1,898 B]
Get:32 http://us.archive.ubuntu.com trusty-backports/main amd64 Packages [13.3 kB]
Get:33 http://us.archive.ubuntu.com trusty-backports/restricted amd64 Packages [28 B]
Get:34 http://us.archive.ubuntu.com trusty-backports/universe amd64 Packages [43.2 kB]
Get:35 http://us.archive.ubuntu.com trusty-backports/multiverse amd64 Packages [1,571 B]
Get:36 http://us.archive.ubuntu.com trusty-backports/main i386 Packages [13.3 kB]
Get:37 http://us.archive.ubuntu.com trusty-backports/restricted i386 Packages [28 B]
Get:38 http://us.archive.ubuntu.com trusty-backports/universe i386 Packages [43.2 kB]
Get:39 http://us.archive.ubuntu.com trusty-backports/multiverse i386 Packages [1,552 B]
Hit http://us.archive.ubuntu.com trusty-backports/main Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://us.archive.ubuntu.com trusty Release
Hit http://us.archive.ubuntu.com trusty/main Sources
Hit http://us.archive.ubuntu.com trusty/restricted Sources
Hit http://us.archive.ubuntu.com trusty/universe Sources
Hit http://us.archive.ubuntu.com trusty/multiverse Sources
Hit http://us.archive.ubuntu.com trusty/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://us.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://us.archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com trusty/main i386 Packages
Hit http://us.archive.ubuntu.com trusty/restricted i386 Packages
Hit http://us.archive.ubuntu.com trusty/universe i386 Packages
Hit http://us.archive.ubuntu.com trusty/multiverse i386 Packages
Hit http://us.archive.ubuntu.com trusty/main Translation-en
Hit http://us.archive.ubuntu.com trusty/multiverse Translation-en
Hit http://us.archive.ubuntu.com trusty/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty/universe Translation-en
Ign http://us.archive.ubuntu.com trusty/main Translation-en_US
Ign http://us.archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 4,499 kB in 5s (775 kB/s)                  
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libxml2
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 573 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libxml2 amd64 2.9.1+dfsg1-3ubuntu4.8 [573 kB]
Fetched 573 kB in 0s (1,256 kB/s)
(Reading database ... 41499 files and directories currently installed.)
Preparing to unpack .../libxml2_2.9.1+dfsg1-3ubuntu4.8_amd64.deb ...
Unpacking libxml2:amd64 (2.9.1+dfsg1-3ubuntu4.8) over (2.9.1+dfsg1-3ubuntu4.7) ...
Setting up libxml2:amd64 (2.9.1+dfsg1-3ubuntu4.8) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...

and then I exit and log in again and it still says

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

and then I exit and log in again and now it is correctly not showing any updates available at all.

To reiterate - the problem is NOT with the updating, the problem is with the available updates ALWAYS being delayed by one log in/log out cycle. Makes absolutely no sense to me!

3 Answers3

1

You sometimes see old information because a cache is used.

We'd like the message to be up-to-date, but we also don't want to block on giving you a prompt while determining the update status. For example, you might be trying to log in to fix some unrelated fault causing excessive disk I/O; it would be frustrating if you couldn't do so quickly because logging in insisted on creating more disk I/O while update status is checked, when you don't even care about that to fix your disk I/O fault.

The point of the message is a reminder to install updates if you don't have automatic updates enabled and if you haven't logged in for a while. If you have just installed updates yourself, or want to query the exact up-to-the-minute information, you should use apt-get directly as you have done.

The message comes from the update-notifier-common package via /etc/update-motd/90-updates-available. To minimise login time, the script uses a cache. If the cache is considered stale, the information is updated. If the cache is not considered stale, for example if the information was recently updated, then the information is not updated.

In 16.04, we have adjusted the details again in favour of not slowing down login at all.

Robie Basak
  • 15,670
0

What are the contents of /usr/lib/update-notifier/update-motd-updates-available ?

https://bugs.launchpad.net/ubuntu/+source/update-motd/+bug/766827

Comments #14, #18, #22

(Sorry, I cannot make a comment yet)

dimk
  • 164
0

Through this thread I found the solution was to disable the caching of update messages by editing these two files:

/etc/pam.d/sshd
/etc/pam.d/login

Delete "noupdate" from this line:
session optional pam_motd.so motd=/run/motd.dynamic noupdate

I generally log in once a week and I now have available update messages that accurately show the current state rather than being stale by a week.

  • Spoke too soon. The problem is back. I guess I'm very much in the minority with only one login a week. So will just have to log in/log out/log in to get the correct data. – martinjbaker Aug 07 '16 at 07:27