18

I have a server machine that I never log into the X display on, only via ssh. Recently I logged in and it told me I had

12 packages can be updated.
6 updates are security updates.

I actually already knew that because I run munin on it and all my other servers. So anyway, I did "sudo aptitude" and installed all the updates, then rebooted. A few days later, munin told me I needed to upgrade another package, so I logged on, but the login message said:

12 packages can be updated.
6 updates are security updates.

I went into aptitude and installed the one update. Ubuntu is still telling me I have 12 packages to update. Munin tells I don't have any. I tried aptitude -d -y dist-upgrade and apt-get -d -y dist-upgrade and both of them tell me there is nothing to install. So why is the login information still telling me I have 12 packages to update?

  • Did you do sudo aptitude update again? Just to make sure it updated ;) Also, running sudo aptitude safe-upgrade might help, you can use aptitude just like apt-get, with the command-line arguments... aptitude alone starts the interactive interface, which I personally know a good group of users dont use. – Thomas Ward Apr 22 '11 at 22:03
  • @Evil, it's not aptitude that's having the problem, it's whatever Ubuntu uses to report how many packages need to be upgraded. aptitude installed the 12 package updates a few days ago. – Paul Tomblin Apr 22 '11 at 22:15
  • 1
    FWIW, I'm seeing the same issue on Ubuntu 10.10 now. Maybe a bug? – grm Apr 23 '11 at 14:48
  • Yes, could you submit a bug on this? and link to this question. – Jeremy Bicha Apr 27 '11 at 22:12
  • On Trusty 14.04.3 LTS, running "sudo aptitude safe-upgrade" has removed these messages, when "sudo apt-get upgrade" didn't. – Beebee Nov 03 '15 at 11:33

7 Answers7

10

It's a bug in initscripts, fixed in Natty, which copies the current state of motd to /etc/motd.tail. motd is dynamically generated whenever you boot but motd.tail is static (allowing a sysadmin to place some fixed information there for all users).

Deleting motd.tail will fix the issue temporarily but a better solution is to create an empty motd.tail. If the file doesn't exist then it may be created again (incorrectly) when initscripts is upgraded.

Create an empty motd.tail with

sudo touch /etc/motd.tail
  • 2
    I'm seeing this same problem in 12.04.2 LTS, and there is no /etc/motd.tail file; just /etc/motd, which contains the offending text. The timestamp ("System information as of...") is accurate, but the updateable package count is not. – Lambart May 16 '13 at 00:43
6

The problem appears to be the logic in /usr/lib/update-notifier/update-motd-updates-available which is deciding that there are is no reason to run /usr/lib/update-notifier/apt-check --human-readable based on timestamps on /var/lib/update-notifier/updates-available and sources.list and a few other files.

I'm not sure what the actual bug is, but removing the cached file has at least reset it to 0 updates, although God only knows if it will show the correct number when there are updates available.

5

I've recently answered a similar question on Serverfault:

ubuntu server: SSH banner telling to update packages but nothing to update

That banner you're talking about is called MOTD (Message Of The Day). It appears to be a bug which can be work-arounded by deleting the /etc/motd.tail file.

Lekensteyn
  • 174,277
1

Check if /etc/motd.tail contains the update messages. If yes, remove them.

Peachy
  • 7,117
  • 10
  • 38
  • 46
1

I am having the same issue on 10.04.2.

# aptitude install update-motd

Selecting previously deselected package update-motd.
(Reading database ... 36453 files and directories currently installed.)
Unpacking update-motd (from .../update-motd_3.5-0ubuntu1_all.deb) ...
 Removing any system startup links for /etc/init.d/update-motd ...
Setting up update-motd (3.5-0ubuntu1) ...

But there's no update-motd command line tool afterwords and I can't find anything about pam_motd.

Removing the /etc/motd made the message go away, but obviously the safe-upgrade should have already done that.

Jorge Castro
  • 71,754
1

On several systems I had seen incorrect reports of packages to be updated, but also 2 lines 'Ubuntu 10.04.2 LTS' and 'Ubuntu 10.04.1 LTS' even though I was on 10.04.2.

As Karl said, /etc/motd.tail contained the old text, and deleting it solved the problem for me perfectly

0

I had the same issue after upgrading from 18.04 to 20.04. The solution was to simply run motd update script with force flag:

/usr/lib/update-notifier/update-motd-updates-available --force

This has updated motd information and now shows 0 updates.

pilot
  • 101