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

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