A power failure a couple of weeks ago broke the one node in our HA cluster - 3 of the 4 drbd nodes reported an invalid media type, so it could not mount them. We are stuck on version 13 due to having HA, PBXact branded. Thankfully, the HA aspect worked & we’ve been running on the secondary while FedEx took their sweet time bringing me the drive. (I could’ve done a reinstall on the same drive, but would rather save it in case I need some of the configs.) I bought a replacement drive of the same model/size & have reinstalled it, but ran into an issue. Every time the server boots, it hangs for a while and then says:
Some firstboot error occured, and the system is not properly setup.
Check to see if you have internet access and re-run /etc/pbx_first_boot.sh
Press ctrl-alt-f1 to continue
I do not remember doing anything like this when installing the system in the past, so I looked at this file:
#!/bin/bash
# OUTPUT
if grep 'debug' /installed-version
then
echo "SKIPPING THE DEFAULT RUN OF FIRSTBOOT"
sleep 5
exit 0
else
echo "STARTING PBX FIRST BOOT"
fi
log_info(){
echo "${@}" >> /dev/tty8
}
# LOGGING TO TTY8 and logfile
ORIGCONSOLE=$(fgconsole)
echo "starting on console 8, myconsole = ${ORIGCONSOLE}"
sleep 1
chvt 8
set -x -v
exec > /var/log/pbx/install/firstboot.log
exec 2>&1
#INCLUDING stringent.sh
# stringent.sh copyright michael potter 2008
# stringent.sh is intended to reduce the problems associated with
# using bash by turning on bash options that make errors more
# apparent. This will not eliminate problems and I am sure there
# is some case where some problem will be made worse.
# USE AT YOUR OWN RISK.
set -o errexit # errexit first
set -o nounset
set -o pipefail # if you fail on this line, get a newer version of bash.
function traperr
{
declare -i i;
declare -i nestlevel;
declare Message=${1:-""}
nestlevel=${#FUNCNAME[@]}
if (( $nestlevel <= 2 ))
then
echo "ERROR: ${BASH_SOURCE[1]}:${BASH_LINENO[0]} $Message" >&2
else
echo "ERROR: ${FUNCNAME[1]}(${BASH_SOURCE[1]}:~${BASH_LINENO[0]}) $Message" >&2
for (( i = 2 ; i < $nestlevel ; i++ ))
do
echo " ${FUNCNAME[$i]}(${BASH_SOURCE[$i]}:~${BASH_LINENO[($i-1)]})" >&2
done
fi
# if BASH_SUBSHELL is 0, then script will exit anyway.
if (( $BASH_SUBSHELL >= 3 ))
then
kill $$
fi
echo -e "Some firstboot error occured, and the system is not properly setup.\nCheck to see if you have internet access and re-run /etc/pbx_first_boot.sh\nPress ctrl-alt-f1 to continue" >> /dev/tty8
exit 1
}
function traperrsimple
{
# Use this function if the above function fails
echo "ERROR: ${BASH_SOURCE[0]} ${LINENO}" >&2
# if BASH_SUBSHELL is 0, then script will exit anyway.
if (( $BASH_SUBSHELL >= 1 ))
then
kill $$
fi
}
set -o errtrace
trap traperr ERR
function errexiton
{
set -o errexit
trap traperr ERR
}
function errexitoff
{
set +o errexit
trap '' ERR
}
#END INCLUDE
log_info "Testing for internet access"
INTERFACE=$(ip route show | awk ' /^default/ { print $5 }')
MACADDR=$(ip -o link show ${INTERFACE} | awk '/link/ {print $13}')
MACHASH=$(echo -en ${MACADDR} | md5sum - | awk '/-/ {print $1}')
ARCH=$(uname -m)
FREEPBXVERS=$(head -n 1 /etc/schmooze/pbx-version)
INSTALLTYPE=$(cat /installed-version | sed -e 's/.*kickstart-\([^.]*\).*/\1/')
BRAND_RETURN=$(curl -k -s -m 30 -A "Get Brand" } https://push2.schmoozecom.com/deployment/brand)
MYBRAND=$(echo ${BRAND_RETURN} | python -c 'import simplejson as json,sys;obj=json.loads(sys.stdin.read());print obj["brand"]')
if [[ -n ${MYBRAND} ]]
then
echo ${MYBRAND} > /etc/schmooze/pbx-brand
fi
BRAND=$(head -n 1 /etc/schmooze/pbx-brand)
UARETURN=$(curl -s -m 30 -A "FreePBX Firstboot ${BRAND}-${FREEPBXVERS} ${ARCH} ${INSTALLTYPE}" --data mac=${MACADDR} --data mhash=${MACHASH} http://kickstart.freepbxdistro.org/install-log/)
echo ${UARETURN} | grep 'passed'
log_info "Internet Access Test Passed"
errexitoff
# pull in all freepbx modules and load them
log_info ""
log_info "Updating all FreePBX modules. This can take 5-10 Minutes."
#Update all Modules now to make sure they are current
/usr/sbin/fwconsole ma installlocal
# Refresh Signatures due to issue with HA module and 32bit
/usr/sbin/fwconsole ma refreshsignatures
# Reload dialplan now
/usr/sbin/fwconsole chown
/usr/sbin/fwconsole r
# Write out apache conf.d files
/etc/init.d/incrond restart
/var/www/html/admin/modules/sysadmin/hooks/update-ports
# Stop iSymphony
/etc/init.d/iSymphonyServerV3 stop
errexiton
rm -rf /tmp/*
log_info ""
log_info "Running updatedb to update DB for locate command. This can take a minute."
updatedb
# if we've made it to this point, things have worked (minus the error exit stuff)
# Remove the entry from firstboot
log_info ""
log_info "Firstboot has finished, removing firstboot script"
rm -rf /etc/pbx_first_boot.sh
sed -i '/\/etc\/pbx_first_boot.sh/d' /etc/rc.d/rc.local
log_info ""
log_info ""
log_info ""
log_info "Install is now 100% complete"
chvt ${ORIGCONSOLE}
Not really knowing what this does, I began copy/pasting line by line into a console to see if I could figure out why it doesn’t seem to think there’s internet access. (There is.) This line seems to be the problem:
UARETURN=$(curl -s -m 30 -A "FreePBX Firstboot ${BRAND}-${FREEPBXVERS} ${ARCH} ${INSTALLTYPE}" --data mac=${MACADDR} --data mhash=${MACHASH} http://kickstart.freepbxdistro.org/install-log/)
Running curl with the same parameters only without -s (silent) results in a timeout after 30 seconds. If I load http://kickstart.freepbxdistro.org/install-log/ directly in a browser, I get this:
{"status":"failed","data":{"ua":"user agent string","ipaddr":"aaa.bbb.ccc.ddd","test":0},"errormsg":"Mac Hash did not match"}
This makes sense, since I’m not sending along any of the data the site expects from my PC’s browser. No matter what I’ve done, this site does not connect from curl on the PBX. I’ve done a yum update, but it had no impact. My hunch is that something on this site has been changed since mid-2019 (which is when I last did an install on either of these systems) which is preventing the old version of curl included in version 13 from getting a response.
Anyone have any ideas?