[asterisk-users] Having problem getting Asterisk to work on CentOS 7

Dan Cropp dan at amtelco.com
Wed Mar 15 16:00:27 CDT 2017


Just a quick update.
Problem seems to have been with the init.d script.

I decided to re-set SElinux to enabled just to verify while using the systemd.  Even after a restart, asterisk is running with SElinux enabled.

Thanks to everyone on asterisk-users for helping me solve my problem.

Dan

From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Cropp
Sent: Wednesday, March 15, 2017 3:07 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Having problem getting Asterisk to work on CentOS 7

Thank you Jason

After following your steps, Asterisk starts up each time even after the reset.

I will look into creating an SELinux policy exception for Asterisk.

Have a great day!

Dan

From: asterisk-users-bounces at lists.digium.com<mailto:asterisk-users-bounces at lists.digium.com> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Telium Technical Support
Sent: Wednesday, March 15, 2017 1:52 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: Re: [asterisk-users] Having problem getting Asterisk to work on CentOS 7

Dan - you probably installed the init script (look in /etc/init.d for an 'asterisk' file).  Asterisk includes the older init style scripts which are *compatible* with systemd but you don't have as much control compared to creating an Asterisk systemd file.  (SystemD service files replace InitD scripts).  So that might be part of the solution, but first...

If disabling Selinux allows Asterisk to run as you expect then you can create an selinux policy exception for Asterisk - BUT, ignore that for now.  Just keep SElinux disabled (edit /etc/sysconfig/selinux and set to disabled) and come back to that later.

So in preparation to diagnose further:

1.      Disable asterisk service (systemctl disable asterisk)

2.      Disable selinux (as described above)

3.      Reboot.

Next, try to start asterisk with 'systemctl start asterisk'.  Does it work as expected?  If no, what user have you logged in with?
If not root, su to root and try again.  Did it asterisk service start properly?
If yes, you should create a systemd service file and use the 'user=root' parameter (and remove the initd service script).
Does Asterisk start properly now every time?  If yes re-enable to your systemd Asterisk service to start with the system.

I don't see any attachment (probably stripped by the list manager) but that shouldn't matter - if your Asterisk service is not running as root that would explain a range of strange behaviours.

*Jason*


From: asterisk-users-bounces at lists.digium.com<mailto:asterisk-users-bounces at lists.digium.com> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Cropp
Sent: Wednesday, March 15, 2017 12:41 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com<mailto:asterisk-users at lists.digium.com>>
Subject: Re: [asterisk-users] Having problem getting Asterisk to work on CentOS 7

Thanks Jason.

I will try to explain what I'm seeing for this issue.

I did a fresh install of CentOS 7 Minimal into a VM with VMWare Workstation.  Followed the Asterisk from Source instructions using pjproject 2.6 and asterisk 13.14.0 for the configure, install, ...   At the end of the asterisk portion, I ran the make config which I understand installs the Initialization scripts.

After this, when I restart my CentOS 7 Minimal, I was seeing the safe_asterisk process, but asterisk would not start.  I could run it from the command line and it would run.

It was suggested that it's an selinux problem.  They had me try 'setenforce 0'.  After this, asterisk process starts running.
As I understand it, there was mention of using systemd instead of using safe_asterisk.
Other e-mails indicated I should look at the audit.log, so I included that information.  This audit.log mentioned astdb.sqlite3, so I wasn't sure if that's the problem.

I also just tried a restart and ran 'systemctl start asterisk'.  This did not start the asterisk process.

Through the various recommendations, I've become confused on what the correct path would be.  I have had zero problems with Debian and Asterisk for many years.  Making the change to CentOS.  Followed the instructions from asterisk.org, but for some reason I hit a problem with this on my CentOS VM.
https://wiki.asterisk.org/wiki/display/AST/Installing+Asterisk+From+Source

Simply looking for guidance on what the correct approach to solve this problem is.

Have a great day!

Dan


From: asterisk-users-bounces at lists.digium.com<mailto:asterisk-users-bounces at lists.digium.com> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Telium Technical Support
Sent: Wednesday, March 15, 2017 11:08 AM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: Re: [asterisk-users] Having problem getting Asterisk to work on CentOS 7

The history of the question is lost (in the mail thread) so I'll jump in based on what I could see in my recent mail and the subject line:

-        The ASTDB should have no impact on Asterisk service start (which I assume is the problem given the subject line)

-        If you disabled SElinux then that's not the problem in starting asterisk

>From another posting it appears that you can start Asterisk from the binary, and from safe_asterisk.  If that's correct, then are you able to start/stop Asterisk from the service file?  With CentOS7 that would be:

systemctl start asterisk

Is your asterisk service file present?  (You can create one easily based on samples on the internet).  If you have an asterisk service file but startup fails post the relevant portion of your syslog (journalctl).

If your question has changed (you mentioned 'the first problem') then ignore the above; jumping in late.





*Jason*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170315/4f502a8b/attachment.html>


More information about the asterisk-users mailing list