Asterisk Coredump file location

issue: I’m facing the crash issue with asterisk 16.24.X (CentOS 7) so I recompiled my asterisk with Debug_Threrd, Better_Backtrace and DONT_Optimize flags and reinstalled it on my server. But I’m not getting the coredump after a crash. I have checked the following folders

/tmp/
/var/crash/
/var/log/asterisk

I also started the asterisk with the asterisk -g -cvvvvvvvvv command but was unable to find the coredump file.

Thanks

It should be in the current directory at the time you ran the above command, provided that it still had permission to create the file in that directory. I believe the supplied start up scripts start it in /tmp.

My guess is that it didn’t have sufficient permission e.g. you started it in /, but set it to change to user asterisk.

1 Like

also try look here if you have systend

/var/lib/systemd/coredump

This may also be of interest:

sudo ls -l /proc/$(pidof asterisk)/cwd

In addition to what david551 said, if you run core show settings in the CLI, see if there is anything for the “Dump core on crash” and “Current running directory” options. I had similar issues a while back and these were added to help with this.

Thanks @InterLinked. but my configured folders are empty, no coredump log in “/” and “/var/log/crash/”

Following the result of the “core show setting” command

PBX Core settings
-----------------
  Version:                     16.25.3
  Build Options:               DONT_OPTIMIZE, COMPILE_DOUBLE, DEBUG_THREADS, BETTER_BACKTRACES
  Maximum calls:               Not set
  Maximum open file handles:   1024
  Root console verbosity:      6
  Current console verbosity:   6
  Debug level:                 0
  Trace level:                 0
  Dump core on crash:          Yes
  Core dump file:              /var/crash/core.%u.%e.%p
  Maximum load average:        0.000000
  Minimum free memory:         0 MB
  Startup time:                04:36:20
  Last reload time:            04:36:20
  System:                      Linux/3.10.0-1160.62.1.el7.x86_64 built by root on x86_64 2022-05-13 08:37:46 UTC
  System name:                 
  Entity ID:                   56:00:03:fc:6d:a5
  PBX UUID:                    dde9fd67-cf72-4b48-b3d9-e063505fedd8
  Default language:            en
  Language prefix:             Enabled
  User name and group:         asterisk/asterisk
  Running directory:           /
  Executable includes:         Disabled
  Transcode via SLIN:          Enabled
  Transmit silence during rec: Disabled
  Generic PLC:                 Enabled
  Generic PLC on equal codecs: Disabled
  Hide Msg Chan AMI events:    Disabled
  Min DTMF duration::          80
  Cache media frames:          Enabled
  RTP use dynamic payloads:    1
  RTP dynamic payload types:   35-63,96-127

* Subsystems
  -------------
  Manager (AMI):               Enabled
  Web Manager (AMI/HTTP):      Disabled
  Call data records:           Enabled
  Realtime Architecture (ARA): Enabled

* Directories
  -------------
  Configuration file:          /etc/asterisk/asterisk.conf
  Configuration directory:     /etc/asterisk
  Module directory:            /usr/lib64/asterisk/modules
  Spool directory:             /var/spool/asterisk
  Log directory:               /var/log/asterisk
  Run/Sockets directory:       /run/asterisk
  PID file:                    /run/asterisk/asterisk.pid
  VarLib directory:            /usr/share/asterisk
  Data directory:              /usr/share/asterisk
  ASTDB:                       /var/spool/asterisk/astdb
  IAX2 Keys directory:         /usr/share/asterisk/keys
  AGI Scripts directory:       /usr/share/asterisk/agi-bin

If you run dmesg, so you see a segfault? How was Asterisk killed?

Yes, I received the following entry in “/var/log/message” and “dmesg”

[247534.774905] asterisk[18839]: segfault at 38 ip 00007fb94933f6f7 sp 00007fb91b75b4b0 error 6 in libswift.so.6.0[7fb9492dc000+95000]

What are the permissions on /var/crash? That’s where the core file should be.
Either make asterisk/asterisk the owner or make it 777.

Also, from your post:

Running directory: /

So the core file probably went to /, which it doesn’t have write access to.

You need to start Asterisk in /var/crash, not /. e.g. cd /var/crash && asterisk -g

1 Like

I feel I should also state that this crash appears to be in non-Asterisk code/an outside module. As a result you won’t be able to file an issue on the Asterisk issue tracker for it.

Thanks, I changed the “Running directory” and permission of “/var/crash” and it works…

gdb -c /var/crash/core.992.asterisk.15257

Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `asterisk -g -cvvvvvvvvvvvvvvvvvvvv'.
Program terminated with signal 11, Segmentation fault.
**#0  0x00007f7c52f52208 in LM_find_voice () from /opt/swift/lib/libswift.so.6**