Support Questions
Find answers, ask questions, and share your expertise

ambari-server setup fails /usr/sbin/ambari-server: line 91: line: unbound variable

ambari-server setup fails /usr/sbin/ambari-server: line 91: line: unbound variable

Hello Team,

I m trying to install ambari server in my offline redhat I proceded the installation provided here https://docs.hortonworks.com/HDPDocuments/Ambari-2.7.0.0/bk_ambari-installation/content/ch_using-loc... I installed ambari successfully but when I run ambari-server setup it gives this error " /usr/sbin/ambari-server: line 91: line: unbound variable"

any help please

3 REPLIES 3

Re: ambari-server setup fails /usr/sbin/ambari-server: line 91: line: unbound variable

Any WARN or ERROR entries on ambari-server.log?
Checking the ambari-server 2.7 server script at line 91, this is where the script checks the installed PYTHON version.

https://github.com/apache/ambari/blob/release-2.7.0/ambari-server/sbin/ambari-server#L91

# check for version
majversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f1`
minversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f2`
numversion=$(( 10 * $majversion + $minversion))
if (( $numversion < 26 )); then
  echo "Need python version > 2.6"
  exit 1
fi
echo "Using python " $PYTHON

Earlier in the script, we have PYTHON_WRAP="$ROOT/usr/bin/ambari-python-wrap"

Is this available and do we have execute permissions on ambari-python-wrap? Which python version are you using?

Re: ambari-server setup fails /usr/sbin/ambari-server: line 91: line: unbound variable

@Jonatha SneepThanks for your quick response, /var/log/ambari-server/ is empty there is no log file, also I did found /usr/bin/ambari-python-wrap file, I m using python 2.7.5 , I installed ambari-server with nos internet access in a single node.

Re: ambari-server setup fails /usr/sbin/ambari-server: line 91: line: unbound variable

Hi @chaouki trabelsi

To make things maybe easiest you could set the PYTHON env before running
from:https://github.com/apache/ambari/blob/release-2.7.0/ambari-server/sbin/ambari-server#L68

if [ -z "${PYTHON:-}" ] ; then
  export PYTHON=`readlink $PYTHON_WRAP`
fi

Before starting the ambari-server install can you set the PYTHON environment variable or set PYTHON in /etc/profile (and source it) to point it to the location of your python 2.7 bin?

Ex

export PYTHON=/usr/path/your/location/bin/python2.7