1

Note: This is not a new problem and has been going on for a while.

If you log in via SSH when new updates are available or after installing updates, the MOTD doesn't reflect the last changes you've done... unless you log out and then back in again.

I logged in this morning as a user that doesn't have sudo access this morning and saw this in the MOTD:

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

So, I opened a second SSH session and logged in as my user that does have sudo access and saw this in the MOTD:

16 packages can be updated.
14 updates are security updates.

I installed these updates, and specifically to test this logged my non-sudo user out and back in on a separate terminal, which displayed this in the MOTD

16 packages can be updated.
14 updates are security updates.

I logged that user out and back in again and saw this in the MOTD:

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

*** System restart required ***

Is there some caching going on or some setting I need to disable to get this to be correctly up to date?

Powerlord
  • 536
  • I'm not sure if I should have tagged this as [tag:update-notifier] as it's actually from the updater-notifier-common package. Feel free to remove the tag. – Powerlord May 22 '15 at 13:51
  • On a side note, this also applies to the system information. It shows the information at the time of the previous login. – Powerlord Dec 30 '15 at 18:46

1 Answers1

0

This is filed as bug 1368864 in Ubuntu's tracker.

The fix requires modifying a pair of files:

The first is /etc/pam.d/login

Find these lines:

session    optional   pam_motd.so  motd=/run/motd.dynamic noupdate
session    optional   pam_motd.so

and change them to:

session    optional   pam_motd.so  motd=/run/motd.dynamic
session    optional   pam_motd.so noupdate

Next, open /etc/pam.d/sshd

Find these lines:

session    optional     pam_motd.so  motd=/run/motd.dynamic noupdate
session    optional     pam_motd.so # [1]

and change them to:

session    optional     pam_motd.so  motd=/run/motd.dynamic
session    optional     pam_motd.so noupdate # [1]

The reason you need to modify both files is because, if you only change login, then any logins done via SSH will fail to display the system information the first time you log in.

Powerlord
  • 536
  • Note: I'm not sure if using noupdate on the second line will cause it to fail to display /etc/motd as part of the MOTD. I should do more testing and find out. – Powerlord Dec 30 '15 at 19:42
  • /etc/motd is merged in correctly with these settings when I log in via SSH. I don't have a local Linux machine or VM to test it out for local connections at the moment. – Powerlord Dec 30 '15 at 19:50