I keep getting this message when I logged into my server in AWS EC2 via ssh

I think this is called MOTD

43 packages can be updated.
22 updates are security updates.

but I have already done

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

I have also restarted my instance.

Please advise.

  • Is your instance ephemeral or EBS backed?
    – Caleb
    Apr 23 '11 at 12:54
  • EBS backed instance
    – Kim Stacks
    Apr 27 '11 at 9:46

Another one of these "fine" Ubuntu-bugs... Check Ubuntu Bug #634387: https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/634387

I deleted the files "/etc/motd.tail" and "/etc/motd.tail.old" and did a logout / login to re-genereate a propper /etc/motd.


This is coming from the MOTD (Message Of The Day). The MOTD is pieced together from the commands in /etc/update-motd.d. The specific message comes from running /etc/update-motd.d/90-updates-available.

I have seen this happen on systems where after running sudo apt-get update and packages are kept back

The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

The message can mean several things e.g. there may be dependency issues etc. there is more on this in the APT HowTo.

I have managed to stop the messages with

sudo aptitude update
sudo aptitude safe-upgrade

If that doesn't work then the link above does give advice on how to track down the problem packages.

  • This fixed the problem on Ubuntu 16.04.3 LTS (Xenial Xerus)
    – rlib
    Oct 17 '17 at 8:29

I was seeing this same issue on Ubuntu 14.04

I edited /etc/pam.d/sshd

and changed this line
session optional pam_motd.so motd=/run/motd.dynamic noupdate

by removing the noupdate

now the banner displays correctly.

  • 1
    I think this answer is moving in the right direction for 14.04. On my own server (Ubuntu Server in a virtual machine), the motd changed after sudo apt-get dist-upgrade. In my case, that required a server restart, so I don't know whether the change to motd was little bit of a coincidence. I did not have to edit any of the files in /etc/pam.d, but I think I'd have first tried editing /etc/pam.d/login. That files has the same motd lines as sshd. Mar 16 '15 at 14:59
  • I've simply restarted after sudo apt-get dist-upgrade and the message was fixed.
    – Kimi
    Apr 20 '15 at 16:46

Run the following command:

sudo /usr/lib/update-notifier/update-motd-updates-available --force
  • 1
    I downvoted this answer, but it turns out my expectations were incorrect, and the answer itself may be correct. Unfortunately, serverfault has locked(!!) my downvote and I cannot undo it unless the answer is edited. :-(
    – mpb
    Dec 21 '17 at 0:57
  • This worked on Ubuntu 18.04 - Thank you Nov 4 '20 at 19:58

After numerous failed attempts, the recipe that works for me is based on Kimi and Lex Miller:

$ sudo aptitude safe-upgrade
$ sudo /usr/lib/update-notifier/update-motd-updates-available --force

Try this:

sudo apt-get install unattended-upgrades

sudo dpkg-reconfigure --priority=low unattended-upgrades

sudo dpkg-reconfigure -plow unattended-upgrades -f noninteractive -p critical

For more details: https://help.ubuntu.com/community/AutomaticSecurityUpdates

  • 1
    You give a recipe, but you're not giving any explanation or justification.
    – Law29
    May 22 '16 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.