Instruction not autorized when I type "asterisk -rvvv" to connect to the CLI

Hi @everyone,

I try to access to my CLI and I have this message when I type the command “asterisk -rvvv”
illegal instruction

[root@localhost asterisk]# /etc/init.d/asterisk status
● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
   Active: active (running) since ven 2018-11-02 15:22:25 CET; 3min 14s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 962 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/asterisk.service
           ├─1087 /bin/sh /usr/sbin//safe_asterisk
           └─3223 sleep 4

nov 02 15:22:25 localhost.localdomain systemd[1]: Starting LSB: Asterisk PBX...
nov 02 15:22:25 localhost.localdomain asterisk[962]: Starting asterisk:
nov 02 15:22:25 localhost.localdomain systemd[1]: Started LSB: Asterisk PBX.
[root@localhost asterisk]#
[root@localhost asterisk]#
[root@localhost asterisk]# asterisk -rvvvv
Instruction non permise
[root@localhost asterisk]#

I use CentOs 7.1 with Asterisk 13.23.1

Hello @everyone,

I stop my installation of asterisk on the CentOs 7.1 and now he does not start now.

This is the status of my asterisk installation:

[root@localhost asterisk]# /etc/init.d/asterisk status
● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
   Active: failed (Result: timeout) since mar 2018-11-06 09:05:48 CET; 12min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 949 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/asterisk.service
           ├─1096 /bin/sh /usr/sbin/safe_asterisk
           └─3004 sleep 4

nov 06 09:00:48 localhost.localdomain systemd[1]: Starting LSB: Asterisk PBX...
nov 06 09:00:50 localhost.localdomain asterisk[949]: Starting asterisk:
nov 06 09:00:50 localhost.localdomain systemd[1]: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.
nov 06 09:05:48 localhost.localdomain systemd[1]: asterisk.service start operation timed out. Terminating.
nov 06 09:05:48 localhost.localdomain systemd[1]: Failed to start LSB: Asterisk PBX.
nov 06 09:05:48 localhost.localdomain systemd[1]: Unit asterisk.service entered failed state.
nov 06 09:05:48 localhost.localdomain systemd[1]: asterisk.service failed.

And my directory /var/run/asterisk/ is empty. I do not have any file in it (asterisk.ctl, asterisk.pid)

First of all, you should use systemctl for managing services on CentOS 7. Service / init.d commands are deprecated.

Try
systemctl status asterisk
systemctl start asterisk

This looks like asterisk is corrupted or not installed completely.
Has it worked before and broke suddenly?
Or it has never worked for this installation?

Try
tail -f /var/log/messages
tail -f /var/log/asterisk/full
And start asterisk (systemctl start asterisk) at that moment. Does there anything specific appear in the logs?

Try: asterisk -cvvv
Brings up Asterisk cli for me when all else fails. I’m also on Centos7

Yes, this installation works before and I made a new installation by following this process:

$ cd /path/asterisk-source-dir
# For Asterisk 13 and 14...
$ ./configure --with-pjproject-bundled
$ make & make install
$ make config

I have not make the command #make samples because I had already a first installation of Asterisk 13.23.1.
We have made a new copy on a new server Windows 2012 with the VMWare vsPhere Hypervisor 6.5
And on this last one we have make a copy of my virtual installation of Asterisk that I made on Windows 10 Pro.

And he works well on a µn other server Windows 2008 R2 with VMWare vsPhere Hypervisor 6.5 installed on it.

[root@localhost asterisk]# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
   Active: failed (Result: timeout) since mar 2018-11-06 09:23:12 CET; 12min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3039 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/asterisk.service
           ├─1096 /bin/sh /usr/sbin/safe_asterisk
           ├─3066 /bin/sh /usr/sbin/safe_asterisk
           ├─6127 sleep 4
           └─6133 sleep 4

nov 06 09:18:12 localhost.localdomain systemd[1]: Starting LSB: Asterisk PBX...
nov 06 09:18:12 localhost.localdomain asterisk[3039]: Starting asterisk:
nov 06 09:18:12 localhost.localdomain systemd[1]: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.
nov 06 09:23:12 localhost.localdomain systemd[1]: asterisk.service start operation timed out. Terminating.
nov 06 09:23:12 localhost.localdomain systemd[1]: Failed to start LSB: Asterisk PBX.
nov 06 09:23:12 localhost.localdomain systemd[1]: Unit asterisk.service entered failed state.
nov 06 09:23:12 localhost.localdomain systemd[1]: asterisk.service failed.
[root@localhost asterisk]#
[root@localhost asterisk]#
[root@localhost asterisk]# systemctl start asterisk
Job for asterisk.service failed because a timeout was exceeded. See "systemctl status asterisk.service" and "journalctl -xe" for details.
[root@localhost asterisk]#
[root@localhost asterisk]# tail -f /var/log/messages
Nov  6 09:57:11 localhost kernel: traps: asterisk[11841] trap invalid opcode ip:4dd702 sp:7ffceb1e7590 error:0 in asterisk[400000+290000]
Nov  6 09:57:12 localhost kernel: traps: asterisk[11847] trap invalid opcode ip:4dd702 sp:7ffd3601d930 error:0 in asterisk[400000+290000]
Nov  6 09:57:13 localhost kernel: traps: asterisk[11853] trap invalid opcode ip:4dd702 sp:7ffee6c70d10 error:0 in asterisk[400000+290000]
Nov  6 09:57:15 localhost kernel: traps: asterisk[11860] trap invalid opcode ip:4dd702 sp:7fff1d0505f0 error:0 in asterisk[400000+290000]
Nov  6 09:57:16 localhost kernel: traps: asterisk[11866] trap invalid opcode ip:4dd702 sp:7ffcee6f3970 error:0 in asterisk[400000+290000]
Nov  6 09:57:17 localhost kernel: traps: asterisk[11872] trap invalid opcode ip:4dd702 sp:7ffee089f8b0 error:0 in asterisk[400000+290000]
Nov  6 09:57:19 localhost kernel: traps: asterisk[11878] trap invalid opcode ip:4dd702 sp:7fff212c9830 error:0 in asterisk[400000+290000]
Nov  6 09:57:20 localhost kernel: traps: asterisk[11884] trap invalid opcode ip:4dd702 sp:7ffce44651b0 error:0 in asterisk[400000+290000]
Nov  6 09:57:21 localhost kernel: traps: asterisk[11890] trap invalid opcode ip:4dd702 sp:7fff443c99f0 error:0 in asterisk[400000+290000]
Nov  6 09:57:23 localhost kernel: traps: asterisk[11896] trap invalid opcode ip:4dd702 sp:7ffc3a1640d0 error:0 in asterisk[400000+290000]
Nov  6 09:57:24 localhost kernel: traps: asterisk[11903] trap invalid opcode ip:4dd702 sp:7ffc2ed6f070 error:0 in asterisk[400000+290000]
Nov  6 09:57:25 localhost kernel: traps: asterisk[11909] trap invalid opcode ip:4dd702 sp:7fffa2ca0a10 error:0 in asterisk[400000+290000]
Nov  6 09:57:27 localhost kernel: traps: asterisk[11915] trap invalid opcode ip:4dd702 sp:7ffdec934dd0 error:0 in asterisk[400000+290000]
Nov  6 09:57:28 localhost kernel: traps: asterisk[11921] trap invalid opcode ip:4dd702 sp:7ffe62df3570 error:0 in asterisk[400000+290000]
Nov  6 09:57:29 localhost kernel: traps: asterisk[11927] trap invalid opcode ip:4dd702 sp:7fff67d63fb0 error:0 in asterisk[400000+290000]
Nov  6 09:57:31 localhost kernel: traps: asterisk[11933] trap invalid opcode ip:4dd702 sp:7ffe48e83830 error:0 in asterisk[400000+290000]
Nov  6 09:57:32 localhost kernel: traps: asterisk[11939] trap invalid opcode ip:4dd702 sp:7ffed33aca70 error:0 in asterisk[400000+290000]
Nov  6 09:57:33 localhost kernel: traps: asterisk[11945] trap invalid opcode ip:4dd702 sp:7ffd173e1b50 error:0 in asterisk[400000+290000]
Nov  6 09:57:35 localhost kernel: traps: asterisk[11951] trap invalid opcode ip:4dd702 sp:7fffb505c3d0 error:0 in asterisk[400000+290000]
Nov  6 09:57:36 localhost kernel: traps: asterisk[11957] trap invalid opcode ip:4dd702 sp:7ffce2c5dc90 error:0 in asterisk[400000+290000]
tail -f /var/log/asterisk/full
[root@localhost asterisk]# tail -f /var/log/asterisk/full
tail: impossible d'ouvrir « /var/log/asterisk/full » en lecture: Aucun fichier ou dossier de ce type
tail: aucun fichier restant
[root@localhost asterisk]#

May I made a new install of Asterisk from scratch again ?

This is the result of compiling on a virtual machine that mis-describes the capabilities of its CPU. It is a known problem, and the solution is to set a build option that prevents Asterisk from compiling code optimised for the particular CPU it is running on (this is not the no optimised option). Searching for “illegal instruction” on the forum should result in many examples of how to do this.

Also, please do not para-phrase error messages. If you had said “illegal instruction”, or “invalid opcode”, in your subject, I may well have recognized the situation immediately.

The instruction being referred to is a low level machine code instruction for the CPU itself.

This is not an authorisation issue, it is a case of the CPU being told to do something it does not know how to do.

So I must to reinstall a new version of Asterisk and the operating system CentOs ?

No. CentOS will have been compiled against a generic i386 or amd64 CPU.

You need to search the forum for the options to do this for Asterisk and recompile Asterisk.

The underlying bug is in the virtual machine software under which both are running (I’ve never heard of the compiler getting this wrong on real hardware, so I don’t think it is a bug in the compiler)>

I recompile asterisk with this process:

Now I can start and stop asterisk with these commands:

#service asterisk start

#service asterisk stop

The only thing who do not work is the connection to CLI by tying the command:
Asterisk -rvvvv

See the result:

[root@localhost asterisk]#
[root@localhost asterisk]# asterisk -rvvv
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
[root@localhost asterisk]# ls -la /var/run/asterisk/
total 4
drwxr-xr-x  2 root root  80  7 nov 11:28 .
drwxr-xr-x 29 root root 840  7 nov 11:12 ..
srwxr-xr-x  1 root root   0  7 nov 11:28 asterisk.ctl
-rw-r--r--  1 root root   6  7 nov 11:27 asterisk.pid
[root@localhost asterisk]#
[root@localhost asterisk]#
[root@localhost asterisk]# chown -R asterisk /var/run/asterisk/
[root@localhost asterisk]#
[root@localhost asterisk]#
[root@localhost asterisk]# ls -la /var/run/asterisk/
total 4
drwxr-xr-x  2 asterisk root  80  7 nov 11:28 .
drwxr-xr-x 29 root     root 840  7 nov 11:12 ..
srwxr-xr-x  1 root     root   0  7 nov 11:28 asterisk.ctl
-rw-r--r--  1 root     root   6  7 nov 11:28 asterisk.pid
[root@localhost asterisk]#

I can not change the owner of the files asterisk.ctl and asterisk.pid

If you had followed my advice you would have come up with http://forums.asterisk.org/viewtopic.php?f=1&t=88595 amongst many others.

The instructions you used are for building Asterisk on a platform that has a working development environment. Your virtual machine host is breaking the development environment, not just for Asterisk.

So, install asterisk on a vm is a platform working like a development environment. I must to install asterisk directly on the server.

If you build Asterisk on a broken VM, with the deafault options, it may not work.

However, if you follow the instructions in the link I gave you, you can compensate for the faulty VM.