I'm having this same issue. The only difference is I forgot mysql root password, so I need to start mysql in the safe mode. Any progress on "IRedAPD upgrade" issue listed by hk@? I did the upgrade_iredapd.sh with the -xv options and got the following:
#!/usr/bin/env bash
# Author: Zhang Huangbin <zhb@iredmail.org>
# Purpose: Upgrade iRedAPD from old release.
# USAGE:
#
# * Download the latest iRedAPD from iRedMail web site.
# http://www.iredmail.org/yum/misc/
#
# * Extract downloaded iRedAPD
# * Enter 'tools/' directory and execute script 'upgrade_iredapd.sh' as
# root user:
#
# # cd /opt/iRedAPD-xxx/tools/
# # bash upgrade_iredapd.sh
export SYS_ROOT_USER='root'
+ export SYS_ROOT_USER=root
+ SYS_ROOT_USER=root
export SYS_ROOT_GROUP='root'
+ export SYS_ROOT_GROUP=root
+ SYS_ROOT_GROUP=root
export IREDAPD_DAEMON_USER='iredapd'
+ export IREDAPD_DAEMON_USER=iredapd
+ IREDAPD_DAEMON_USER=iredapd
export IREDAPD_DAEMON_GROUP='iredapd'
+ export IREDAPD_DAEMON_GROUP=iredapd
+ IREDAPD_DAEMON_GROUP=iredapd
export IREDAPD_LOG_DIR='/var/log/iredapd'
+ export IREDAPD_LOG_DIR=/var/log/iredapd
+ IREDAPD_LOG_DIR=/var/log/iredapd
export IREDAPD_LOG_FILE="${IREDAPD_LOG_DIR}/iredapd.log"
+ export IREDAPD_LOG_FILE=/var/log/iredapd/iredapd.log
+ IREDAPD_LOG_FILE=/var/log/iredapd/iredapd.log
# PostgreSQL system user.
export PGSQL_SYS_USER='postgres'
+ export PGSQL_SYS_USER=postgres
+ PGSQL_SYS_USER=postgres
export PGSQL_SYS_GROUP='postgres'
+ export PGSQL_SYS_GROUP=postgres
+ PGSQL_SYS_GROUP=postgres
# Check OS to detect some necessary info.
export KERNEL_NAME="$(uname -s | tr '[a-z]' '[A-Z]')"
uname -s | tr '[a-z]' '[A-Z]'
++ uname -s
++ tr '[a-z]' '[A-Z]'
+ export KERNEL_NAME=LINUX
+ KERNEL_NAME=LINUX
export RC_SCRIPT_NAME='iredapd'
+ export RC_SCRIPT_NAME=iredapd
+ RC_SCRIPT_NAME=iredapd
# Path to some programs.
export PYTHON_BIN='/usr/bin/python'
+ export PYTHON_BIN=/usr/bin/python
+ PYTHON_BIN=/usr/bin/python
export MD5_BIN='md5sum'
+ export MD5_BIN=md5sum
+ MD5_BIN=md5sum
if [ X"${KERNEL_NAME}" == X'LINUX' ]; then
export DIR_RC_SCRIPTS='/etc/init.d'
if [ -f /etc/redhat-release ]; then
# RHEL/CentOS
export DISTRO='RHEL'
export IREDADMIN_CONF_PY='/var/www/iredadmin/settings.py'
export CRON_SPOOL_DIR='/var/spool/cron'
elif [ -f /etc/lsb-release ]; then
# Ubuntu
export DISTRO='UBUNTU'
if [ -f '/usr/share/apache2/iredadmin/settings.py' ]; then
export IREDADMIN_CONF_PY='/usr/share/apache2/iredadmin/settings.py'
elif [ -f '/opt/www/iredadmin/settings.py' ]; then
export IREDADMIN_CONF_PY='/opt/www/iredadmin/settings.py'
fi
export CRON_SPOOL_DIR='/var/spool/cron/crontabs'
elif [ -f /etc/debian_version ]; then
# Debian
export DISTRO='DEBIAN'
if [ -f '/usr/share/apache2/iredadmin/settings.py' ]; then
export IREDADMIN_CONF_PY='/usr/share/apache2/iredadmin/settings.py'
elif [ -f '/opt/www/iredadmin/settings.py' ]; then
export IREDADMIN_CONF_PY='/opt/www/iredadmin/settings.py'
fi
export CRON_SPOOL_DIR='/var/spool/cron/crontabs'
elif [ -f /etc/SuSE-release ]; then
# openSUSE
export DISTRO='SUSE'
export IREDADMIN_CONF_PY='/srv/www/iredadmin/settings.py'
export CRON_SPOOL_DIR='/var/spool/cron'
else
echo "<<< ERROR >>> Cannot detect Linux distribution name. Exit."
echo "Please contact support@iredmail.org to solve it."
exit 255
fi
elif [ X"${KERNEL_NAME}" == X'FREEBSD' ]; then
export DISTRO='FREEBSD'
export SYS_ROOT_GROUP='wheel'
export PGSQL_SYS_USER='pgsql'
export DIR_RC_SCRIPTS='/usr/local/etc/rc.d'
export IREDADMIN_CONF_PY='/usr/local/www/iredadmin/settings.py'
export CRON_SPOOL_DIR='/var/cron/tabs'
export PYTHON_BIN='/usr/local/bin/python'
export MD5_BIN='md5'
elif [ X"${KERNEL_NAME}" == X'OPENBSD' ]; then
export DISTRO='OPENBSD'
export SYS_ROOT_GROUP='wheel'
export PGSQL_SYS_USER='_postgresql'
export DIR_RC_SCRIPTS='/etc/rc.d'
export IREDADMIN_CONF_PY='/var/www/iredadmin/settings.py'
export CRON_SPOOL_DIR='/var/cron/tabs'
export PYTHON_BIN='/usr/local/bin/python'
export MD5_BIN='md5'
else
echo "Cannot detect Linux/BSD distribution. Exit."
echo "Please contact author iRedMail team <support@iredmail.org> to solve it."
exit 255
fi
+ '[' XLINUX == XLINUX ']'
+ export DIR_RC_SCRIPTS=/etc/init.d
+ DIR_RC_SCRIPTS=/etc/init.d
+ '[' -f /etc/redhat-release ']'
+ '[' -f /etc/lsb-release ']'
+ export DISTRO=UBUNTU
+ DISTRO=UBUNTU
+ '[' -f /usr/share/apache2/iredadmin/settings.py ']'
+ export IREDADMIN_CONF_PY=/usr/share/apache2/iredadmin/settings.py
+ IREDADMIN_CONF_PY=/usr/share/apache2/iredadmin/settings.py
+ export CRON_SPOOL_DIR=/var/spool/cron/crontabs
+ CRON_SPOOL_DIR=/var/spool/cron/crontabs
export CRON_FILE_ROOT="${CRON_SPOOL_DIR}/${SYS_ROOT_USER}"
+ export CRON_FILE_ROOT=/var/spool/cron/crontabs/root
+ CRON_FILE_ROOT=/var/spool/cron/crontabs/root
# iRedAPD directory and config file.
export IREDAPD_ROOT_DIR="/opt/iredapd"
+ export IREDAPD_ROOT_DIR=/opt/iredapd
+ IREDAPD_ROOT_DIR=/opt/iredapd
export IREDAPD_CONF_PY="${IREDAPD_ROOT_DIR}/settings.py"
+ export IREDAPD_CONF_PY=/opt/iredapd/settings.py
+ IREDAPD_CONF_PY=/opt/iredapd/settings.py
export IREDAPD_CONF_INI="${IREDAPD_ROOT_DIR}/settings.ini"
+ export IREDAPD_CONF_INI=/opt/iredapd/settings.ini
+ IREDAPD_CONF_INI=/opt/iredapd/settings.ini
# Used in iRedMail cluster and iRedMail-Pro edition.
export IREDAPD_CUSTOM_CONF="${IREDAPD_ROOT_DIR}/custom_settings.py"
+ export IREDAPD_CUSTOM_CONF=/opt/iredapd/custom_settings.py
+ IREDAPD_CUSTOM_CONF=/opt/iredapd/custom_settings.py
# Remove all single quote and double quotes in string.
strip_quotes()
{
# Read input from stdin
str="$(cat <&0)"
value="$(echo ${str} | tr -d '"' | tr -d "'")"
echo "${value}"
}
get_iredapd_setting()
{
# Usage: get_iredapd_setting <path_to_config_file> <var_name>
conf_py="${1}"
var="${2}"
value="$(grep "^${var}" ${conf_py} | awk '{print $NF}' | strip_quotes)"
echo "${value}"
}
install_pkg()
{
echo "Install package: $@"
if [ X"${DISTRO}" == X'RHEL' ]; then
yum -y install $@
elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
apt-get install -y --force-yes $@
elif [ X"${DISTRO}" == X'FREEBSD' ]; then
cd /usr/ports/$@ && make install clean
elif [ X"${DISTRO}" == X'OPENBSD' ]; then
pkg_add -r $@
else
echo "<< ERROR >> Please install package(s) manually: $@"
fi
}
has_python_module()
{
for mod in $@; do
python -c "import $mod" &>/dev/null
if [ X"$?" == X'0' ]; then
echo 'YES'
else
echo 'NO'
fi
done
}
# Check /root/.my.cnf. This will make sql related changes much simpler.
if [ -f ${IREDAPD_CONF_PY} ]; then
if egrep '^backend.*(mysql|ldap)' ${IREDAPD_CONF_PY} &>/dev/null; then
if [ ! -f /root/.my.cnf ]; then
echo "<<< ERROR >>> File /root/.my.cnf not found."
echo "<<< ERROR >>> Please add mysql root user and password in it like below, then run this script again."
cat <<EOF
[client]
host=127.0.0.1
port=3306
user=root
password="plain_password"
EOF
exit 255
fi
# Check MySQL connection
mysql -e "SHOW DATABASES" &>/dev/null
if [ X"$?" != X'0' ]; then
echo "<<< ERROR >>> MySQL root user name or password is incorrect in /root/.my.cnf, please double check."
exit 255
fi
fi
fi
+ '[' -f /opt/iredapd/settings.py ']'
+ egrep '^backend.*(mysql|ldap)' /opt/iredapd/settings.py
+ '[' '!' -f /root/.my.cnf ']'
+ mysql -e 'SHOW DATABASES'
+ '[' X1 '!=' X0 ']'
+ echo '<<< ERROR >>> MySQL root user name or password is incorrect in /root/.my.cnf, please double check.'
<<< ERROR >>> MySQL root user name or password is incorrect in /root/.my.cnf, please double check.
+ exit 255
Any ideas?