[asterisk] asterisk : Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?)

I am learning asterisk.

After I installed asterisk, I tried to connect with it using

asterisk -rvvvvc.

But it gave me the following error message:

Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?)

How can I solve this issue?

This question is related to asterisk

The answer is


This is common problem for asterisk and this works for me

sudo su
/etc/init.d/asterisk start 
asterisk -rvvv

If not working stop it

sudo su
/etc/init.d/asterisk stop

Start it again

sudo su
/etc/init.d/asterisk start 
asterisk -rvvv

That is all


This command should work if the others did not solve the problem:

sudo asterisk -&


I solved this problem by using: chown -R etc/asterisk chown -R var/lib/asterisk

this is bacause, as said here, I wasn't running as administrator. So, I made my user as owner of the Asterisk directories.


It may not be running.

try runnign /etc/init.d/asterisk status

If its not running, Start it using:

/etc/init.d/asterisk start

Or in RH 7:

Systemctl start asterisk


It's showing asterisk server is not running.

You may type following commands at cli:

  • asterisk

  • asterisk -rvvvv

above commands worked for me!

first command starts asterisk

second command gets you to asterisk cli


First check if the file /var/run/asterisk/asterisk.ctl exists if it doesn't, then the asterisk server is not running. So start it like

/usr/sbin/asterisk -gvvc

and then asterisk -r to drop to the command line prompt worked for me.


I have just installed asterisk 13.18.5 on CentOS7. After logging in as root, I was having the same problem and I just did "SELINUX=disabled" in /var/selinux/config and that was all. My asterisk started in verbose mode by doing asterisk -rvvvvvv. No errors !!!

Another way to get it done is to use "asterisk -&" command first and then wait for a while for an "OK" message from asterisk and then "asterisk -rvvvvv"


There are two common reasons why this occurs:

  1. Asterisk is not running.
  2. You are trying to run asterisk -r as a non-root user.

If Asterisk isn't running, try to start it: asterisk -vvvc. If you are logged in as a non-root user, then log in as the root user, or just: sudo asterisk -r.


In the source contrib directory are example scripts for init.d - it is simplest to run the server in background mode - the init scripts also contain a monitor to relaunch asterisk if it goes down.

Then you just need to use

sudo asterisk -vvvvvvvr 
  • to connect to the server that is already running in background mode.

Note you need to run this as root to gain privileges to connect.

If you installed via a distro - then the init.d scripts are usually supplied as standard.


There is another solution if above didn't help, add:

noload => res_pjsip.so to /etc/asterisk/modules.conf


You have to make a change in the asterisk.conf file located at /etc/asterisk

astrundir => /var/run/asterisk

Reboot your system and check

Hope this helps you


If you have SELINUX enabled, it will prevent this file being created. You need to turn it off.

  1. vi /etc/selinux/config
  2. set SELINUX=disabled
  3. reboot

actually it's an ownership problem

try to:

ls -l /var/run/asterisk/asterisk.ctl

you will see that the file has ownership of 'root'

although you have changed the ownership with:

chown -R asterisk /var/run/asterisk

once you restart the asterisk server the ownership gets back to the 'root' again

they should be for 'asterisk:asterisk' user and group

Basem Hegazy


If other solutions doesn't work for you, just try (as root) this:

amportal restart

Hope it helps ;-)


just go to installation folder

cd /usr/src/asterisk
asterisk -r
reload

Try to use sudo, to run asterisk -r that works for me every time this error comes up.


I had a similar issue, which was a result of the hard drive being filled up. Turns out the issue was with the cdr table being corrupted and running repair in mysql remedied the issue.


Only you need to empty /tmp directory using command & hit reboot your system. now you are able to play on asterisk CLI whatever you want.


You must be root.

sudo su -
asterisk -r

I had this problem today. It had nothing to do with any of the posted answers. I tried them all. My problem was a misconfiguration with the zaptel.conf (running old asterisk!). I had commented out some span details trying to troubleshoot a PRI issue. When the server got rebooted this issue presented itself. I was able to discover this by looking at the wanrouter messages in the logs. I noticed there were 3 errors, and the corresponding line numbers, once I corrected these issues, and ran an #asterisk -vvvvc the server came back up and everything worked.