Unable to connect to remote asterisk (does asterisk.ctl ...)

Hi everyone,
I’m deploying a Asterisk version on a new virtual machine. Unfortunately the problem is that asterisk won’t start with the command asterisk -rvvvvv .CLI says:

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

If I run asterisk -cvvvvv , it starts fine, it sets it up with no issues at all and I’m even able to register phones and make/receive calls. But the moment I close the CLI with CTRL+c (Asterisk cleanly ending), the process is terminated, and if I run asterisk -cvvvvv it restarts and it seems it sets it up again from scratch.

I’m unable to start Asterisk with asterisk -rvvvv even with root user.
Asterisk.ctl file is not there because, as I explained, to be able to check the file system, I need to exit Asterisk CLI and when I do that, the process gets of course terminated. However, I’m unable to run it with asterisk -rvvvvv in any way.

SElinux is currently disabled.

Any help would be greatly appreciated…

You need to have started Asterisk before you can use Asterisk -r. You’d normally do that without either c or v options, from your system start up script (although some of the supplied scripts use -c and spare console on the main screen).

What you have described is how one would expect it to behave if you use -r and -c in the way you describe.

systemctl status asterisk
systemctl start asterisk
systemctl enable asterisk

try take a look at this file, and check that it is setup as needed for your server

/usr/lib/systemd/system/asterisk.service

if it do not exist you can copy it from

cp <ASTERISK_SRC>/contrib/systemd/asterisk.* /usr/lib/systemd/system/

<ASTERISK_SRC>/contrib/systemd/README.txt