To install Backtrace's package mirror, run:

# fetch https://packages.backtrace.io/LICENSE/stork/freebsd/RELEASE/backtrace.conf -o /etc/pkg/backtrace.conf
  • LICENSE: Contact us if you haven't received your license yet.
  • RELEASE: major version, e.g. 11, 12, etc. Note: 11.0 is the minimum required version for coresnap.

This will configure pkg to pull from Backtrace's mirror. To verify proper pkg configuration, run:

# pkg update
# pkg search -x '^backtrace-*'

Then install the packages:

# pkg install backtrace-coroner backtrace-coresnap backtrace-ptrace backtrace-libbt

Initial configuration

Once installed, coresnapd requires a few configuration changes to start:

# sysrc coresnapd_enable=YES
# sysrc crashinfo_program="/opt/backtrace/sbin/kernel_coresnap"
# sysrc local_startup="$(sysrc -n local_startup) /opt/backtrace/etc/rc.d"

coresnapd uses coroner to perform submissions of crashes.  Configure it in /usr/local/etc/coroner.cf.  Consult the coroner documentation for more information.

Now start coresnapd:

# service coresnapd start

Check its status:

$ service coresnapd status
coresnapd is running as pid 613.

Testing

Coresnapd leverages devd on FreeBSD to get notified about userland crashes, which are automatically stored in /var/coresnap/archive/corefiles.  To test, simply run a program that crashes, and it will be processed.

Kernel crashes are processed by /opt/backtrace/sbin/kernel_coresnap in place of the standard /usr/sbin/crashinfo, and may require configuring a dump device:

# sysrc dumpdev=AUTO

Consult the rc.conf documentation for more information on this.  To force a kernel crash to test the integration, run:

# sysctl debug.kdb.panic=1

When the system comes up again, it will process the kernel crash and deliver it to coresnapd to submit using coroner.

Did this answer your question?