4

When I login to my server terminal over ssh I just see:

Using username "username".
Ubuntu 14.04.1 LTS
Authenticating with public key "mykey" from agent
Last login: Wed Oct 22 09:17:02 2014 from xxx.xxx.xxx.x

The login should normaly tell me something like this:

    Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-33-generic x86_64)
    * Documentation:  https://help.ubuntu.com/
6 packages can be updated.
0 updates are security updates.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Why is that, how an where should I change settings so that available updates are shown when logging to terminal shell?

This update notification was working OK but it just stopped a week ago or so. Maybe I did some stupid change that I am not aware of.

I hope someone can help me about this issue.

chaos
  • 27,506
  • 12
  • 74
  • 77

2 Answers2

4

Thats the message of the day (motd). Check if the file /etc/motd is existing and has content. When typing:

cat /etc/motd

...you should see the message like this:

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

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

Probably that file is empty in your case. The following packages need to be installed that the file is updated periodically:

base-files
update-notifier-common 

You can force recreation of the file with this command:

run-parts /etc/update-motd.d/

Edit:

The manpage of pam_motd says that there is a flag called noupdate to prevent updateing the motd. Edit the file /etc/pam.d/sshd. In the file edit the line:

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

to:

session    optional     pam_motd.so  motd=/var/run/motd
chaos
  • 27,506
  • 12
  • 74
  • 77
  • well, there is no /etc/motd = cat /etc/motd cat: /etc/motd: No such file or directory – Marko Ambrožič Oct 22 '14 at 19:51
  • @MarkoAmbrožič are the packages I mentioned installed? Have you tried the last command in my answer? – chaos Oct 22 '14 at 19:54
  • I have checked and all packages ate installed. I have tried comamnds: "run-parts /etc/update-motd.d/" and "dpkg -S /etc/update-motd.d/*" with no errors. I manualy created link /var/run/motd to /etc/motd (in /etc : motd -> /var/run/motd. But still no changes to generated motd..... – Marko Ambrožič Oct 22 '14 at 20:13
  • And the file /var/run/motd contains nothing? Also can you provide the output of grep motd /etc/pam.d/*? – chaos Oct 22 '14 at 21:09
  • I posted replay as an answer because as comment text was too long. – Marko Ambrožič Oct 22 '14 at 21:26
  • @MarkoAmbrožič sry you have to delete your answer. You can use http://pastebin.com/ for such things or better edit your question. But anyway I found the problem: I update my answer, one moment. – chaos Oct 22 '14 at 21:30
  • @MarkoAmbrožič see my edit – chaos Oct 22 '14 at 21:34
  • OK just a moment..., and I have deleted my answer as you recommend – Marko Ambrožič Oct 22 '14 at 21:35
  • I edited /etc/pam.d/sshd as you described but cat /etc/motd is stil empty after run-parts /etc/update-motd.d – Marko Ambrožič Oct 22 '14 at 21:45
  • You have to login again via ssh to regenerate the file – chaos Oct 22 '14 at 21:50
  • I did that of course. But it is still the same. http://pastebin.com/HaQRr5dk – Marko Ambrožič Oct 22 '14 at 21:55
  • And the file /var/run/motd? – chaos Oct 22 '14 at 22:00
  • cat /var/run/motd - still epty – Marko Ambrožič Oct 22 '14 at 22:02
  • I'm out of bullets. Maybe the permission and owner of the files are not corretly. Are scripts inside /etc/update-motd.d? And are they executable? Does that command give an ouput? /usr/lib/update-notifier/update-motd-updates-available It's the script that checks the updates – chaos Oct 22 '14 at 22:14
  • Huh; scripts are in place, executable owner by root:root ; /usr/lib/update-notifier/update-motd-updates-available - no output – Marko Ambrožič Oct 22 '14 at 22:21
  • and I see this: no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory which is samba memory leak as I can remember -To fix it, run pam-auth-update and make sure SMB password synchronization is deselected - I think the problem with update-notifier starts at that time... – Marko Ambrožič Oct 22 '14 at 22:37
  • The /usr/lib/update-notifier/update-motd-updates-available command should produce the output. When there is no output you should debug that script. – chaos Oct 22 '14 at 22:54
  • and the end of the mentioned script is "/usr/lib/update-notifier/apt-check --human-readable" it outputs: 0 packages can be updated. 0 updates are security updates. But the script itself does not give me any output – Marko Ambrožič Oct 22 '14 at 23:33
  • try it with /usr/lib/update-notifier/update-motd-updates-available --force So it must execute that line. – chaos Oct 23 '14 at 12:42
  • It works with --force. Looking here: http://askubuntu.com/questions/105689/how-is-etc-motd-updated/105691#105691 - the "run-parts /etc/update-motd.d/ | sudo tee /etc/motd" output is: Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-37-generic x86_64)
    • Documentation: https://help.ubuntu.com/

    0 packages can be updated. 0 updates are security updates. But when I log out and login again the updates are not shown. Will see what will happen when I reboot the server....

    – Marko Ambrožič Oct 23 '14 at 16:25
  • 1
    What is the purpose of changing the motd option value in /etc/pam.d/sshd from /run/motd.dynamic to /var/run/motd? I was able to get my motd updating just by removing the noupdate option. – wachr Apr 05 '15 at 19:05
0

This article solved the problem for me with no muss and no fuss on Ubuntu 16.04. Except the part about having to delete and recreate the /etc/update-motd.d directory; that seems to have been misguided.

But basically:

apt-get install lsb-release figlet update-motd 

seems to have done it for me on 16.04

rfay
  • 101