Monday, October 25, 2010

Customizing Ubuntu's SSH MOTD

Ubuntu_10
I recently updated my Ubuntu server from 10.04 LTS to 10.10 and towards the end of the update process a prompt is displayed requesting for removal of obsolete packages with the options yes/no/details. I decided to check the details screen and accidentally exited, killing the installer and not completing the removal of these packages.  (you can resume this with apt-get...)

Since this abrupt exit of my update process, my SSH MOTD (message of the day) which, by default displays the landscape sysinfo and available updates was static. Now every time I would SSH into the server, the login sysinfo was always the same and it showed that I had 311 updates that running and apt-get update then upgrade would yield no such update.  It also kept telling me that an update was required even though a reboot file was not present in:

/var/run/reboot-required

There are a couple of files that need to be changed in order to correct this static message. The first, which you should not edit but can clear since it is overwritten is located at:

/etc/motd

This file is updated with the MOTD info but removal of anything here will simply get rewritten with  updated infomation and anything located in the "tail" file.   Editing the MOTD tail will append the info pushed to /etc/motd.  Upon editing:

/etc/motd.tail

In my case the /etc/motd.tail contained the same static message that I was seeing in my SSH session. Clearing this or adding your own custom message will now display your correct landscape sysinfo and you new custom "tail" content. 

Note - If you clear the tail and reboot and immediately log in via SSH, you might receive a message saying "System information disabled due to load higher than 1" so wait about 10 minutes before logging in to see if you new MOTD will display correctly.  

You can also display the same welcome landscape sysinfo by running he following command:

/usr/bin/landscape-sysinfo

 

UPDATE:

Another thing I noticed is that my update-notifier module has somehow been removed so if you are noticing that your update notification from MOTD is not showing up, ensure that update-notifier in installed.

2 comments: