asterisk connect error: /var/run/asterisk/asterisk.ctl?

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby javaone9 » Mon Oct 10, 2011 10:13 pm

After installing asterisk on Fedora Core 14 according to Get Started document, the service can be started successfully.

# service asterisk start
# service asterisk status
asterisk (pid 25897) is running...

# ps aux | grep asterisk
root 26125 0.0 0.0 5136 552 pts/0 S 12:02 0:00 /bin/sh /usr/sbin/safe_asterisk
root 26127 116 0.7 36244 15568 ? Rl 12:02 0:03 /usr/sbin/asterisk -f -vvvg -c
root 26169 0.0 0.0 4416 712 pts/0 S+ 12:02 0:00 grep --color=auto asterisk

# asterisk -r
Asterisk 1.8.7.0, Copyright (C) 1999 - 2011 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)


After stop the asterisk, and start it by safe_asterisk, it works
# safe_asterisk
# ps aux | grep asterisk
root 26001 0.0 0.0 5084 552 pts/0 S 11:59 0:00 /bin/sh /usr/sbin/safe_asterisk
root 26003 2.5 0.7 37768 15600 pts/0 Sl 11:59 0:00 /usr/sbin/asterisk -f -vvvg -c
root 26045 0.0 0.0 4416 708 pts/0 S+ 11:59 0:00 grep --color=auto asterisk

# asterisk -r
Asterisk 1.8.7.0, Copyright (C) 1999 - 2011 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.8.7.0 currently running on server1 (pid = 26003)
Verbosity is at least 3
server1*CLI>

We need to start asterisk on system boot. How to solve this problem?
Thanks for help.
Dave
javaone9
Newsterisk
 
Posts: 44
Joined: Mon Oct 10, 2011 10:02 pm

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby javaone9 » Mon Oct 10, 2011 10:34 pm

Tried asterisk in console mode
# asterisk -vvvc

It says: Asterisk Ready.
no errors.

Successful in connecting from another terminal:
# asterisk -r
Asterisk 1.8.7.0, Copyright (C) 1999 - 2011 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.8.7.0 currently running on server1 (pid = 26381)
Verbosity is at least 3
server1*CLI>


Thanks for help.
Dave
javaone9
Newsterisk
 
Posts: 44
Joined: Mon Oct 10, 2011 10:02 pm

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby eg » Tue Oct 11, 2011 3:57 am

Hello Dave,

We need to start asterisk on system boot. How to solve this problem?

If that is what You need , You can set it in /etc/rc.local script , which will be executed every time at system boot.
to perform this just add /usr/sbin/safe_asterisk in new line of this script.

Good luck.
eg
Newsterisk
 
Posts: 41
Joined: Fri Mar 26, 2010 3:49 am

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby david55 » Tue Oct 11, 2011 4:43 am

There is a better way of doing this, as there are proper startup scripts.

He has run those manually, so it doesn't look as though the problem relates to not running them.
david55
Moves Like Spencer
 
Posts: 10537
Joined: Fri Sep 26, 2008 5:03 am

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby eg » Tue Oct 11, 2011 5:27 am

david55 wrote:There is a better way of doing this, as there are proper startup scripts.

Yep , maybe it's not the best way - but I use it on some of my servers without any problems .

to Dave
Please could you sent output from
Code: Select all
bash -x /etc/init.d/asterisk start
, maybe is there something wrong or PID is created somewhere else.
eg
Newsterisk
 
Posts: 41
Joined: Fri Mar 26, 2010 3:49 am

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby javaone9 » Tue Oct 11, 2011 8:03 am

Thanks for reply.

#bash -x /etc/init.d/asterisk start
+ AST_SBIN=/usr/sbin
+ . /etc/rc.d/init.d/functions
++ TEXTDOMAIN=initscripts
++ umask 022
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' 2133 -ne 1 -a -z '' ']'
++ /bin/mountpoint -q /cgroup/systemd
++ /bin/mountpoint -q /sys/fs/cgroup/systemd
++ '[' -z '' ']'
++ COLUMNS=80
++ '[' -z '' ']'
+++ /sbin/consoletype
++ CONSOLETYPE=pty
++ '[' -z '' ']'
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/i18n ']'
++ . /etc/profile.d/lang.sh
++ unset LANGSH_SOURCED
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/init ']'
++ . /etc/sysconfig/init
+++ BOOTUP=color
+++ RES_COL=60
+++ MOVE_TO_COL='echo -en \033[60G'
+++ SETCOLOR_SUCCESS='echo -en \033[0;32m'
+++ SETCOLOR_FAILURE='echo -en \033[0;31m'
+++ SETCOLOR_WARNING='echo -en \033[0;33m'
+++ SETCOLOR_NORMAL='echo -en \033[0;39m'
+++ AUTOSWAP=no
+++ ACTIVE_CONSOLES='/dev/tty[1-6]'
+++ SINGLE=/sbin/sushell
++ '[' pty = serial ']'
++ __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
++ '[' '' = 1 ']'
+ '[' -x /usr/sbin/asterisk ']'
+ '[' -d ']'
+ DAEMON=/usr/sbin/asterisk
+ SAFE_ASTERISK=/usr/sbin/safe_asterisk
++ readlink /etc/init.d/asterisk
+ CONFIG0=
+ '[' '' = '' ']'
++ basename /etc/init.d/asterisk
+ CONFIGFILE=/etc/sysconfig/asterisk
+ '[' -r /etc/sysconfig/asterisk ']'
+ . /etc/sysconfig/asterisk
++ COLOR=yes
+ RETVAL=0
+ case "$1" in
+ start
++ /usr/sbin/asterisk -rx 'core show version'
+ VERSION='Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)'
++ echo Unable to connect to remote asterisk '(does' /var/run/asterisk/asterisk.ctl 'exist?)'
++ cut -c 1-8
+ '[' 'Unable t' = Asterisk ']'
+ echo -n 'Starting asterisk: '
Starting asterisk: + '[' -f /usr/sbin/safe_asterisk ']'
+ DAEMON=/usr/sbin/safe_asterisk
+ '[' ']'
+ '[' ']'
+ '[' ']'
+ '[' ']'
+ '[' x = xyes ']'
+ '[' 0 -gt 0 ']'
+ '[' 0 -gt 0 ']'
+ '[' 0 -gt 0 ']'
+ '[' x = xyes ']'
+ '[' x = xyes -o x = xyes ']'
+ '[' xyes = xyes ']'
+ export TERM=linux
+ TERM=linux
+ RETVAL=0
+ '[' 0 -eq 0 ']'
+ touch /var/lock/subsys/asterisk
+ daemon sh -c '/usr/sbin/safe_asterisk -c'
+ echo

+ return 0
+ exit 0

----------------------------
#bash -x /etc/init.d/asterisk start
asterisk -r works,

# asterisk -r
Asterisk 1.8.7.0, Copyright (C) 1999 - 2011 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.8.7.0 currently running on server1 (pid = 2808)
Verbosity is at least 3
server1*CLI>

---------------------------------------------------
but if
/etc/init.d/asterisk start
without bash -x,

asterisk -r reports the error.

what is the differences?

Thanks for help.
Dave
javaone9
Newsterisk
 
Posts: 44
Joined: Mon Oct 10, 2011 10:02 pm

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby eg » Tue Oct 11, 2011 8:27 am

It's interesting, but -x option just echoes the result of each command in some kind of short form.
but nothing else.

Like I see asterisk is in both mentioned cases running so problem is you can't connect to console, it might be because of permissions.

Please tell us if you are performing all commands from root only.
eg
Newsterisk
 
Posts: 41
Joined: Fri Mar 26, 2010 3:49 am

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby javaone9 » Tue Oct 11, 2011 8:27 pm

Yes. I exec all commands using root on Fedoare core 14.
Possibly related to sheel?

Thanks for help.
Dave
javaone9
Newsterisk
 
Posts: 44
Joined: Mon Oct 10, 2011 10:02 pm

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby dalenoll » Wed Oct 12, 2011 5:09 am

Shooting from the hip here but.... Is selinux enabled or disabled?

file: /etc/selinux/config
line: SELINUX=disabled

If it is enabled, you should try setting to disabled and restart the OS.
My goal is not to catch you a fish and feed you for a day.
My goal is to teach you how to fish and feed you for a lifetime.
Since I hate fishing and love teaching, that works out pretty well.
dalenoll
Oldsterisk
 
Posts: 261
Joined: Tue Sep 20, 2011 11:12 am
Location: Milwaukee, Wisconsin, USA

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby javaone9 » Wed Oct 12, 2011 9:34 am

It works great after disabling selinux.

Thanks.
Dave
javaone9
Newsterisk
 
Posts: 44
Joined: Mon Oct 10, 2011 10:02 pm

Re: asterisk connect error: /var/run/asterisk/asterisk.ctl?

Postby rfine » Wed Oct 12, 2011 3:50 pm

to disable selinux please use the following either directly in rc.local or in a shell script:
echo 0 > /selinux/enforce

If this is run at startup it will disable every time
rfine
Oldsterisk
 
Posts: 93
Joined: Wed Sep 28, 2011 10:51 am


Return to Asterisk Support

Who is online

Users browsing this forum: Yahoo [Bot] and 38 guests