You are not logged in.

#1 2014-04-17 13:41:06

sjjones85
Member
From: UK
Registered: 2014-04-17
Posts: 2
Website

Issue with Gnome 3.12 login and MOTD

Hello,

This may be trivial, but I've struggled to find an answer for a problem I now have following creating an motd. I wanted an motd especially for terminal / ssh logins, but had no idea Gnome would attempt (I believe it does anyway) to display the motd contents immediately after logging in.

Whilst this would not be an issue if it actually worked and displayed the motd rather than garbage (see image below). It makes my login time much longer as it hangs on the login screen, before finally reaching the desktop. If I blank the motd, this problem goes away, however, as said, I really want the motd for ssh and terminal use. Has anyone else experienced this issue? Is there a way to disable Gnome from reading this file, or to display it correctly and not hamper my login times?

I'm running Arch x86_64 with Gnome 3.12 and would appreciate any time and help on this.

Steve

Do Not Post Full Size Images -- Inxsible
- My bad, have created a 230 x 230 thumbnail with link:

gdm-motdGarbageThumb.jpg

In case it helps, my motd code which works fine in the terminal:

#!/bin/bash
#Script to update motd with relevant information.

#Define output file
motd="/etc/motd"

# Collect information
USERNAME=`logname`
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`awk -F '[ :][ :]+' '/^model name/ { print $2; exit; }' /proc/cpuinfo`
ARCH=`uname -m`
PACMAN=`pacman -Qu | wc -l`
DISC=`df -h | grep /dev/mapper/vg_arch-lv_home | awk '{print $5 }'`
MEMORY1=`free -t -m | grep "buffers/cache" | awk '{print $3" MB";}'`
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'`
PSA=`ps -Afl | wc -l`
PSU=`ps U $USER h | wc -l`

#Time of day
HOUR=$(date +"%H")
if [ $HOUR -lt 12  -a $HOUR -ge 0 ]
then   TIME="Morning"
elif [ $HOUR -lt 17 -a $HOUR -ge 12 ]
then   TIME="Afternoon"
else   TIME="Evening"
fi

#System uptime
uptime=`cat /proc/uptime | cut -f1 -d.`
upDays=$((uptime/60/60/24))
upHours=$((uptime/60/60%24))
upMins=$((uptime/60%60))
upSecs=$((uptime%60))


#System load
LOAD1=`cat /proc/loadavg | awk {'print $1'}`
LOAD5=`cat /proc/loadavg | awk {'print $2'}`
LOAD15=`cat /proc/loadavg | awk {'print $3'}`

#Color variables
W="\033[00;37m"
B="\033[01;36m"
R="\033[01;31m"
G="\033[01;32m"
N="\033[0m"

#Clear screen before motd
clear > $motd

echo -e "
        $B. $W
       $B/#\ $W                     _     $B _ _
      $B/###\ $W      __ _ _ __ ___| |__  $B| (_)_ __  _   ___  __ 
     $B/#####\ $W    / _' | '__/ __| '_ \ $B| | | '_ \| | | \ \/ /
    $B/##.-.##\ $W  | (_| | | | (__| | | |$B| | | | | | |_| |>  <  
   $B/##(   )##\ $W  \__,_|_|  \___|_| |_|$B|_|_|_| |_|\__,_/_/\_\\
  $B/#.--   --.#\ $W
 $B/'           '\ 
" >> $motd

echo -e "$G---------------------------------------------------------------" >> $motd
echo -e "$W   Good $TIME$A $USERNAME$W! You're Logged Into $A$HOSTNAME$W! " >> $motd
echo -e "$G---------------------------------------------------------------" >> $motd
echo -e "$B    KERNEL $G:$W $KERNEL $ARCH                                 " >> $motd
echo -e "$B       CPU $G:$W $CPU                                          " >> $motd
echo -e "$B    MEMORY $G:$W $MEMORY1 / $MEMORY2                           " >> $motd
echo -e "$B    LV USE $G:$W $DISC                          	          " >> $motd
echo -e "$B  SWAP USE $G:$W `free -m | tail -n 1 | awk '{print $3}'` MB   " >> $motd
echo -e "$G---------------------------------------------------------------" >> $motd
echo -e "$B  LOAD AVG $G:$W $LOAD1, $LOAD5, $LOAD15		          " >> $motd
echo -e "$B    UPTIME $G:$W $upDays days $upHours hours $upMins minutes $upSecs seconds " >> $motd
echo -e "$B PROCESSES $G:$W You are running $PSU of $PSA processes        " >> $motd
echo -e "$B  HOSTNAME $G:$W $HOSTNAME                                     " >> $motd
echo -e "$B    PACMAN $G:$W $PACMAN packages can be updated               " >> $motd
echo -e "$B     USERS $G:$W `users | wc -w` users logged in 	          " >> $motd
echo -e "$G---------------------------------------------------------------" >> $motd
echo -e "  $W Please do not share your login and use sudo for root access " >> $motd
echo -e "$G---------------------------------------------------------------" >> $motd
echo -e "$N" >> $motd

Last edited by sjjones85 (2014-04-17 17:22:12)

Offline

#2 2014-04-17 16:44:37

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Issue with Gnome 3.12 login and MOTD

sjjones85, welcome to the forums. Please read our forum rules. Do not post full size images. Make use of a image hosting website and post a link or thumbnail here.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2014-04-17 17:23:03

sjjones85
Member
From: UK
Registered: 2014-04-17
Posts: 2
Website

Re: Issue with Gnome 3.12 login and MOTD

Inxsible, my apologies, hope the thumbnail is better now. Thanks for the welcome too, although I've lurked as a reader for a while smile

Offline

#4 2017-01-15 13:38:20

sunaurus
Member
Registered: 2016-12-22
Posts: 3

Re: Issue with Gnome 3.12 login and MOTD

I hope it's alright to post a solution in this thread despite it being quite old, as it's the first relevant google result I found when looking for help with this issue.

I had exactly the same problem - after writing some text in my /etc/motd, gdm started displaying it on login and the login process became extremely slow. After doing some digging, I found that this is because of pam_motd.so, which is loaded in /etc/pam.d/system-login (system-login is included in system-local-login, system-local-login is included in gdm-password).

I wanted to solve this by somehow excluding pam_motd.so directly in /etc/pam.d/gdm-password, but I couldn't figure out how to do this, so I ended up simply moving the following line:

session    optional   pam_motd.so          motd=/etc/motd

from /etc/pam.d/system-login to /etc/pam.d/sshd.

The result is that the motd is no longer displayed in gdm, but it's still displayed when logging in through ssh.

Offline

#5 2017-01-15 15:29:44

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,783
Website

Re: Issue with Gnome 3.12 login and MOTD

Thanks for sharing, sunaurus, and bringing some closure to this problem. As you noted, this thread is quite old, so I'm going to close it now.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB