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?

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
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
  • 178,446
1

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

Peachy
  • 7,235
  • 10
  • 40
  • 47
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
  • 73,717
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