lintpkgsrc comes from pkgtools/lintpkgsrc
[ikiwiki.git] / docs / howtos / HowToCreateACoreDump.mdwn
1 # Getting a system core dump 
2 [[!toc levels=3 ]]�  A full system core dump (also called post-mortem dump) is sometimes needed to track down a bug in the DragonFlyBSD kernel.
3
4 Please note: A full core dump is obtained by triggering a kernel panic. Like when pulling the power plug from the wall socket, unsaved data will be lost, recently saved data might be lost, and filesystems mounted async might be destroyed.
5
6 ## Requirements 
7
8 * a dump partition at least as large as main memory (usually swap)
9
10 * `/var/crash` must be on a filesystem with enough space to hold the dump (the size of main memory).
11
12 * sync on panic should be disabled in the kernel
13
14 ## Setup 
15 ### Setting up the dump device 
16
17 * If your swap partition is as large as main memory, it can be used as a dump device.
18
19 * If your swap partition is too small, you use any partition that doesn't contain a filesystem.
20
21 * Add this to `/etc/rc.conf`:
22
23     
24      dumpdev="/dev/<devicenode>"
25
26
27 * Please refer to [dumpon(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#dumpon&section8) (http://leaf.dragonflybsd.org/cgi/web-man?command=dumpon&section=8) for details.
28
29 ### Setting up /var/crash 
30 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.
31
32     
33     # cpdup /var/crash /home/var.crash
34     # rm -rf /var/crash
35     # ln -s /home/var.crash /var/crash
36
37 ### Disabling sync on panic 
38 Add this to `/etc/sysctl.conf`
39
40     
41     kern.sync_on_panic=0
42
43 # Getting a core dump 
44 Hit `<ctrl-alt-esc>` at the desired moment. This will break into the kernel debugger. Then type:
45
46     
47     # panic
48
49 The machine should reboot automatically. Sometimes it might require a cold reset.
50
51 If the machine has dropped to a dbb> prompt by itself you can type the following to get a useful dump:
52
53     
54     # call dumpsys
55
56 During the following startup the core dump will be automatically saved to `/var/crash`.
57
58 # Getting a coredump on a remote machine
59 Set debug.debugger_on_panic to 0 or configure your kernel with options DDB_UNATTENDED.
60
61 # Useful hints 
62
63 * You can have the settings described above take effect without rebooting using the following commands:
64
65     
66     # dumpon /dev/<devicenode>
67     # sysctl kern.sync_on_panic=0
68
69
70 * Core files can get quite unwieldy with large amounts of main memory. In order to temporarily limit the amount of physical memory add a line similar to the following to /boot/loader.conf (and remove it again once you've produced the core dump):
71
72     
73     hw.physmem="64M"
74
75
76 * On systems derived from DEVELOPMENT (HEAD) after 20 August 2005, you can get a panic directly by pressing `<ctrl-alt-shift-esc>` if you set the `sysctl machdep.enable_panic_key to 1`.