I can download, compile, config and run Asterisk from the CentOS 6.4 console. However, when I try to start it as service using “service asterisk start” it does not work. Following some other forum threads, on my install I am also doing:
I am using Asterisk 11. When I try to start the service via init script it says “Starting Asterisk…”, but then nothing happens after this. It must be something stupid I am doing (or not doing ).
I will do some checks about who is running it as I have set asterisk.conf to run Asterisk as user “asterisk” but I never checked, when I invoke it from the console, if it runs as “root” or asterisk user. This might be the problem… But the reality is that you download, compile, make config, make install, make the samples and, when you try to start it using “service start asterisk”, it doesn’t start.
I had a similar issue with asterisk 11 on centos 6.4 a few weeks (or months) back, “ldconfig” needed to be run after asterisk compilation/installation. Can you try that and see? Also, I presume you can start asterisk without the startup scripts? can you confirm
Yes, I can start Asterisk running “asterisk -cvvv”. It will fail to start if you don’t issue a “ldconfig” after compiling/installing. If you don’t do it, it will fail looking for “libasteriskssl.so.1”. But if you don’t do a “ldconfig”, you can still start it if you do a “export LD_LIBRARY_PATH=/usr/lib” (in my case I compile it using “./configure --prefix=/usr”).
So, I think the install script should include a “ldconfig”. But anyway, the init script does not work even if you do a make, make install, make config and make samples. But as I said, I am not sure if the init is failing because the asterisk user I create does not have the necessary rights to do what is necessary. So any hint is more than welcome! But I guess I am not “unique” so more people had (or are having) the same problem.
That is it! Now, what am I doing wrong? I “think” I should be able to issue a “service aterisk start” and it should start Asterisk with the “sample” configuration. But it doesn’t.
Anyway, I know it is quite difficult to adapt the code for all Linux flavors. However, what I want to find is what I should do, that is missing, to get it working from the init script. That is it!
CentOS 5.7, Debian Wheezy, Slackware 14, SCO OpenServer, SunOS, the Zilog Unix I used, over thirty years ago, are normal. I have no experience of CentOS 6, but I can’t think of any good reason why they would stop using /usr/lib.
The reason it might need ldconfig would be that there was a previous library, of the same name, in a different place. The loader should search the default LD_LIBRARYPATH if there was no entry in the cache and the default LD_LIBRARYPATH should include /usr/lib.
If anything, what the LD_LIBRARYPATH issues suggests is that there is a library on the default LD_LIBRARYPATH that is unusable, but of the right name, so by eliminating the other directories on the default path, you are invalidating the cache entries for them.
In terms of the history of Unix, ldconfig and the shared object cache is relatively recent, compared with the use of /usr/lib.
Now, if I start Asterisk issuing “asterisk -U asterisk -G asterisk -cvvvvv”, it works. However, when I try “service asterisk start” and then I do a “service asterisk status” I get: “asterisk dead but subsys locked”.
When I try to stop it, I get:
service asterisk stop
Stopping safe_asterisk: [ OK ]
Shutting down asterisk: [FAILED]
Now I am locked! I get no clue from where I should start to fix it.
Just for anyone looking to troubleshoot similar problems, there are a few things going on that really shut Asterisk up and hide important debugging information. In my case safe_asterisk was starting up, but nothing else happened. Not a single byte of logging, so I had to get it making some noise.
First, in /etc/init.d/asterisk you can edit this line:
Remove the redirection to get some error messages:
If that doesn’t do the trick, you can also prevent Asterisk from outputting to TTY9 by commenting out this line in /usr/sbin/safe_asterisk:
By using these two methods I was able to figure out two problems that were tripping Asterisk up (missing PID file and typo in the asterisk.conf runuser.)
Hey! Got the answer, now over two years later… just posting this for posterity.
This answer was originally provided by Russell Bryant on another forum. If you’re running 64-bit CentOS 6.x (and maybe others), libasteriskssl should be installed into /usr/lib64. If you’re installing from source, Asterisk will install it to /usr/lib/ by default, which is wrong. To fix it, you must add an option when running configure: