Results 1 to 9 of 9

Thread: motd shows outdated information on ubuntu server 14.04 LTS

  1. #1
    Join Date
    Jan 2012
    Beans
    2

    motd shows outdated information on ubuntu server 14.04 LTS

    Before reporting a bug I just wanted to make sure I am not doing something wrong here.

    After performing a fresh installation of Ubuntu Server 14.04 LTS I notice that the MOTD message which is shown when I login via SSH is outdated: it shows the information which was generated during my LAST login. So when I last logged in last week and then login again today, the information presented to me is from last week's login. I am specifically referring to the system info as below (this login message was shown to me today, on the 19th of June):

    Code:
    Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-29-generic x86_64)
    
      System information as of Thu Jun 16 12:24:09 CEST 2014
    
      System load:  0.02               Processes:           105
      Usage of /:   18.0% of 14.40GB   Users logged in:     0
      Memory usage: 53%                IP address for eth0: xxx.xxx.xxx.xxx
      Swap usage:   2%
    When I logout and in again, I am shown the information from my login session a few minutes ago.

    Here's my sshd_config:

    Code:
    ChallengeResponseAuthentication no
    HostbasedAuthentication no
    IgnoreRhosts yes
    PasswordAuthentication no
    PermitEmptyPasswords no
    PermitRootLogin no
    PrintLastLog yes
    Protocol 2
    PubkeyAuthentication yes
    RSAAuthentication yes
    Subsystem sftp /usr/lib/openssh/sftp-server
    UsePAM yes
    X11Forwarding no
    Is something wrong with my configuration or is this a bug? Any help would be very much appreciated!

  2. #2
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,047
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    motd used to be a simple framework; now it has gotten quite complicated.

    tgalati4@Mint14-Extensa ~ $ apropos motd
    motd (5) - message of the day
    motd.tail (5) - Template for building the system message of the day
    pam_motd (8) - Display the motd file
    update-motd (5) - dynamic MOTD generation
    Code:
    man update-motd
    is where I would start.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  3. #3
    Join Date
    Jan 2012
    Beans
    2

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    I know, it took me a while to figure out I needed to enable PAM (UsePAM) in my SSHD config in order to show the Motd at all, regardless of the ShowMotd=yes/no config. But now it does show outdated info; any clues on howto fix this?

    If I type the command from your post, here's the output:
    Code:
    root@x:/home/netson# apropos motd
    motd (5)             - message of the day
    pam_motd (8)         - Display the motd file
    update-motd (5)      - dynamic MOTD generation

  4. #4
    Join Date
    Mar 2009
    Beans
    1

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    I have the same problem - takes 2 logins to get up to date info from MOTD. Any ideas on how to fix? Ubuntu 14.04 LTS

  5. #5
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,047
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    I'm running Linux Mint MATE 14 which is based on 12.10. So obviously the motd framework has changed again. I would file a bug against 14.04. I'm sure there are others with the same problem. I presume that local logins are OK, that the motd is updated correctly? So it is only ssh logins that display outdated information? Is it possible that you have different versions of ssh between machines? It might be a bug between older and new ssh daemons interacting with motd.

    Code:
    apt-cache policy openssh-client
    apt-cache policy openssh-server
    Last edited by tgalati4; July 6th, 2014 at 03:59 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  6. #6
    Join Date
    Mar 2013
    Beans
    7

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    Here's something to try that worked for me. Edit the file /etc/pam.d/sshd; it's owned by the root user so you'll need to be logged in as root or able to sudo. Look for this line:

    Code:
    session    optional     pam_motd.so  motd=/run/motd.dynamic noupdate
    Remove "noupdate":

    Code:
    session    optional     pam_motd.so  motd=/run/motd.dynamic
    Save the file. After making this change I've noticed that I now get current system information when I login via ssh.

  7. #7
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,047
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    And I remember that this was disabled for a reason. If you have a busy, headless server in a remote location, ssh would time out because of heavy load trying to assemble the motd. So that would effectively lock you out of a server, just as you needed to log in and figure out why it is so slow.

    For a normally-functioning server, motd is trivial. But when you are having issues, having a login-process that interferes with logging in is not so nice.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  8. #8
    Join Date
    Mar 2013
    Beans
    7

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    Quote Originally Posted by tgalati4 View Post
    And I remember that this was disabled for a reason. If you have a busy, headless server in a remote location, ssh would time out because of heavy load trying to assemble the motd. So that would effectively lock you out of a server, just as you needed to log in and figure out why it is so slow.

    For a normally-functioning server, motd is trivial. But when you are having issues, having a login-process that interferes with logging in is not so nice.
    There's some code in /etc/update-motd.d/50-landscape-sysinfo to address that risk:

    Code:
    #!/bin/sh
    cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
    [ "$cores" -eq "0" ] && cores=1
    threshold="${cores:-1}.0"
    if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
        echo
        echo -n "  System information as of "
        /bin/date
        echo
        /usr/bin/landscape-sysinfo
    else
        echo
        echo " System information disabled due to load higher than $threshold"
    fi

  9. #9
    Join Date
    Mar 2013
    Beans
    7

    Re: motd shows outdated information on ubuntu server 14.04 LTS

    Oh, and FWIW the same edit should be made to /etc/pam.d/login. I found the same use of "noupdate"in there, too.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •