Can't start Asterisk exit code 158

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: 175
Joined: Sun Nov 27, 2016 3:41 pm

Can't start Asterisk exit code 158

Post by CRM User » Sat Dec 17, 2016 2:45 am

I have installed Asterisk from source, and installed the latest version of HAAst. HAAst starts fine but it exits immediately with this error in the haast log file:

Code: Select all

General, HAAst terminating with exit code 158 (failure to find asterisk control files) after running for 2 seconds
What is wrong?
Account for questions transferred from CRM system
User avatar
Telium Support
Posts: 235
Joined: Sun Nov 27, 2016 3:27 pm

Re: Can't start Asterisk exit code 158

Post by Telium Support » Sat Dec 17, 2016 2:52 am

Exit code 158 means that HAAst is unable to find the service/executable file needed to control Asterisk. Since you installed Asterisk from source, I assume you are not using any configuration generator (eg: Elastix) as well. If that's the case then the 'distribution' setting in the [asterisk] stanza of the haast.conf file should be set to 2 (Digium Asterisk). Confirm that setting - then proceed to the steps below if the error remains.

Next ensure that you installed an Asterisk service file appropriate for your Linux distribution. Most recent Linux distributions have switched to systemd, which requires you use an asterisk.service file. If you are using an older Linux distribution then you require a SysV / initd style service file.

While Asterisk includes a sample SysV style service file for Asterisk, it might not include a systemd style service file just yet (as of Dec 2016). You can find one by searching the Digium support forums, but here's an example you can use:

Code: Select all

[Unit]
Description=Asterisk PBX and telephony daemon
Documentation=man:asterisk(8)
Wants=network.target
After=network.target

[Service]
Type=simple
User=asterisk
Group=asterisk
ExecStart=/usr/bin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/bin/asterisk -rx 'core stop now'
ExecReload=/usr/bin/asterisk -rx 'core reload'

[Install]
WantedBy=multi-user.target
Save the above as 'asterisk.service' and place it in /etc/systemd/system/ and set file permissions to 755. Don't add restart directives (like you might find on the internet) since HAAst should be responsible for restarting Asterisk when necessary. You will also have to tell Linux about the new service file with the 'systemctl daemon-reload' command (or similar depending on your Linux distro).

If you want to use the SysV / initd style service file that's ok too, but you'll need to tell HAAst which style of service file you are using. To do so contact Telium support and we will provide you with details specific to your Linux distribution. (But in general if your Linux distro uses systemd, stick with systemd service files).
Post Reply