Asterisk won't start, can't connect to Asterisk console with '-r' parameter

Installing HAAst, prerequisites, getting HAAst started, and troubleshooting performance and technical issues. As well, upgrades to HAAst and any underlying software.
Post Reply
User avatar
CRM User
Posts: 139
Joined: Sun Nov 27, 2016 3:41 pm

Asterisk won't start, can't connect to Asterisk console with '-r' parameter

Post by CRM User » Thu Apr 05, 2018 3:18 pm

I have setup HAAst correctly and I see that HAAst attempts to start Asterisk. However, it appears that Asterisk fails to start. I have narrowed this down to a permissions issue, and Asterisk is unable to create the pid file in /var/run/asterisk/

As a result I can't connect to Asterisk using the 'asterisk -r' command, and the PBX doesn't start (so HAAst fails over to the peer).

I am running Debian 9 with Asterisk 14. I don't use any configuration generator. How do I fix this?
Account for questions transferred from CRM system
User avatar
Telium Support
Posts: 185
Joined: Sun Nov 27, 2016 3:27 pm

Re: Asterisk won't start, can't connect to Asterisk console with '-r' parameter

Post by Telium Support » Thu Apr 05, 2018 3:21 pm

The root cause of your problem is a regression (bug) in your Linux distro. There have been similar Linux regressions noted by Digium in the past (eg: https://issues.asterisk.org/jira/browse/ASTERISK-15603)

The solution is to use the HAAst event handler to create the missing directory for Asterisk, before Asterisk even starts.

Create the file /usr/local/haast/events/asterisk.start.pre with the following contents:

Code: Select all

#!/bin/bash
If [ ! -d /var/run/asterisk ] ; then
  mkdir /var/run/asterisk
  chown asterisk:asterisk /var/run/asterisk
fi
and set the permissions on /usr/local/haast/events/asterisk.start.pre to 550:

Code: Select all

chmod 550 /usr/local/haast/events/asterisk.start.pre
Note: The event handler system (including use of the asterisk.start.pre file) is restricted to the Commercial Unlimited edition of HAAst only.
Post Reply