Kernel Dumping & Debugging it

Hello,

OS: FreeBSD

Kernel has some problem and I have used DB debbuger and it halts there when I panic(reboot) I get a message
Code:
Cannot Dump. Device not defined or unavailable
I need a way to get the dump of kernel for debugging the problem. Here is a reference to how to do it: http://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug.html. But I am not getting exactly what has to be done.

Can anyone help me with set of commands and tell me clearly what has to be done?

--
Thanks & Regards
Nikhil Kathare
 
To obtain a kernel dump you have to add these lines to your /etc/rc.conf:
Code:
dumpdev="AUTO"
dumpdir="/var/crash"

From dumpon(8):
The dumpon utility is used to specify a device where the kernel can save a crash dump in the case of a panic.

From savecore(8):
The savecore utility looks for dumps on each device specified by the device argument(s), or on each device in /etc/fstab marked as ``dump'' or ``swap''. The savecore utility checks the core dump in various ways to make sure that it is complete. If it passes these checks, it saves the core image in directory/vmcore.# and information about the core in
directory/info.#

In practice:

The dumpon(8) utility saves a dump of the memory in the dumpdev device (usually a swap device - if "AUTO" the system use the first configured swap device)

The savecore(8) utility extracts the image of your (previously) running kernel from dumpdev and saves the image in dumpdir.

You don't have to run these programs by hand. When your kernel panics, on next reboot they are automatically executed.

Next, you should follow the instructions in the Developers Handbook.
 
  • Thanks
Reactions: 0mp
I have done all as you said earlier also and now also tried it once again, but I am not getting the kernel dump. After panic it is displaying message
Code:
Cannot dump. Device not defined or Unavailable

As you said
<if "AUTO" the system use the first configured swap device>
Then where do I find this swap device? Or how shall I create this device?

My fstab details are as below:

Code:
#Device      MountPoint    Fstype  Options    Dump   Pass#
/dev/da0s1b  none          swap    sw         0       0
/dev/da0s1a  /             ufs     rw         1       1
/dev/acd0    /cdrom        cd9660   ro,noauto 0       0

--
Thanks & Regards
 
Nikhil123 said:
Then were do i find this swap device?

It's in your /etc/fstab:

Nikhil123 said:
/dev/da0s1b none swap sw 0 0

So /dev/da0s1b is your swap device and if you have added these lines to your /etc/rc.conf:

Code:
dumpdev="AUTO"
dumpdir="/var/crash"

when your kernel panics you should found a file named vmcore.# (where "#" is a number starting from 0) in the /var/crash/ directory.

[OT]You should properly format your posts: link[/OT]
 
Hello Dies,

Thanks for reply, I have done all these steps even then I am not able to get the kernel dump. When booting it restarts continuosly and at last i get messages like:
Code:
Cannot Dump. Device not defined or unavailable

I rebooted through old kernel and made all the changes like you had told me but the same problem persists, and the new kernel will be booting automatically continuously and lastly it gives message like
Code:
Cannot Dump. Device not defined or unavailable

What should be done for that?

--
Thanks & Regards
 
Are you sure your dump device (swap) is big enough?

From dumpon(8):

For most systems the size of the specified dump device must be at least
the size of physical memory. Even though an additional 64 kB header is
added to the dump, the BIOS for a platform typically holds back some mem-
ory, so it is not usually necessary to size the dump device larger than
the actual amount of RAM available in the machine.

The dumpon utility will refuse to enable a dump device which is smaller
than the total amount of physical memory as reported by the hw.physmem
sysctl(8) variable.
 
Hi Dies,

Physical memory : Are you talking about size of physical data or the total physical memory size?

If the actual physical memory your talking then its not fair to create a swap memory greater then the physical memory.Even then tell me how to check size of physical memory and swap and increase size of swap.

If no then my swap is large enough to hold the data on physical memory.

--
Regards
 
Back
Top