Having Problem Getting Asterisk To Work On CentOS 7

Home » Asterisk Users » Having Problem Getting Asterisk To Work On CentOS 7
Asterisk Users 21 Comments

Some background information.

I have used Debian with Asterisk for several years. Have encountered zero problems. I am now trying to setup an Asterisk on a CentOS7 box using VMWare Workstation. I am brand new to CentOS and RHEL so I may be missing something obvious.

Note: VMWare Workstation is a hosted hypervisor that runs on x64 versions of Windows and Linux operating systems[4] (an x86 version of earlier releases was available);[3] it enables users to set up virtual machines (VMs) on a single physical machine, and use them simultaneously along with the actual machine.

I am installing CentOS Minimal Install and Asterisk from Source. (I have installed Asterisk from Source on Debian hundreds of times without any problems). After installing CentOS (only root user), I update CentOS. I then install the CentOS “Development Tools”. Also install, I install net-tools and wget.

After that, I am following the Wiki pages for Asterisk from Source. https://wiki.asterisk.org/wiki/display/AST/Installing+Asterisk+From+Source Retrieve the asterisk-13-current.tar.gz and the pjproject-2.6.tar.bz2

I uncompress them, run the asterisk install_prereq script to install all required packages. I configure PJPROJECT, make dep, make, make install, and ldconfig

After that, I install asterisk
./configure make menuselect make make install make samples make progdocs make config

After that, I modify the asterisk conf files for a couple pjsip endpoints and turn on debugging and verbosity. Copying settings from another box which is working.

I am seeing two different issues….

First, when I restart the box, the asterisk process is present. However, it’s not writing anything to the log files so it seems to be stuck. Any idea why running Asterisk as a service after the make config would not seem to fully start up?

Second, I stop the asterisk service. Make sure asterisk process is not present. Then, I start it up manually going to the console. Everything is running. I see information written to the asterisk log files. However, I try to connect phones to this and it does not work. I used tcpdump to verify the SIP packets are making it to the CentOS box, however Asterisk is not seeing the SIP messages. I run netstat -apn | grep -i asterisk and see Asterisk udp with port 5060. The one thing I notice is my Debian installations have always been eth0. CentOS is using the newer ens33. Might this cause a problem?

Any suggestions?

21 thoughts on - Having Problem Getting Asterisk To Work On CentOS 7

  • You mentioned starting asterisk manually. Do you do that with the proper permissions (assuming you do run Asterisk as a non-root user, as you should). Any chance asterisk does not have write permissions to the log files?

    Failing that, try strace.

    strace -p $PID_OF_ASTERISk

    Maybe also add -f and / or -o if there’s too much output.

  • Hello,

    Did you disable selinux ? It usually causes troubles when starting asterisk as a service. You can do this with : setenforce 0 (this will not totally disable selinux, but switch it to a permissive mode).

    For your second point, maybe you should check that firewalld is either stopped or configured properly. By default it has quite restrictive rules.

    Best regards

    Jean Aunis

    Le 14/03/2017

  • Thank you Tzafrir.

    I had been using different users in earlier attempts to make this work. Decided to try everything where root is the only user, simply to verify it’s working.

    For problem 2, where asterisk is writing to the log but doesn’t seem to receive the SIP packets even though tcpdump indicates they are making it to the box on 5060, I am starting asterisk while logged in as root.
    /usr/sbin/asterisk -vvvvvvvvdddddddc

    For problem 1, where it seems to be stuck when running as a service, I simply reboot the machine. Then I log it as root and notice it’s not writing to the log.

    When running it as a service (after restart). Here is what the output from strace -p $PID_OF_ASTERISK

    [root@localhost ~]# strace -p 1470
    Process 1470 attached wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2505
    rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    — SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid%05, si_status=0, si_utime=0, si_stime=0} –

  • Thank you Jean.

    I changed selinux to permissive in the /etc/selinux/config and restarted. Asterisk was able to start up. One oddity though, I now see two different pids for asterisk (pgrep asterisk). Is this to be expected or do I still have something wrong?

    For my second issue, after stopping firewalld, SIP traffic is now making it through to Asterisk.

    I need to research both selinux and firewalld some more. They are both new to me.

    Have a great day!

    Dan

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Jean Aunis Sent: Tuesday, March 14, 2017 12:04 PM
    To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] Having problem getting Asterisk to work on CentOS 7

    Hello,

    Did you disable selinux ? It usually causes troubles when starting asterisk as a service. You can do this with : setenforce 0 (this will not totally disable selinux, but switch it to a permissive mode).

    For your second point, maybe you should check that firewalld is either stopped or configured properly. By default it has quite restrictive rules.

    Best regards

    Jean Aunis

    Le 14/03/2017

  • pkill? nice? That is not asterisk. Are you sure you got the right process? Maybe you got safe_asterisk instead? If it is safe_asterisk:

    1. That script is pointless now that you have systemd. Replace it with a simple systemd unit (hint: Restart=on-failure gets you most of the way there).

    Isn’t there one already included with Asterisk by now?

    2. Use the option -f of strace to see the exact error message. What is error status 34 of asterisk? ERANGE?

  • Generally before advising that, check if this is the error:

    tail -f /var/log/audit/audit.log

    and try the command.

    Is there any open bug for a security policy for Asterisk?

  • This is what I hacked up for my CentOS 7 Asterisk server. It does NOT act like safe_asterisk.

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

    [Service]
    Type=simple User=root Group=root Environment=HOME=/var/lib/asterisk WorkingDirectory=/var/lib/asterisk ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf ExecStop=/usr/sbin/asterisk -rx ‘core stop now’
    ExecReload=/usr/bin/asterisk -rx ‘core reload’

    [Install]
    WantedBy=multi-user.target

  • I have FreePBX 14.0.1beta20 running on CentOS 7.3.

    What problems are you having?
    The latest emails don’t have any details about the problem or what you have tried.

    Ron

  • https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Enabling_and_Disabling_SELinux.html

    If disabling Selinux solves your problem, then your problem may be related to Selinux. If it does not change yout problem, you may want to look elsewhere.

    It seems that a lot of things do not work with Selinux or have no instructions about how to make them work with Selinux that it almost seems like a useless feature.

    Ron

  • Thanks Tzafrir.

    Upon further investigation it is safe_asterisk that was the process id I initially saw. I believe this is what was installed when running make config to install the Initialization Scripts in the asterisk 13.14.0 source code Asterisk did not start up previously on a restart.

    I changed SELINUX setting in /etc/selinux/config (default was enforcing and I changed it to permissive). After that, I was seeing the Asterisk PID.
    I didn’t realize both safe_asterisk pid and asterisk pid were displaying when I executed pgrep asterisk.

    Admittedly, I’m new to systemd. I need to research it to learn what I need to do.

    Dan Cropp Senior Software Engineer, R&D Software Dept. AMTELCO, 4800 Curtin Drive, McFarland, WI 53558-9424
    608 838-4197 ext. 291
    1-800-238-5275 ext 291
    http://www.amtelco.com

    Statement of Confidentiality The contents of this e-mail message and any attachments are confidential to American Tel-A-Systems, Inc. (AMTELCO), and are intended solely for the addressee(s). The information contained in this transmission also may be of a legally privileged nature. This transmission is sent in trust and is meant solely for delivery to the intended recipient(s). Receipt of this transmission does not convey any right to reproduce or disseminate any of the information it contains. If you are not the intended recipient, please immediately notify the sender by reply e-mail

  • Many things work well, once properly configured. Looking at the exact error (again, audit.log) is the first step.

    Once upon a time Asterisk used to be able to run with SELinux:
    https://issues.asterisk.org/jira/browse/ASTERISK-3088

    The problem may be missing a profile for Asterisk.

    Or the fact that it interacts too much with other services? I’ll have to give it a shot. At least for a stand-alone Asterisk.

  • Here is the audit.log. Does this indicate a problem with accessing the astdb.sqlite3 file?

    Permissions for this file are…
    [root@localhost ~]# ls -l /var/lib/asterisk/astdb.sqlite3
    -rw-r–r–. 1 root root 5120 Mar 15 09:39 /var/lib/asterisk/astdb.sqlite3

    [root@localhost ~]# tail -f /var/log/audit/audit.log type=AVC msg=audit(1489588773.253:1171): avc: denied { read } for pid838 comm=”asterisk” name=”astdb.sqlite3″ dev=”dm-0″ ino0884225 scontext=system_u:system_r:asterisk_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file type=SYSCALL msg=audit(1489588773.253:1171): arch

  • What are you using for the database – SQLite?
    I am using mysql (mariadb).

    I am not familiar with SQLlite. Can you access the database from the console – look up the list of tables – display the contents from a table? Anything to see if your SQLite is working and has asterisk data in it. From your Asterisk console,

    |CLI> core show help database|

    should give you a list of commands that you can try.

    |database show — Shows database contents database showkey — Shows database contents|

    would seem to let you know if you have a database that works. Never had to do this but it seems an easy way to test your database connection.

    Do you have webmin installed on your CentOS7 box. I find that this is a handy web/graphical interface to CentOS7.

  • Some background to make sure this is the right track. SELINUX does seem to be the problem on startup.

    The audit.log I provided is what is happening prior to executing ‘setenforce 0’

    Looking at astdb.sqlite3, there is only one table astdb. It has one record, which contains a key and value pair. Key is /pbx/UUID
    Value …..

    Trying to understand where I should be focusing my efforts for the first problem of it not starting after a restart.

    Is sqlite3 and the astdb.sqlite3 errors from the audit.log the place I should be looking into?
    Or is the SELINUX issue the correct place for me to be looking? Seems to startup if I run the ‘setenforce 0’ (or change SELINUX setting). Or would it be best for me to be looking into using systemd based on possible problems with safe_asterisk?

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_

    Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Enabling_and_D

    isabling_SELinux.html

    If disabling Selinux solves your problem, then your problem may be

    related to Selinux.

    If it does not change yout problem, you may want to look elsewhere.

    It seems that a lot of things do not work with Selinux or

    have no instructions about how to make them work with Selinux that it

    almost seems like a useless feature.

    Many things work well, once properly configured. Looking at the exact error (again, audit.log) is the first step.

    Once upon a time Asterisk used to be able to run with SELinux:

    https://issues.asterisk.org/jira/browse/ASTERISK-3088

    The problem may be missing a profile for Asterisk.

    Or the fact that it interacts too much with other services? I’ll have to give it a shot. At least for a stand-alone Asterisk.

  • 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*

  • 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@lists.digium.com [mailto:asterisk-users-bounces@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*

  • 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@lists.digium.com
    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Dan Cropp Sent: Wednesday, March 15, 2017 12:41 PM
    To: Asterisk Users Mailing List – Non-Commercial Discussion

    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>
    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@lists.digium.com [

    mailto:asterisk-users-bounces@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*

  • 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@lists.digium.com [mailto:asterisk-users-bounces@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@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Dan Cropp Sent: Wednesday, March 15, 2017 12:41 PM
    To: Asterisk Users Mailing List – Non-Commercial Discussion >
    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@lists.digium.com [mailto:asterisk-users-bounces@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*

  • 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@lists.digium.com [mailto:asterisk-users-bounces@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@lists.digium.com [mailto:asterisk-users-bounces@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@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Dan Cropp Sent: Wednesday, March 15, 2017 12:41 PM
    To: Asterisk Users Mailing List – Non-Commercial Discussion >
    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@lists.digium.com [mailto:asterisk-users-bounces@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*

  • Have you tried to turn of Selinux permanently?
    I don’t see why it would be required on a system that has no users. In /etc/selinux/config I set SELINUX to disabled

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing – SELinux security policy is enforced.
    # permissive – SELinux prints warnings instead of enforcing.
    # disabled – No SELinux policy is loaded. SELINUX=disabled
    # SELINUXTYPE= can take one of three two values:
    # targeted – Targeted processes are protected,
    # minimum – Modification of targeted policy.

  • Great. Let me know how your policy works out. I would not mind trying it myself. I have no intrinsic objection to doing things the right way but sometimes one just needs to get the phones working!

    Ron