When to use this
An instance keeps panicking, freezing or soft-locking, and rebooting it only buys time. Oracle Support or your kernel team asks for a vmcore. Without one, root cause usually ends at "unknown, rebooted".
This runbook has two parts. Prepare before the next incident: make sure kdump works and the kernel will panic on a hang. Capture during the incident: trigger the dump on a hung instance with an OCI diagnostic interrupt (an NMI).
Caution
A diagnostic interrupt crashes the kernel on purpose. Anything not flushed to disk is lost, and Oracle warns that sending one to a live system can cause data corruption. Use it only on an instance that is already unresponsive, or on a test instance.
Part 1: prepare the instance
Check what the image already gives you
Oracle Linux platform images ship with kdump installed. Newer OL8 images (August 2020 onward) come fully configured, while older images may be only partly configured. Verify it rather than assume:
systemctl is-active kdump
kdumpctl status # "Kdump is operational"
grep -o 'crashkernel=[^ ]*' /proc/cmdline
cat /sys/kernel/kexec_crash_size # bytes reserved; 0 means nothing reserved
grep -Ev '^\s*(#|$)' /etc/kdump.conf
| Result | Meaning | Action |
|---|---|---|
kexec_crash_size is 0 | No memory reserved for the capture kernel | Set crashkernel= and reboot |
| kdump inactive, "no memory reserved" | Same as above | Same |
| kdump active, but reservation tiny on a large VM | Capture kernel may run out of memory during the dump | Increase the reservation |
path on a small root filesystem | Dump will fail or fill / | Point to a dedicated volume |
Set the crashkernel reservation
On OL8 and earlier the default is crashkernel=auto. OL9 and later don't support auto, so you must give an explicit size. A memory-range syntax scales with instance size:
# OL9 example; size the ranges for your shapes and test the result
sudo grubby --update-kernel=ALL --args="crashkernel=1G-64G:256M,64G-:512M"
sudo grubby --info=DEFAULT | grep args
sudo reboot
On systems managed through /etc/default/grub, edit GRUB_CMDLINE_LINUX and regenerate it with grub2-mkconfig -o /boot/grub2/grub.cfg. The right size depends on memory, device count and kernel version. Always test-crash the result (below). Don't assume it's enough.
Choose where the dump goes
On OL8 platform images the default target is /var/oled/crash/<ip>-<date>-<time>/. Some OL7 images use /var/crash. Large VMs produce large dumps even after filtering, so give them space:
# /etc/kdump.conf
path /var/oled/crash
core_collector makedumpfile -l --message-level 1 -d 31
failure_action dump_to_rootfs
-d 31 drops zero, cache, user and free pages, which keeps the vmcore much smaller than RAM. Other targets are supported: nfs <server>:/<export> (for example an OCI File Storage export) or ssh user@host with sshkey. Use them when the local disk may be the thing that's broken.
sudo systemctl restart kdump
kdumpctl status
Make hangs turn into panics
kdump only fires on a panic. A hung instance needs the kernel to panic when it receives the NMI that OCI sends, and optionally on lockups:
sudo tee /etc/sysctl.d/90-crashdump.conf <<'EOF'
kernel.unknown_nmi_panic = 1
kernel.panic_on_unrecovered_nmi = 1
kernel.softlockup_panic = 1
EOF
sudo sysctl --system
kernel.unknown_nmi_panic=1 is the setting the OCI diagnostic interrupt documentation requires. softlockup_panic and hung_task_panic turn soft hangs into reboots plus dumps. That's good for diagnosis, but it changes behaviour, so enable them only where an automatic crash is acceptable.
Test it once
On a non-production clone of the instance:
echo 1 | sudo tee /proc/sys/kernel/sysrq
echo c | sudo tee /proc/sysrq-trigger # instance crashes immediately
Watch the serial console connection while it dumps, then check after it reboots:
ls -lh /var/oled/crash/*/
# expect: vmcore, vmcore-dmesg.txt, kexec-dmesg.log
If no vmcore appears, read kexec-dmesg.log. The usual cause is the capture kernel running out of memory, which means the reservation is too small.
Part 2: capture during an incident
1. Confirm the instance is really hung
INST=ocid1.instance.oc1..example
oci compute instance get --instance-id "$INST" --query 'data."lifecycle-state"' --raw-output
Open a serial console connection. If you get a login prompt, collect evidence from inside instead (dmesg, top, /proc/pressure/*, echo w > /proc/sysrq-trigger for blocked tasks). A diagnostic interrupt is for instances that don't respond at all.
2. Check preconditions
- The instance is
RUNNING. - No block volume or secondary VNIC attach or detach is in progress (
oci compute volume-attachment list --instance-id "$INST"). - kdump was prepared (Part 1). Otherwise you only get a reboot, not a dump.
- You've told the application owner that this ends in a crash and reboot.
3. Send the diagnostic interrupt
oci compute instance action --instance-id "$INST" --action SENDDIAGNOSTICINTERRUPT
The IAM permission comes with manage instance-family. Keep the serial console connection open to watch the panic, then the capture kernel, then the reboot.
Warning
The Console keeps showing the instance as Running while it crashes, dumps and restarts. Send only one interrupt. A second NMI during the capture kernel can kill the dump. Wait several minutes. Large-memory instances take longer to write the vmcore.
4. Preserve the dump
DUMP=$(ls -dt /var/oled/crash/*/ | head -1)
sudo tar -C "$DUMP" -czf /tmp/vmcore-$(hostname)-$(date +%F).tgz .
oci os object put --bucket-name incident-artifacts --file /tmp/vmcore-*.tgz
Copy it off the instance before anyone rebuilds it.
Part 3: first-pass analysis
Read vmcore-dmesg.txt first. It is written first, so it often exists even when the vmcore is incomplete. Look for the panic string, BUG:, soft lockup, hung_task and the last module loaded.
For deeper work, install the matching debuginfo (from the Oracle Linux debuginfo repository for your release) and open the dump:
sudo dnf install -y crash kernel-uek-debuginfo-$(uname -r) # use kernel-debuginfo for RHCK
sudo crash /usr/lib/debug/lib/modules/$(uname -r)/vmlinux "$DUMP/vmcore"
crash> sys # kernel, uptime, panic string
crash> log | tail -100
crash> bt # backtrace of the panicking task
crash> ps | grep UN # tasks in uninterruptible sleep (I/O hangs)
crash> kmem -i # memory pressure at the time
crash> foreach UN bt
Debuginfo has to match the crashed kernel exactly. If the instance has been patched since, install the version printed by sys rather than $(uname -r).
| Pattern in dump | Typical direction |
|---|---|
Many UN tasks in NFS or iSCSI stacks | Storage path: File Storage mount, iSCSI multipath, block volume |
soft lockup in one driver | Driver or kernel bug: check UEK errata and Ksplice |
| OOM messages just before | Memory sizing or a leak, not a kernel fault |
| Panic in a third-party module | Agent or security software: involve its vendor |
Prevent it next time
- Bake the crashkernel,
kdump.confand NMI sysctl settings into your golden image, and test-crash each new image build. - Monitor free space on the dump target.
- Keep serial console access and the
SENDDIAGNOSTICINTERRUPTprocedure in the on-call runbook, with who may approve it. - Install debuginfo on a separate analysis host, not on production instances.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get