| Parent Directory|
Linux Kernel Panic
- Core dump
OMG, Panic!!! Ok, I just had to write that...
First of all, panic is not chaos, it is simply the kernel panic() routine.
This routine is called when the kernel detects an internal fatal error.
So, what happens when the panic() routine is called?
Typically, this results in a stack trace to the console and dumping
kernel memory to disk. After that, the default is to just sit there
waiting for someone to grab the information from the console. Meaning,
the *default* linux kernel will never reboot after panic.
** Note: If you want the system to reboot after the panic, set:
"kernel.panic=20" in /etc/sysctl.conf
For for an immediate change:
sysctl -w kernel.panic=20
As mentioned above, when the kernel executes the panic() routine, one of the
actions the kernel does before halting is to write a core file out to disk.
This core file contains lots of useful information for debugging what caused
the panic; the details of which seem mysterious to the untrained observer.
Well, that is until they understand the Kernel Symbol Table.
The Kernel Symbol Table (/boot/System.map) maps symbols (names) to their
addresses in memory. That means that with the symbol table, a debugger knows
exactly where to go in the core file to find information about what task was
running, what system call was being executed, what values were set, etc.
A symbol table is static for a kernel build. Symbol addresses may (and do)
change between kernels, so a System.map installs with each kernel.
An oops is an event that happens when the kernel detects a mistake.
This is also called a soft panic. On the flip side, a hard panic as discussed
above is also known as Aieee!
What happens when a kernel oops occurs? The default is to declare an OOPS,
kill the process that caused the oops, and continue running.
As can be imagined, when there is a mistake in the kernel this could be
anything; from something that doesn't matter to something that really matters.
For this reason, it is wise to halt the system via the panic() routine.
To set the kernel to panic on oops, use `sysctl -w kernel.panic_on_oops=1`
For this to survive reboots, put it in /etc/sysctl.conf.
After that, follow proceedure to capture stack trace and the core file.
After panic(), the kernel halts. That means that whatever is in memory
will be there until:
1) the power is shut off, or
2) another kernel boots up and starts writing all over it.
Give you any ideas? Like booting up another kernel that doesn't write all
over the existing bits in RAM?
If you did, you could scrape off the bits from the DIMMs and add that to
the stack trace and core file.
SysRq (System Request)
SysRq is a way to get a little bit more control when the system panics.
For example, the ctrl-alt-del keys don't work after a panic(). SysRq, however,
does give provide some keystroke combinations that can be used after a panic().
If the time comes when the SysRq keys are required, simply use the magic SysRq
[SysRq] key is the "print screen" key, and
[COMMAND] is one of the following:
b - reboot immediately without syncing or unmounting disks
e - sends a SIGTERM to all running processes, except for init
o - shut down system
s - attempt to sync all mounted filesystems
u - attempt to remount all mounted filesystems as read-only
These keys need to be pressed together simultaneously to take effect.
If you want to use SysRq, then set: kernel.sysrq = 1
In summary, auto-rebooting is great for remote systems, and
the magic SysRq combo is very useful for local systems.
kdump - google vmlinux kdump
- Kdump doesn't support compressed kernel images; use image: vmlinux-kdump
For more, see:
This site contains many of my notes from research into different aspects of
the Linux kernel as well as some of the software provided by GNU and others.
Thouugh these notes are not fully comprehensive or even completetly accurate,
they are part of my on-going attempt to better understand this complex field.
And, they are your to use.
Should you wish to report any errors or suggestions, please let me know.
Should you wish to make a donation for anything you may have learned here,
please direct that donation to the
with my sincere thanks.
The code for this site, which is just a few CGI scripts, may be found on GitHub
For both data encryption and password protection, try Personal Data Security
"We left all that stuff out. If there's an error, we have this
routine called 'panic', and when its called, the machine crashes,
and you holler down the hall, 'Hey, reboot it.'"
- Dennis Ritchie on Unix (vs Multics)