I am trying to login to my Ubuntu desktop after updating a bunch of packages and rebooting. I know I am authenticating successfully but what seems to happen is that after I enter my username and password, the screen temporarily switches to all black, and then the login page is loaded again.

I'm not sure where to look to find any errors related to this. Any suggestions would be appreciated.


UPDATE: If I pick failsafe GNOME from the sessions list, I can login fine. Any ideas?


UPDATE 2: Here is the output from ~/.xsession-errors:

/etc/gdm/Xsession: Beginning session setup...
/etc/profile.d/p4c.sh: 8: Syntax error: "(" unexpected

p4c.sh is a script that I copied from my previous Ubuntu system - where it worked fine. Here are the contents of p4c.sh:

#!/bin/bash

# p4c() function setup params
p4_HOST=`hostname | awk -F . '{print $1}'`

# function for setting the P4CLIENT variable based on the first non-option
# argument provided
function p4client() {
    HELP_MODE=''
    VERBOSE_MODE=''
    DESC_MODE=''
    SHORT_MODE=''
    while getopts ":hdsv" option
    do
        case $option in
            h) echo "p4c provides information about perforce clients."
               echo "Recognized arguments:"
               echo "    -h     help (this message)"
               echo "    -d     descriptions (prints client descriptions - useful, but slightly slower)"
               echo "    -v     verbose (print unreasonable amounts of debugging info"
               echo
               # About to exit - reset OPTIND or we'll be in trouble later.
               OPTIND=1
               # Abort
               return
               ;;
            v) VERBOSE_MODE='verbose';;
            d) DESC_MODE='descriptions';;
            s) SHORT_MODE='short';;
            *) echo "Unknown option '$OPTARG'!  Specify -h for help..."
               # About to exit - reset OPTIND or we'll be in trouble later.
               OPTIND=1
               # Abort
               return
               ;;
        esac
    done

    # Set argument pointer to first non-option argument
    shift $(($OPTIND - 1))

    # Done with OPTIND - better reset it before something bad happens...
    OPTIND=1

    PROJECT=$1;
    if [ $VERBOSE_MODE ]
    then
        echo "PROJECT: $PROJECT"
    fi

    # Need to check/set p4_USER every time to allow changes between invocations
    if [ -z "$p4c_USER" ]
    then
        p4_USER=`echo $P4USER`
        if [ -z "$p4_USER" ]
        then
            p4_USER=`id -nu`
        fi
    else
        p4_USER=$p4c_USER
    fi
    if [ $VERBOSE_MODE ]
    then
        echo "p4_USER: $p4_USER"
    fi


    if [ -n "$PROJECT" ]
    then
        # provided a non empty string project name
        p4_CLIENT=$p4_HOST-$p4_USER-$PROJECT
        if [ $VERBOSE_MODE ]
        then
            echo "p4_CLIENT: $p4_CLIENT"
        fi

        # check client to see if it exists
        p4_GREP_RESULT=`p4 clients | grep "$p4_CLIENT"`
        if [ -z "$p4_GREP_RESULT" ]
        then
            echo "NOTE: P4 client \"$p4_CLIENT\" does not exist on server."
            echo "Setting P4CLIENT anyway so that client \"$p4_CLIENT\" can be created."
            echo
        fi

        export P4CLIENT=$p4_CLIENT;
    else
        # check for client matches
        p4_GREP_RESULT=`p4 clients | egrep "($p4_HOST-$p4_USER-|$p4_USER-$p4_HOST-)" | awk '{print $2;}'`
        echo "Known workspaces for user $p4_USER, host $p4_HOST:"
        if [ -z

Solution 1:

You should either remove the function keyword or the parentheses () on that line. This is implemented a little inconsistent across different bash versions --- probably your update introduced some incompatible version of bash.

For me

nameofsomefunction() {
   ...
}

works most of the time.