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.
]]>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:
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