DragonFly BSD

How to Get a Core Dump

Sometimes, a system core dump (also called post-mortem dump) is needed to track down a bug in the DragonFly BSD kernel.

WARNING: A core dump is obtained by triggering a kernel panic, which likes directly cutting off the power, therefore, unsaved data will be lost, recently saved data (still in the cache) might be lost, and filesystems mounted async might be destroyed.

WARNING: The saved core file (in /var/crash) contains sensitive data, e.g., passwords, certificates, decrypted private keys. Therefore, do not upload it to public clouds/servers!

Requirements

Configurations

Dump device

/var/crash

If /var/crash is residing on a filesystem without enough room to accommodate the core dump, you can move it to a different filesystem and use a symbolic link. For example:

# cpdup /var/crash /home/var.crash
# rm -rf /var/crash
# ln -s /home/var.crash /var/crash

Disable "sync on panic"

The kern.sync_on_panic controls whether to do a sync before rebooting from a panic, which is disabled by default as we required. Otherwise, ddd this to /etc/sysctl.conf:

kern.sync_on_panic=0

Get a Core Dump

Hit <Ctrl-Alt-Esc> at the desired moment. This will break into the kernel debugger. Then type:

# panic

The machine should reboot automatically. Sometimes it might require a cold reset.

If the machine has dropped to a db> prompt by itself you can type the following to get a useful dump:

# call dumpsys

During the following startup the core dump will be automatically saved to /var/crash.

Create a Core Dump Automatically on Panic

Set debug.debugger_on_panic=0 or configure your kernel with options DDB_UNATTENDED, which will create a core dump automatically and reboot on system panic.

This configuration may be useful on a remote system.

Tips