Problems with getting a crash dump

From: Alexander <alex_at_alexslomka.xyz>
Date: Mon, 08 Nov 2021 19:08:31 UTC
Hello, I am currently using FreeBSD 14.0-CURRENT and I found a bug that
triggers a kernel panic. I wanted to make a kernel crash dump to further
investigate the issue, but after a few tries I still did not manage to do it.
I started by following the instructions in the FreeBSD Handbook. I checked that
/dev/nvd0p2.eli is an active swap device and I configured it to be used as a
dump device like this:

# dumpon -v /dev/nvd0p2.eli
# sysctl debug.kdb.panic=1

Then I booted into single user mode to extract the core dumb:

# savecore -vC /dev/nvd0p2
checking for kernel dump on device /dev/nvd0p2
mediasize = 2147483648 bytes
sectorsize = 512 bytes
magic mismatch on last dump header on /dev/nvd0p2
No dump exists

A you can see the core dump was not written to the device. Later I also tried
using /dev/nvd0p2 (with out the "eli" part), because /dev/nvd0p2.eli is only
available after I enable it using swapon, but the handbook states the I should
first extract the dump, before I use the device as swap again. But the result
was the same. /dev/nvd0p2 is only 2gb in size and it's an encrypted swap device,
so I thought that:
1) Maybe the size of the device is to small even for a minidump.
2) Perhaps using encrypted swap as a dump device is not supported.

Because of those complications I decided to use an external 8gb USB drive as my
dump device.

# gpart create -s gpt /dev/da0
# gpart add -t freebsd-swap /dev/da0
# swapoff -a
# swapon /dev/da0p1
# dumpon -v /dev/da0p1
kernel dumps on priority: device
0: da0p1

I have 8gb of RAM so a 8gb dump device should be big enough for a minidump.
I used `sysctl debug.kdb.panic=1` to crash the kernel and rebooted the system.
I also waited for 10 minutes to ensure the the kernel finished writing the core
dump to the device.

# savecore -vC /dev/da0p1
checking for kernel dump on device /dev/da0p1
mediasize = 7744741376 bytes
sectorsize = 512 bytes
magic mismatch on last dump header on /dev/da0p1
No dump exists

As you can see I still did not manage to get a kernel crash dump. Any ideas?

Here is a picture of the output I get after running `sysctl debug.kdb.panic=1`:
https://forums.freebsd.org/attachments/img_20211108_163313-jpeg.11936/

PS yes kern.coredump is set to 1.