powered by Jive Software

Openfire losing config after reboot CentOS 7

I’d installed Openfire 4.0.3 into a new CenOS 7, and now I am having problems with lost of configuration after rebooting OS. Clients can’t connect and administrators can’t sign in to Openfire admin area. Everytime when I need to reboot my CentOS, I need to edit /opt/openfire/conf/openfire.xml and change setup = true, to reconfigure all again. I had lucky that I’m using external database (MySQL) to store data, thus avoiding further losses. Someone could help me to identify the problem? I attached my logs. Thank you.
warn.log.zip (773 Bytes)
info.log.zip (1414 Bytes)
error.log.zip (1347 Bytes)
all.log.zip (1903 Bytes)

Did you install Openfire with the RPM provided by this website?

Are you running openfire via the sysvinit (systemd) script? systemctl start openfire

rpm -Va openfire output would be useful as well.

Yes, I did. I running openfire via the ntsysv, automaticaly.

This ‘rpm -Va openfire’ results in:

rpm -Va openfire

S.5…T. c /opt/openfire/conf/openfire.xml

S.5…T. c /opt/openfire/conf/security.xml

S.5…T. c /opt/openfire/resources/security/keystore

S.5…T. c /opt/openfire/resources/security/truststore

This mean it is all right?!

ll /opt/openfire/

total 244

drwxr-xr-x 2 daemon daemon 91 Ago 22 14:25 bin

-rw-r–r-- 1 daemon daemon 211535 Ago 19 10:19 changelog.html

drwxr-xr-x 2 daemon daemon 4096 Set 1 09:59 conf

drwxr-xr-x 4 daemon daemon 28 Ago 19 10:19 documentation

drwxr-xr-x 2 daemon daemon 54 Ago 1 09:07 embedded-db

drwxr-xr-x 6 daemon daemon 4096 Ago 22 14:25 jre

drwxr-xr-x 2 daemon daemon 4096 Ago 22 14:25 lib

-rw-r–r-- 1 daemon daemon 10871 Ago 19 10:19 LICENSE.html

drwxr-xr-x 2 daemon daemon 139 Ago 22 14:27 logs

drwxr-xr-x 3 daemon daemon 19 Mar 18 2015 monitoring

drwxr-xr-x 8 daemon daemon 4096 Ago 22 14:26 plugins

-rw-r–r-- 1 daemon daemon 5332 Ago 19 10:19 README.html

drwxr-xr-x 7 daemon daemon 76 Ago 19 10:19 resources

— // —

cat /etc/rc.d/init.d/openfire

#!/bin/sh

openfire Stops and starts the Openfire XMPP service.

chkconfig: 2345 99 1

description: Openfire is an XMPP server, which is a server that facilitates \

XML based communication, such as chat.

config: /opt/openfire/conf/openfire.xml

config: /etc/sysconfig/openfire

pidfile: /var/run/openfire.pid

This script has currently been tested on Redhat, CentOS, and Fedora based

systems.

Begin setup work

Initialization

PATH="/sbin:/bin:/usr/bin:/usr/sbin"

RETVAL=0

Check that we are root … so non-root users stop here.

if [ “id -u” != 0 ]; then

    echo $0 must be run as root

    exit 1

fi

Get config.

[ -f “/etc/sysconfig/openfire” ] && . /etc/sysconfig/openfire

if [ -f “/etc/init.d/functions” ]; then

FUNCTIONS_FOUND=true

. /etc/init.d/functions

fi

If openfire user is not set in sysconfig, set to daemon.

[ -z “$OPENFIRE_USER” ] && OPENFIRE_USER=“daemon”

If pid file path is not set in sysconfig, set to /var/run/openfire.pid.

[ -z “$OPENFIRE_PIDFILE” ] && OPENFIRE_PIDFILE="/var/run/openfire.pid"

-----------------------------------------------------------------

If a openfire home variable has not been specified, try to determine it.

if [ -z “$OPENFIRE_HOME” -o ! -d “$OPENFIRE_HOME” ]; then

    if [ -d "/usr/share/openfire" ]; then

            OPENFIRE_HOME="/usr/share/openfire"

    elif [ -d "/usr/local/openfire" ]; then

            OPENFIRE_HOME="/usr/local/openfire"

    elif [ -d "/opt/openfire" ]; then

            OPENFIRE_HOME="/opt/openfire"

    else

            echo "Could not find Openfire installation under /opt, /usr/share, or /usr/local."

            echo "Please specify the Openfire installation location as variable OPENFIRE_HOME"

            echo "in /etc/sysconfig/openfire."

            exit 1

    fi

fi

If log path is not set in sysconfig, set to $OPENFIRE_HOME/logs.

[ -z “$OPENFIRE_LOGDIR” ] && OPENFIRE_LOGDIR="${OPENFIRE_HOME}/logs"

Attempt to locate java installation.

if [ -z “$JAVA_HOME” ]; then

    if [ -d "${OPENFIRE_HOME}/jre" ]; then

            JAVA_HOME="${OPENFIRE_HOME}/jre"

    elif [ -d "/etc/alternatives/jre" ]; then

            JAVA_HOME="/etc/alternatives/jre"

    else

            jdks=`ls -r1d /usr/java/j*`

            for jdk in $jdks; do

                    if [ -f "${jdk}/bin/java" ]; then

                            JAVA_HOME="$jdk"

                            break

                    fi

            done

    fi

fi

JAVACMD="${JAVA_HOME}/bin/java"

if [ ! -d “$JAVA_HOME” -o ! -x “$JAVACMD” ]; then

    echo "Error: JAVA_HOME is not defined correctly."

    echo "       Can not sure execute $JAVACMD."

    exit 1

fi

Prepare location of openfire libraries

OPENFIRE_LIB="${OPENFIRE_HOME}/lib"

Prepare openfire command line

OPENFIRE_OPTS="${OPENFIRE_OPTS} -DopenfireHome=${OPENFIRE_HOME} -Dopenfire.lib.dir=${OPENFIRE_LIB}"

Prepare local java class path

if [ -z “$LOCALCLASSPATH” ]; then

    LOCALCLASSPATH="${OPENFIRE_LIB}/startup.jar"

else

    LOCALCLASSPATH="${OPENFIRE_LIB}/startup.jar:${LOCALCLASSPATH}"

fi

Export any necessary variables

export JAVA_HOME JAVACMD

Lastly, prepare the full command that we are going to run.

OPENFIRE_RUN_CMD="${JAVACMD} -server ${OPENFIRE_OPTS} -classpath “${LOCALCLASSPATH}” -jar “${OPENFIRE_LIB}/startup.jar”"

End setup work

start() {

    OLD_PWD=`pwd`

    cd $OPENFIRE_LOGDIR

    PID=$(findPID)

    if [ -n "$PID" ]; then

        echo "Openfire is already running."

        RETVAL=1

        return

    fi

    # Start daemons.

    echo -n "Starting openfire: "

    rm -f nohup.out

    su -s /bin/sh -c "nohup $OPENFIRE_RUN_CMD > $OPENFIRE_LOGDIR/nohup.out 2>&1 &" $OPENFIRE_USER

    RETVAL=$?

    echo

    [ $RETVAL -eq 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/openfire

    sleep 1 # allows prompt to return

    PID=$(findPID)

    echo $PID > $OPENFIRE_PIDFILE

    cd $OLD_PWD

}

stop() {

    # Stop daemons.

    echo -n "Shutting down openfire: "

    if [ -f "$OPENFIRE_PIDFILE" ]; then

            killproc -p $OPENFIRE_PIDFILE -d 10

            rm -f $OPENFIRE_PIDFILE

    else

            PID=$(findPID)

            if [ -n $PID ]; then

                    kill $PID

            else

                    echo "Openfire is not running."

            fi

    fi

    RETVAL=$?

    echo

    [ $RETVAL -eq 0 -a -f "/var/lock/subsys/openfire" ] && rm -f /var/lock/subsys/openfire

}

restart() {

    stop

    sleep 10 # give it a few moments to shut down

    start

}

condrestart() {

    [ -e "/var/lock/subsys/openfire" ] && restart

    return 0

}

status() {

    PID=$(findPID)

    if [ -n "$PID" ]; then

            echo "openfire is running"

            RETVAL=0

    else

            echo "openfire is not running"

            RETVAL=1

    fi

}

findPID() {

    echo `ps ax --width=1000 | grep openfire | grep startup.jar | awk '{print $1}'`

}

Handle how we were called.

case “$1” in

    start)

            start

            ;;

    stop)

            stop

            ;;

    restart)

            restart

            ;;

    condrestart)

            condrestart

            ;;

    status)

            status

            ;;

    *)

            echo "Usage $0 {start|stop|restart|status|condrestart}"

            RETVAL=1

esac

exit $RETVAL

Try to ‘ls -l /opt/openfire/conf/openfire.xml && chmod 777 /opt/openfire/conf/openfire.xml’ before starting openfire. Set the permissions back to something save after the initial configuration.

‘cat /opt/openfire/conf/openfire.xml’ to make sure that it contains your setup data.

Thank you for the tips but it didn’t work. My steps were:

cat /opt/openfire/conf/openfire.xml

here I copied the 1st result for after compare

ls -l /opt/openfire/conf/openfire.xml

-rw-r–r-- 1 daemon daemon 2432 Set 2 15:56 /opt/openfire/conf/openfire.xml

chmod 777 /opt/openfire/conf/openfire.xml

ls -l /opt/openfire/conf/openfire.xml

-rwxrwxrwx 1 daemon daemon 2432 Ago 22 14:28 /opt/openfire/conf/openfire.xml

service openfire restart

here I detected that Openfire lost the config again

vim /opt/openfire/conf/openfire.xml

I changed true to false

service openfire restart

now I made sure that all is all right after reconfiguring Openfire through web browser

chmod 644 /opt/openfire/conf/openfire.xml

ls -l /opt/openfire/conf/openfire.xml

-rw-r–r-- 1 daemon daemon 2432 Set 2 15:45 /opt/openfire/conf/openfire.xml

cat /opt/openfire/conf/openfire.xml

here I copied the 2nd result for the comparison; conclusion: no changes

service openfire restart

again openfire lost config

The openfire.xml should have changed?

Yes it should change. If I got it right the only change you see is false to true which is odd.

Sorry, yes, you are right, only " true/false" has been changed. I forgot to mention it because I copied the openfire.xml content before change this tag.

Following the same idea, I tried change daemon to root owner in openfire.xml, but I got the same result, the Openfire lost config again.