Asterisk starts via -vvvc but not init.d


#1

OS CentOS 6.0 x64
Asterisk 1.8.6.0 from source following instructions from wiki (used install_prereq from contrib for dependencies).
Using SIP only.

When starting service via “/etc/init.d/asterisk start” it outputs “Starting asterisk:” and brings me back to prompt.

Running “/sbin/service/asterisk status” it outputs “asterisk dead but subsys locked”. If I continue to check the status repeatedly the service will occasionally show up as running under different pids but immediately goes back to “asterisk dead but subsys locked”.

If I stop the service via “/sbin/service/asterisk stop” it outputs:
Stopping safe_asterisk: [ OK ]
Shutting down asterisk: [FAILED]

However, if I start asterisk via “asterisk -vvvc” it opens the CLI and I can login with a sip client from another computer. Checking the service also shows that it’s running and the pid doesn’t change.

I did run “make config” as well as “chkconfig asterisk on”.

I’ve been using AsteriskNOW but thought Asterisk might be more flexible and am giving it a shot.

Thanks for any help/suggestions or pointing me in the right direction.

Jacob


#2

The init.d-script is using safe_asterisk. When the service doesn’t come up (and You see different pids for ps -ef | grep asterisk) this usually means, that the embedded command /usr/sbin/asterisk -c fails for any reason and is restarted by safe_asterisk-Wrapper automatically.
What You could do is check /var/log/asterisk/messages for any errors that may have been occure during load (normally of modules). Any crashes should also been detectable there.


#3

Thanks for the info. I checked the messages file and it had a bunch of stuff in there (permission on asteriskdb was wrong). Also my 80GB hdd was filled up completely by then end the day just by the unit sitting idle. This is when I realized maybe evaluating Asterisk is better done from a proper binary package and not an inexperienced install from source.

So now it’s CentOS 5.7 with 1.8 binaries and surprisingly everything works well :wink:

Thanks again for your reply.

Jacob


#4

I have exactly the same problem on CentOS 6 x386, Asterisk 1.8.6 build from source.
In addition to above stated it filled my tmp folder with files named like this: core.<machine_name>.<date_time>. Total size of these files is 50GB for less then one day.

Asterisk log file have the following lines:

[Sep 18 06:22:05] NOTICE[14661] cdr.c: CDR simple logging enabled.
[Sep 18 06:22:05] NOTICE[14661] loader.c: 211 modules will be loaded.
[Sep 18 06:22:05] WARNING[14661] loader.c: Error loading module 'res_config_odbc.so': /usr/lib/asterisk/modules/res_config_odbc.so: undefined symbol: ast_odbc_clear_cache
[Sep 18 06:22:05] NOTICE[14661] res_odbc.c: res_odbc loaded.
[Sep 18 06:22:05] NOTICE[14661] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Sep 18 06:22:05] NOTICE[14661] config.c: Registered Config Engine odbc
[Sep 18 06:22:05] NOTICE[14661] res_config_ldap.c: No directory user found, anonymous binding as default.
[Sep 18 06:22:05] ERROR[14661] res_config_ldap.c: No directory URL or host found.
[Sep 18 06:22:05] ERROR[14661] res_config_ldap.c: Cannot load LDAP RealTime driver.
[Sep 18 06:22:05] NOTICE[14661] config.c: Registered Config Engine curl
[Sep 18 06:22:05] ERROR[14661] res_config_pgsql.c: PostgreSQL RealTime: Failed to connect database asterisk on 127.0.0.1: 
[Sep 18 06:22:05] WARNING[14661] res_config_pgsql.c: PostgreSQL RealTime: Couldn't establish connection. Check debug.
[Sep 18 06:22:05] NOTICE[14661] config.c: Registered Config Engine pgsql
[Sep 18 06:22:05] NOTICE[14661] chan_skinny.c: Configuring skinny from skinny.conf
[Sep 18 06:22:05] WARNING[14661] chan_dahdi.c: Ignoring any changes to 'userbase' (on reload) at line 23.
[Sep 18 06:22:05] WARNING[14661] chan_dahdi.c: Ignoring any changes to 'vmsecret' (on reload) at line 31.
[Sep 18 06:22:05] WARNING[14661] chan_dahdi.c: Ignoring any changes to 'hassip' (on reload) at line 35.
[Sep 18 06:22:05] WARNING[14661] chan_dahdi.c: Ignoring any changes to 'hasiax' (on reload) at line 39.
[Sep 18 06:22:05] WARNING[14661] chan_dahdi.c: Ignoring any changes to 'hasmanager' (on reload) at line 47.
[Sep 18 06:22:05] WARNING[14661] cel_pgsql.c: CEL pgsql config file missing global section.
[Sep 18 06:22:05] NOTICE[14661] pbx_ael.c: Starting AEL load process.
[Sep 18 06:22:05] NOTICE[14661] pbx_ael.c: AEL load process: parsed config file name '/etc/asterisk/extensions.ael'.
[Sep 18 06:22:05] NOTICE[14661] pbx_ael.c: AEL load process: checked config file name '/etc/asterisk/extensions.ael'.
[Sep 18 06:22:05] NOTICE[14661] pbx_ael.c: AEL load process: compiled config file name '/etc/asterisk/extensions.ael'.
[Sep 18 06:22:05] NOTICE[14661] pbx_ael.c: AEL load process: merged config file name '/etc/asterisk/extensions.ael'.
[Sep 18 06:22:05] NOTICE[14661] pbx_ael.c: AEL load process: verified config file name '/etc/asterisk/extensions.ael'.
[Sep 18 06:22:05] ERROR[14661] ais/clm.c: Could not initialize cluster membership service: Try Again
[Sep 18 06:22:05] ERROR[14661] codec_dahdi.c: Failed to open /dev/dahdi/transcode: No such file or directory

I started asterisk just after installation, so I did not make changes in config files - I will try to fix error by configuration.
Any help or information about problem source is appreciated!


#5

My impression is that, if you want to run Asterisk non-root, you really need to be familiar with Unix systems. If you want something that is reasonably plug and play you should run it as root and if you want the system to be secure against privilege escalation, you should make it sacrificial, i.e. do not store anything important.on it, and re-install from a backup if it gets compromised.


#6

Hi David, thank you for the response.

I run the system as root and all installations are done as root.
In meantime I also tried to compile and install version 1.8.5 but the same problem occurred.
I also tried to change configuration files in /etc/asterisk/ but without success, so I suspect that problem is not in configuration (asterisk should run with sample configuration). So I just want to run it successfully and I will change configuration later on.

Have you an idea how to fix this?


#7

I installed new version of dahdi 2.5.0.1 (previous was 2.5.0) and after that again installed asterisk 1.8.6. But that was not helped, I got the same error as before.

Additionally, I now have new messages in the log file:

[Sep 19 00:12:42] WARNING[2992] db.c: Unable to open Asterisk database '/var/lib/asterisk/astdb': Permission denied
[Sep 19 00:12:42] WARNING[2992] db.c: Database unavailable

I checked owner of the folders in /var/lib/asterisk/ and it is root. Also root is owner of the file ‘/var/lib/asterisk/astdb’ and have read/write permissions.

Command

ps aux | grep asterisk
output the following:

root      3464  0.0  0.0   5080   920 pts/1    S    00:16   0:00 /bin/sh /usr/sbin/safe_asterisk
root      3590  0.0  0.1  18360  6936 pts/1    Rl   00:16   0:00 /usr/sbin/asterisk -f -vvvg -c
root      3597  0.0  0.0   4312   756 pts/1    S+   00:16   0:00 grep asterisk

So it seams that asterisk executes under root user.

Is there any other thing that I can check in order to resolve this?


#8

This could be a SELINUX issue. If You’re sure that root has the correct (R/W) permissions and the path exists and Your processes are running under root (as ps aux shows up) You should check wheter a SELINUX-process is running or not. Usually access-problems for root are caused by Linux-security-frameworks like this one.


#9

Olaf, thank you very much for pointing me in right direction. I was not aware that such as service running in my system, because commands ps aux | grep selinux or service selinux status does not output that such as process or service exist. After short investigation, I found the file /etc/selinux/config and changed the following line

SELINUX=enforcing to SELINUX=disables and rebooted my system… after that I do not have described problems and could connect to the asterisk process remotely. I did not check the log files for errors, but will do it and if I find new errors I will post them here.
I suppose that above settings could affect security of my system but I will check it later, for now I need just to prepare my asterisk box.
Thank you again!!!


#10

I just checked my asterisk log file and found the following lines:

[Sep 21 01:13:06] NOTICE[1728] cdr.c: CDR simple logging enabled.
[Sep 21 01:13:06] NOTICE[1728] loader.c: 210 modules will be loaded.
[Sep 21 01:13:06] WARNING[1728] loader.c: Error loading module 'res_config_odbc.so': /usr/lib/asterisk/modules/res_config_odbc.so: undefined symbol: ast_odbc_clear_cache
[Sep 21 01:13:06] NOTICE[1728] res_odbc.c: res_odbc loaded.
[Sep 21 01:13:06] NOTICE[1728] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Sep 21 01:13:06] NOTICE[1728] config.c: Registered Config Engine odbc
[Sep 21 01:13:06] NOTICE[1728] res_config_ldap.c: No directory user found, anonymous binding as default.
[Sep 21 01:13:06] ERROR[1728] res_config_ldap.c: No directory URL or host found.
[Sep 21 01:13:06] ERROR[1728] res_config_ldap.c: Cannot load LDAP RealTime driver.
[Sep 21 01:13:06] NOTICE[1728] config.c: Registered Config Engine curl
[Sep 21 01:13:06] ERROR[1728] res_config_pgsql.c: PostgreSQL RealTime: Failed to connect database asterisk on 127.0.0.1: 
[Sep 21 01:13:06] WARNING[1728] res_config_pgsql.c: PostgreSQL RealTime: Couldn't establish connection. Check debug.
[Sep 21 01:13:06] NOTICE[1728] config.c: Registered Config Engine pgsql
[Sep 21 01:13:06] NOTICE[1728] chan_skinny.c: Configuring skinny from skinny.conf
[Sep 21 01:13:06] WARNING[1728] chan_dahdi.c: Ignoring any changes to 'userbase' (on reload) at line 23.
[Sep 21 01:13:06] WARNING[1728] chan_dahdi.c: Ignoring any changes to 'vmsecret' (on reload) at line 31.
[Sep 21 01:13:06] WARNING[1728] chan_dahdi.c: Ignoring any changes to 'hassip' (on reload) at line 35.
[Sep 21 01:13:06] WARNING[1728] chan_dahdi.c: Ignoring any changes to 'hasiax' (on reload) at line 39.
[Sep 21 01:13:06] WARNING[1728] chan_dahdi.c: Ignoring any changes to 'hasmanager' (on reload) at line 47.
[Sep 21 01:13:06] WARNING[1728] cel_pgsql.c: CEL pgsql config file missing global section.
[Sep 21 01:13:06] NOTICE[1728] pbx_ael.c: Starting AEL load process.
[Sep 21 01:13:06] NOTICE[1728] pbx_ael.c: AEL load process: parsed config file name '/etc/asterisk/extensions.ael'.
[Sep 21 01:13:06] NOTICE[1728] pbx_ael.c: AEL load process: checked config file name '/etc/asterisk/extensions.ael'.
[Sep 21 01:13:06] NOTICE[1728] pbx_ael.c: AEL load process: compiled config file name '/etc/asterisk/extensions.ael'.
[Sep 21 01:13:06] NOTICE[1728] pbx_ael.c: AEL load process: merged config file name '/etc/asterisk/extensions.ael'.
[Sep 21 01:13:06] NOTICE[1728] pbx_ael.c: AEL load process: verified config file name '/etc/asterisk/extensions.ael'.
[Sep 21 01:13:06] ERROR[1728] ais/clm.c: Could not initialize cluster membership service: Try Again
[Sep 21 01:13:06] ERROR[1728] codec_dahdi.c: Failed to open /dev/dahdi/transcode: No such file or directory

I suppose that many errors is caused by default asterisk configuration so they will miss after valid configuration (I currently use default configuration just to assure that everything work). The only lines that I am not sure where is the source of the problem are last two error lines:

[Sep 21 01:13:06] ERROR[1728] ais/clm.c: Could not initialize cluster membership service: Try Again
[Sep 21 01:13:06] ERROR[1728] codec_dahdi.c: Failed to open /dev/dahdi/transcode: No such file or directory

File or directory /dev/dahdi/transcode does not exist so it is not permissions problem, but I do not know how to resolve this thing.

Additionally, one thing is strange for me: after stopping the asterisk service I receive information that this passed OK, but after starting again asterisk I did not receive any info (OK or Error, nothing), see results below:

[root@asterisk ~]# service asterisk stop
Stopping safe_asterisk:                                    [  OK  ]
Shutting down asterisk:                                    [  OK  ]
[root@asterisk ~]# service asterisk start
Starting asterisk:
[root@asterisk ~]#

Is this normal, or maybe there is no OK because of errors mentioned above? But why then I did not receive Error information after start?


#11

Undefined symbols indicate that you have modules that are incompatible with the version of /usr/sbin/asterisk that you are using. They all need to be compiled at the same time and any old ones need to be removed before installation.

I believe the mesesage about transcoder simply means that you don’t have a hardware transcoder.


#12

about SELINUX and security - I’m not an expert in configuring SELINUX properly, so if You want to use it You’ll have to check how to configure it properly to allow asterisk to access the needed path and file structures.

To Your starting errors: david55 is basically right, but here we have several other (minor) problems:

could be silently ignored, as the module needs res_odbc.so loaded before but as load-process is done in alphabetic order here is a mismatch which asterisk leads to the WARNING but afterwards the module gets reloaded (without further notice). You can avoid the error by using the preload-statements in modules.conf for the right order of the odbc-modules if You need them. Otherwise try to disable them (noload-directive in modules.conf)

means, the module is not configured correctly. If You don’t plan to use it, just disable it in modules.conf, otherwise make sure, that You put the right config options in place.

same but for the postgresdb-Backend instead of ldap.

[Sep 21 01:13:06] WARNING[1728] cel_pgsql.c: CEL pgsql config file missing global section.

same but for channel event logging to postgresdb-backend.

[Sep 21 01:13:06] ERROR[1728] ais/clm.c: Could not initialize cluster membership service: Try Again

same but for res_aim.so.

As david55 guessed already: This “ERROR” could be silently ignored: If You’re using DAHDI-Drivers and You don’t have hardware installed (from Digium) with an integrated hardware transcoder, this message occures. It could be avoided by putting noload => codec_dahdi.so into modules.conf.

Your missing messages for service asterisk start may come from the init.d-Script, I’m not sure which signals the wait for and transforming it into bracketed messages. But if You have doubts wheter asterisk is running or not service asterisk status or at least asterisk -rvvvvv should bring You up to confidence.


#13

Thank you guys for your help!!

@david55

It is a little bit strange for me, because I compiled everything on this system at the same time (in the following order: libpri, dahdi, asterisk). Maybe Selinux made some problem during compilation, so I will try to do it again with Selinux disabled to see will this help. Additionally, I do not know how to uninstall (remove) libpri and dahdi. For asterisk I did make uninstall-all in the folder where is the source code (and makefile) placed, but for libpri and dahdi I did not find valid instructions how to remove it in the right way, maybe you have suggestion for this?

@abw1oim

I understand… I am totally newbie for that. I read after your comment about it and just disabled it. Later, I found that its status could be checked by command: sestatus. It was enabled on my system, so disabling it resolved main of my problems. I read that it is very important, so I have to spent some time to configure it properly after I configure asterisk completely.

For all messages I agree that configuration is problem - I used the asterisk samples just to run it. I will pay attention in next days to configure everything correctly and will see whether these messages will disapear from log file.

I understand you. I installed libpri and dahdi because it was suggested in all manuals. I read that dahdi is used also as timing source by asterisk so it could be important for other asterisk functionalities not just for working with asterisk compatible cards. And finally, I do not plan currently to use cards on this system, but maybe later I will buy one of them to play with it. Anyway, I thought that it is possible to configure dahdi to run without errors also in case that there is no hardware cards supplied.

Maybe [OK] will be shown after I resolve all other errors, I will inform you about results. And according to the asterisk service - it works now, but before disabling Selinux I only could start it in console mode (-c) not to connect to the process (-r) -> it is logical, because it was not started. Now this problem is resolved and both modes are working now, also I see asterisk in the services status.


#14

You may want to use it for timing purposes (with dahdi_dummy-driver than in Your config) and it will work. The error could be avoided as I told You, the “ERROR” itself is a bit confusing for many people as only a few are using hardware transcoders (in this case You got no message) but most do not. If You disable the codec (codec_dahdi.so) the message will however disappear.